Skip to content

Commit 81d2e98

Browse files
committed
feat: enhance CI workflow by adding base branch fetch and restructuring test actions
1 parent 8e48182 commit 81d2e98

1 file changed

Lines changed: 26 additions & 2 deletions

File tree

.github/workflows/test.yaml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ jobs:
4242
with:
4343
fetch-depth: 0
4444

45+
- name: Fetch base branch
46+
run: |
47+
if [ "${{ github.event_name }}" == "pull_request" ]; then
48+
git fetch origin ${{ github.base_ref }}
49+
else
50+
git fetch origin main
51+
fi
52+
4553
- name: Set up Flutter
4654
uses: subosito/flutter-action@v2
4755
with:
@@ -78,6 +86,14 @@ jobs:
7886
with:
7987
fetch-depth: 0
8088

89+
- name: Fetch base branch
90+
run: |
91+
if [ "${{ github.event_name }}" == "pull_request" ]; then
92+
git fetch origin ${{ github.base_ref }}
93+
else
94+
git fetch origin main
95+
fi
96+
8197
- name: Set up Flutter
8298
uses: subosito/flutter-action@v2
8399
with:
@@ -95,12 +111,20 @@ jobs:
95111
debug: true
96112
base-branch: ${{ github.event_name == 'pull_request' && format('origin/{0}', github.base_ref) || 'origin/main' }}
97113

98-
test_action:
114+
verify_tests:
99115
name: Verify All Tests
100116
needs: [lint_shellcheck, test_simple_app, test_super_app]
101117
runs-on: ubuntu-latest
102118
if: always()
103119
steps:
104120
- name: Check status
105121
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
106-
run: exit 1
122+
run: exit 1
123+
124+
test_action:
125+
name: test_action
126+
needs: verify_tests
127+
runs-on: ubuntu-latest
128+
steps:
129+
- name: Success
130+
run: echo "All tests passed"

0 commit comments

Comments
 (0)