mirror of
https://github.com/react/react-native.git
synced 2026-09-28 05:13:06 +08:00
Summary: Artifact uploads can fail on transient network errors such as the `ETIMEDOUT` in https://github.com/react/react-native/actions/runs/35598907154/job/106330670539. This change: - adds a local composite action backed by `actions/upload-artifact` v7.0.1 - retries failed uploads twice, waiting 10 seconds before attempt 2 and 20 seconds before attempt 3 - propagates the third failure to the caller - preserves all v7 inputs and outputs - migrates all 35 artifact upload call sites to the wrapper ## Changelog: [INTERNAL] [FIXED] - Retry artifact uploads to reduce transient CI failures. Pull Request resolved: https://github.com/react/react-native/pull/58620 Test Plan: - `node_modules/.bin/prettier --check $(git diff --name-only HEAD^ -- '*.yml' '*.yaml')` — passed - `npx --yes action-validator/cli@0.6.0 .github/actions/upload-artifact/action.yml` — passed - `git diff HEAD^ --check` — passed - Verified no `actions/upload-artifact@v6` references remain under `.github` Reviewed By: andrewdacenko Differential Revision: D121002745 Pulled By: cortinico fbshipit-source-id: e63e30f3e86b0a2cb6c94aa549cdfe5e6dfbdc2b
108 lines
3.7 KiB
YAML
108 lines
3.7 KiB
YAML
name: E2E Android RNTester
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
fail-on-error:
|
|
type: boolean
|
|
default: false
|
|
retry-attempt:
|
|
type: number
|
|
default: 0
|
|
outputs:
|
|
status:
|
|
description: 'The result of the E2E tests (success or failure)'
|
|
value: ${{ jobs.report.outputs.status }}
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: 4-core-ubuntu
|
|
outputs:
|
|
status: ${{ steps.report-status.outputs.status }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
flavor: [debug, release]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
- name: Setup node.js
|
|
uses: ./.github/actions/setup-node
|
|
- name: Install node dependencies
|
|
uses: ./.github/actions/yarn-install
|
|
- name: Download APK
|
|
uses: actions/download-artifact@v7
|
|
with:
|
|
name: rntester-${{ matrix.flavor }}
|
|
path: ./packages/rn-tester/android/app/build/outputs/apk/${{ matrix.flavor }}/
|
|
- name: Print folder structure
|
|
run: ls -lR ./packages/rn-tester/android/app/build/outputs/apk/${{ matrix.flavor }}/
|
|
- name: Download previous per-flow test state
|
|
if: ${{ inputs.retry-attempt > 0 }}
|
|
continue-on-error: true
|
|
uses: actions/download-artifact@v7
|
|
with:
|
|
name: e2e_android_rntester_state_${{ matrix.flavor }}_arm64-v8a_NewArch
|
|
path: /tmp/maestro-android-state
|
|
- name: Check for unfinished E2E flows
|
|
id: test-state
|
|
shell: bash
|
|
run: |
|
|
SHOULD_RUN=true
|
|
if [[ -f /tmp/maestro-android-state/results.json ]] && \
|
|
jq -e '(.flows | length > 0) and all(.flows[]; .status == "passed")' /tmp/maestro-android-state/results.json > /dev/null; then
|
|
SHOULD_RUN=false
|
|
fi
|
|
echo "should-run=$SHOULD_RUN" >> "$GITHUB_OUTPUT"
|
|
- name: Run E2E Tests
|
|
id: run-tests
|
|
if: steps.test-state.outputs.should-run == 'true'
|
|
continue-on-error: true
|
|
uses: ./.github/actions/maestro-android
|
|
timeout-minutes: 90
|
|
with:
|
|
app-path: ./packages/rn-tester/android/app/build/outputs/apk/${{ matrix.flavor }}/app-arm64-v8a-${{ matrix.flavor }}.apk
|
|
app-id: com.facebook.react.uiapp
|
|
maestro-flow: ./packages/rn-tester/.maestro
|
|
flavor: ${{ matrix.flavor }}
|
|
emulator-api-level: '35'
|
|
emulator-target: google_apis
|
|
emulator-arch: x86_64
|
|
# These timing-sensitive flows remain covered by the release APK.
|
|
# Running the debug ARM64 APK through native translation can delay
|
|
# React commits long enough for Maestro to miss taps and assertions.
|
|
exclude-tags: ${{ matrix.flavor == 'debug' && 'android-release-only' || '' }}
|
|
- name: Store per-flow test state
|
|
if: always()
|
|
uses: ./.github/actions/upload-artifact
|
|
with:
|
|
name: e2e_android_rntester_state_${{ matrix.flavor }}_arm64-v8a_NewArch
|
|
overwrite: true
|
|
if-no-files-found: warn
|
|
path: /tmp/maestro-android-state/results.json
|
|
- name: Report status
|
|
id: report-status
|
|
if: ${{ always() && steps.run-tests.outcome == 'failure' }}
|
|
run: echo "status=failure" >> $GITHUB_OUTPUT
|
|
|
|
report:
|
|
needs: test
|
|
if: always()
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
status: ${{ steps.check.outputs.status }}
|
|
steps:
|
|
- id: check
|
|
run: |
|
|
if [[ "${{ needs.test.outputs.status }}" == "failure" ]]; then
|
|
echo "status=failure" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "status=success" >> $GITHUB_OUTPUT
|
|
fi
|
|
- name: Fail if needed
|
|
if: ${{ inputs.fail-on-error && steps.check.outputs.status == 'failure' }}
|
|
run: exit 1
|