Skip to content

Commit 2bd6543

Browse files
committed
Unify retry strategy and remove rerun-failed-jobs
- Original + retry_1: always `continue-on-error: true` so the workflow continues to the next retry attempt - retry_2: no `continue-on-error` — if all 3 attempts fail, the workflow goes red as expected - Extract Fantom tests into a reusable workflow with the same retry pattern (fantom-tests.yml) - Remove rerun-failed-jobs since all retries are now handled by the in-workflow retry_1/retry_2 chain
1 parent 55a2797 commit 2bd6543

2 files changed

Lines changed: 60 additions & 47 deletions

File tree

.github/workflows/fantom-tests.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Fantom Tests
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
workflow_call:
8+
outputs:
9+
status:
10+
description: "The result of the Fantom tests (success or failure)"
11+
value: ${{ jobs.report.outputs.status }}
12+
13+
jobs:
14+
test:
15+
runs-on: 8-core-ubuntu
16+
container:
17+
image: reactnativecommunity/react-native-android:latest
18+
env:
19+
TERM: "dumb"
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v6
23+
- name: Run Fantom Tests
24+
uses: ./.github/actions/run-fantom-tests
25+
26+
report:
27+
needs: test
28+
if: always()
29+
runs-on: ubuntu-latest
30+
outputs:
31+
status: ${{ steps.check.outputs.status }}
32+
steps:
33+
- id: check
34+
run: |
35+
if [[ "${{ needs.test.result }}" == "failure" ]]; then
36+
echo "status=failure" >> $GITHUB_OUTPUT
37+
else
38+
echo "status=success" >> $GITHUB_OUTPUT
39+
fi

.github/workflows/test-all.yml

Lines changed: 21 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ jobs:
159159
test_e2e_ios_rntester:
160160
needs: test_ios_rntester
161161
uses: ./.github/workflows/e2e-ios-rntester.yml
162-
continue-on-error: ${{ github.event_name == 'pull_request' }}
162+
continue-on-error: true
163163
secrets: inherit
164164

165165
test_e2e_ios_rntester_retry_1:
@@ -173,13 +173,12 @@ jobs:
173173
needs: test_e2e_ios_rntester_retry_1
174174
if: ${{ always() && needs.test_e2e_ios_rntester_retry_1.outputs.status == 'failure' }}
175175
uses: ./.github/workflows/e2e-ios-rntester.yml
176-
continue-on-error: true
177176
secrets: inherit
178177

179178
test_e2e_ios_templateapp:
180179
needs: [build_npm_package, prebuild_apple_dependencies]
181180
uses: ./.github/workflows/e2e-ios-templateapp.yml
182-
continue-on-error: ${{ github.event_name == 'pull_request' }}
181+
continue-on-error: true
183182
secrets: inherit
184183

185184
test_e2e_ios_templateapp_retry_1:
@@ -193,13 +192,12 @@ jobs:
193192
needs: test_e2e_ios_templateapp_retry_1
194193
if: ${{ always() && needs.test_e2e_ios_templateapp_retry_1.outputs.status == 'failure' }}
195194
uses: ./.github/workflows/e2e-ios-templateapp.yml
196-
continue-on-error: true
197195
secrets: inherit
198196

199197
test_e2e_android_templateapp:
200198
needs: build_npm_package
201199
uses: ./.github/workflows/e2e-android-templateapp.yml
202-
continue-on-error: ${{ github.event_name == 'pull_request' }}
200+
continue-on-error: true
203201
secrets: inherit
204202

205203
test_e2e_android_templateapp_retry_1:
@@ -213,7 +211,6 @@ jobs:
213211
needs: test_e2e_android_templateapp_retry_1
214212
if: ${{ always() && needs.test_e2e_android_templateapp_retry_1.outputs.status == 'failure' }}
215213
uses: ./.github/workflows/e2e-android-templateapp.yml
216-
continue-on-error: true
217214
secrets: inherit
218215

219216
build_fantom_runner:
@@ -241,17 +238,23 @@ jobs:
241238
gradle-cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
242239

243240
run_fantom_tests:
244-
runs-on: 8-core-ubuntu
245-
needs: [build_fantom_runner]
246-
container:
247-
image: reactnativecommunity/react-native-android:latest
248-
env:
249-
TERM: "dumb"
250-
steps:
251-
- name: Checkout
252-
uses: actions/checkout@v6
253-
- name: Run Fantom Tests
254-
uses: ./.github/actions/run-fantom-tests
241+
needs: build_fantom_runner
242+
uses: ./.github/workflows/fantom-tests.yml
243+
continue-on-error: true
244+
secrets: inherit
245+
246+
run_fantom_tests_retry_1:
247+
needs: run_fantom_tests
248+
if: ${{ always() && needs.run_fantom_tests.outputs.status == 'failure' }}
249+
uses: ./.github/workflows/fantom-tests.yml
250+
continue-on-error: true
251+
secrets: inherit
252+
253+
run_fantom_tests_retry_2:
254+
needs: run_fantom_tests_retry_1
255+
if: ${{ always() && needs.run_fantom_tests_retry_1.outputs.status == 'failure' }}
256+
uses: ./.github/workflows/fantom-tests.yml
257+
secrets: inherit
255258

256259
build_android:
257260
runs-on: 8-core-ubuntu
@@ -282,7 +285,7 @@ jobs:
282285
test_e2e_android_rntester:
283286
needs: build_android
284287
uses: ./.github/workflows/e2e-android-rntester.yml
285-
continue-on-error: ${{ github.event_name == 'pull_request' }}
288+
continue-on-error: true
286289
secrets: inherit
287290

288291
test_e2e_android_rntester_retry_1:
@@ -296,7 +299,6 @@ jobs:
296299
needs: test_e2e_android_rntester_retry_1
297300
if: ${{ always() && needs.test_e2e_android_rntester_retry_1.outputs.status == 'failure' }}
298301
uses: ./.github/workflows/e2e-android-rntester.yml
299-
continue-on-error: true
300302
secrets: inherit
301303

302304
build_npm_package:
@@ -509,31 +511,3 @@ jobs:
509511
shell: bash
510512
run: node scripts/debugger-shell/build-binary.js
511513

512-
# E2E test retries are now handled by the retry_1/retry_2 reusable workflow jobs above.
513-
# This job only handles Fantom test retries on main.
514-
rerun-failed-jobs:
515-
runs-on: ubuntu-latest
516-
permissions:
517-
contents: read
518-
actions: write
519-
needs: [run_fantom_tests]
520-
if: ${{ github.ref == 'refs/heads/main' && always() }}
521-
steps:
522-
- name: Checkout
523-
uses: actions/checkout@v6
524-
- name: Rerun failed jobs in the current workflow
525-
env:
526-
GH_TOKEN: ${{ github.token }}
527-
run: |
528-
SHOULD_RETRY=${{fromJSON(github.run_attempt) < 3}}
529-
if [[ $SHOULD_RETRY == "false" ]]; then
530-
exit 0
531-
fi
532-
533-
FANTOM_TESTS_FAILED=${{ needs.run_fantom_tests.result == 'failure' }}
534-
echo "FANTOM_TESTS_FAILED: $FANTOM_TESTS_FAILED"
535-
536-
if [[ $FANTOM_TESTS_FAILED == "true" ]]; then
537-
echo "Rerunning failed jobs in the current workflow"
538-
gh workflow run retry-workflow.yml -F run_id=${{ github.run_id }}
539-
fi

0 commit comments

Comments
 (0)