File tree Expand file tree Collapse file tree 2 files changed +50
-36
lines changed Expand file tree Collapse file tree 2 files changed +50
-36
lines changed Original file line number Diff line number Diff line change @@ -2,23 +2,41 @@ name: Run Test Cases
2
2
3
3
on :
4
4
push :
5
- branches : [ master ]
5
+ branches : [master]
6
6
pull_request :
7
- branches : [ master ]
7
+ branches : [master]
8
8
9
9
jobs :
10
- checkout :
10
+ check_up_to_date :
11
11
name : Checkout Repository
12
12
runs-on : ubuntu-latest
13
13
steps :
14
14
- name : Checkout Code
15
15
uses : actions/checkout@v4
16
-
17
- setup-flutter :
18
- name : Setup Flutter
16
+ with :
17
+ fetch-depth : 0 # Fetch all history so we can compare
18
+
19
+ - name : Fetch all branches
20
+ run : git fetch origin
21
+
22
+ - name : Check if branch is up-to-date with master
23
+ run : |
24
+ # Compare the current branch with the master branch
25
+ if git merge-base --is-ancestor origin/master HEAD; then
26
+ echo "The current branch is up-to-date with master."
27
+ else
28
+ echo "The current branch is not up-to-date with master."
29
+ exit 1
30
+ fi
31
+
32
+ setup_and_test :
33
+ name : Setup Flutter and Run Test Cases
19
34
runs-on : ubuntu-latest
20
- needs : checkout
35
+ needs : check_up_to_date
21
36
steps :
37
+ - name : Checkout Code
38
+ uses : actions/checkout@v3
39
+
22
40
- name : Install Flutter SDK
23
41
uses : subosito/flutter-action@v2
24
42
with :
28
46
- name : Run Flutter doctor
29
47
run : flutter doctor -v
30
48
31
- - name : Checkout Code
32
- uses : actions/checkout@v3
33
-
34
49
- name : Run Flutter Analyzer (Lint)
35
50
run : flutter analyze
36
51
37
- test :
38
- name : Run Test Cases
39
- runs-on : ubuntu-latest
40
- needs : setup-flutter
41
- steps :
42
- - name : Checkout Code
43
- uses : actions/checkout@v3
44
-
45
52
- name : Run Flutter Tests
46
- run : flutter test
53
+ run : flutter test
Original file line number Diff line number Diff line change @@ -2,21 +2,39 @@ name: Publish to GitHub Pages
2
2
3
3
on :
4
4
push :
5
- branches : [ master ]
5
+ branches : [master]
6
6
7
7
jobs :
8
- checkout :
8
+ check_up_to_date :
9
9
name : Checkout Repository
10
10
runs-on : ubuntu-latest
11
11
steps :
12
12
- name : Checkout Code
13
13
uses : actions/checkout@v4
14
-
15
- setup-flutter :
16
- name : Setup Flutter
14
+ with :
15
+ fetch-depth : 0 # Fetch all history so we can compare
16
+
17
+ - name : Fetch all branches
18
+ run : git fetch origin
19
+
20
+ - name : Check if branch is up-to-date with master
21
+ run : |
22
+ # Compare the current branch with the master branch
23
+ if git merge-base --is-ancestor origin/master HEAD; then
24
+ echo "The current branch is up-to-date with master."
25
+ else
26
+ echo "The current branch is not up-to-date with master."
27
+ exit 1
28
+ fi
29
+
30
+ setup_and_deploy :
31
+ name : Setup Flutter and Deploy to GitHub Pages
17
32
runs-on : ubuntu-latest
18
- needs : checkout
33
+ needs : check_up_to_date
19
34
steps :
35
+ - name : Checkout Code
36
+ uses : actions/checkout@v3
37
+
20
38
- name : Install Flutter SDK
21
39
uses : subosito/flutter-action@v2
22
40
with :
@@ -26,23 +44,12 @@ jobs:
26
44
- name : Check Flutter Version
27
45
run : flutter --version
28
46
29
- - name : Checkout Code
30
- uses : actions/checkout@v3
31
-
32
47
- name : Get Flutter Dependencies
33
48
run : flutter pub get
34
49
35
50
- name : Run Flutter Analyzer (Lint)
36
51
run : flutter analyze
37
52
38
- deploy :
39
- name : Deploy to GitHub Pages
40
- runs-on : ubuntu-latest
41
- needs : setup-flutter
42
- steps :
43
- - name : Checkout Code
44
- uses : actions/checkout@v4
45
-
46
53
- name : Deploy to GitHub Pages
47
54
uses : bluefireteam/flutter-gh-pages@v8
48
55
with :
You can’t perform that action at this time.
0 commit comments