268 lines
10 KiB
YAML
268 lines
10 KiB
YAML
---
|
|
name: Nightly Maestro E2E
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "0 4 * * *"
|
|
workflow_dispatch:
|
|
# Temporary: allows this stacked PR to exercise the workflow before merge.
|
|
# Remove before merging.
|
|
pull_request:
|
|
branches:
|
|
- samuel/split-build-pipelines
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: nightly-maestro-e2e-${{ github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
env:
|
|
CI: "1"
|
|
MAESTRO_VERSION: "2.6.1"
|
|
MAESTRO_DRIVER_STARTUP_TIMEOUT: "180000"
|
|
MAESTRO_CLI_NO_ANALYTICS: "1"
|
|
MAESTRO_CLI_ANALYSIS_NOTIFICATION_DISABLED: "true"
|
|
MAESTRO_DISABLE_UPDATE_CHECK: "1"
|
|
|
|
jobs:
|
|
ios:
|
|
name: iOS Maestro E2E
|
|
if: github.repository == 'bluesky-social/social-app'
|
|
runs-on: macos-26-xlarge
|
|
timeout-minutes: 120
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Select Xcode 26.4
|
|
uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1.7.0
|
|
with:
|
|
xcode-version: "26.4"
|
|
|
|
- name: Set up pnpm
|
|
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
|
with:
|
|
node-version-file: package.json
|
|
cache: pnpm
|
|
|
|
- name: Set up Java 17
|
|
uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.4.0
|
|
with:
|
|
distribution: temurin
|
|
java-version: "17"
|
|
|
|
- name: Prepare E2E configuration
|
|
run: |
|
|
mkdir -p artifacts/ios
|
|
echo "Installing dependencies" > artifacts/ios/phase.txt
|
|
cp .env.example .env.test
|
|
cp google-services.json.example google-services.json
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
set -o pipefail
|
|
pnpm install --frozen-lockfile 2>&1 | tee artifacts/ios/dependencies.log
|
|
pnpm --dir dev-env install --frozen-lockfile 2>&1 | tee -a artifacts/ios/dependencies.log
|
|
pnpm intl:build 2>&1 | tee artifacts/ios/i18n.log
|
|
|
|
- name: Install Maestro 2.6.1
|
|
run: |
|
|
echo "Installing Maestro" > artifacts/ios/phase.txt
|
|
curl -fsSL -o "$RUNNER_TEMP/maestro.zip" \
|
|
"https://github.com/mobile-dev-inc/Maestro/releases/download/cli-${MAESTRO_VERSION}/maestro.zip"
|
|
echo "3440825f514f537c6a96bcf5de995780c2a4a7f83a43208fdc95d4f1fecfad3b $RUNNER_TEMP/maestro.zip" \
|
|
| shasum -a 256 --check
|
|
unzip -q "$RUNNER_TEMP/maestro.zip" -d "$RUNNER_TEMP"
|
|
echo "$RUNNER_TEMP/maestro/bin" >> "$GITHUB_PATH"
|
|
"$RUNNER_TEMP/maestro/bin/maestro" --version | tee artifacts/ios/maestro-version.log
|
|
test "$("$RUNNER_TEMP/maestro/bin/maestro" --version)" = "$MAESTRO_VERSION"
|
|
|
|
- name: Boot one iOS simulator
|
|
run: |
|
|
echo "Booting iOS simulator" > artifacts/ios/phase.txt
|
|
udid=$(xcrun simctl list devices available --json | jq -r \
|
|
'[.devices[][] | select(.name | startswith("iPhone"))] | first | .udid')
|
|
if [ -z "$udid" ] || [ "$udid" = "null" ]; then
|
|
echo "No available iPhone simulator was found" >&2
|
|
exit 1
|
|
fi
|
|
echo "IOS_UDID=$udid" >> "$GITHUB_ENV"
|
|
xcrun simctl shutdown all || true
|
|
xcrun simctl boot "$udid"
|
|
xcrun simctl bootstatus "$udid" -b
|
|
echo "Using iOS simulator $udid"
|
|
|
|
- name: Run iOS Maestro suite
|
|
run: .github/scripts/run-nightly-e2e.sh ios "$IOS_UDID"
|
|
|
|
- name: Clean up iOS services and simulator
|
|
if: always()
|
|
run: .github/scripts/cleanup-nightly-e2e.sh ios "${IOS_UDID:-}"
|
|
|
|
- name: Upload iOS E2E artifacts
|
|
if: always()
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: nightly-e2e-ios-${{ github.run_id }}
|
|
path: artifacts/ios
|
|
if-no-files-found: warn
|
|
retention-days: 14
|
|
|
|
android:
|
|
name: Android Maestro E2E
|
|
if: github.repository == 'bluesky-social/social-app'
|
|
# Linux-x64-32core is a repository-managed runner label.
|
|
runs-on: Linux-x64-32core
|
|
timeout-minutes: 120
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Set up pnpm
|
|
uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
|
with:
|
|
node-version-file: package.json
|
|
cache: pnpm
|
|
|
|
- name: Set up Java 17
|
|
uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.4.0
|
|
with:
|
|
distribution: temurin
|
|
java-version: "17"
|
|
|
|
- name: Prepare E2E configuration
|
|
run: |
|
|
mkdir -p artifacts/android
|
|
echo "Installing dependencies" > artifacts/android/phase.txt
|
|
cp .env.example .env.test
|
|
cp google-services.json.example google-services.json
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
set -o pipefail
|
|
pnpm install --frozen-lockfile 2>&1 | tee artifacts/android/dependencies.log
|
|
pnpm --dir dev-env install --frozen-lockfile 2>&1 | tee -a artifacts/android/dependencies.log
|
|
pnpm intl:build 2>&1 | tee artifacts/android/i18n.log
|
|
|
|
- name: Install Maestro 2.6.1
|
|
run: |
|
|
echo "Installing Maestro" > artifacts/android/phase.txt
|
|
curl -fsSL -o "$RUNNER_TEMP/maestro.zip" \
|
|
"https://github.com/mobile-dev-inc/Maestro/releases/download/cli-${MAESTRO_VERSION}/maestro.zip"
|
|
echo "3440825f514f537c6a96bcf5de995780c2a4a7f83a43208fdc95d4f1fecfad3b $RUNNER_TEMP/maestro.zip" \
|
|
| shasum -a 256 --check
|
|
unzip -q "$RUNNER_TEMP/maestro.zip" -d "$RUNNER_TEMP"
|
|
echo "$RUNNER_TEMP/maestro/bin" >> "$GITHUB_PATH"
|
|
"$RUNNER_TEMP/maestro/bin/maestro" --version | tee artifacts/android/maestro-version.log
|
|
test "$("$RUNNER_TEMP/maestro/bin/maestro" --version)" = "$MAESTRO_VERSION"
|
|
|
|
- name: Boot one Android emulator and run Maestro suite
|
|
uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # v2.34.0
|
|
with:
|
|
api-level: 35
|
|
target: google_apis
|
|
arch: x86_64
|
|
profile: pixel_6
|
|
avd-name: nightly-e2e
|
|
emulator-port: 5554
|
|
disable-animations: true
|
|
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none
|
|
script: .github/scripts/run-nightly-e2e.sh android emulator-5554
|
|
|
|
- name: Clean up Android services and emulator
|
|
if: always()
|
|
run: .github/scripts/cleanup-nightly-e2e.sh android emulator-5554
|
|
|
|
- name: Upload Android E2E artifacts
|
|
if: always()
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: nightly-e2e-android-${{ github.run_id }}
|
|
path: artifacts/android
|
|
if-no-files-found: warn
|
|
retention-days: 14
|
|
|
|
report:
|
|
name: Report E2E failures
|
|
needs: [ios, android]
|
|
if: ${{ always() && github.repository == 'bluesky-social/social-app' }}
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
actions: read
|
|
contents: read
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Download iOS artifacts
|
|
continue-on-error: true
|
|
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
with:
|
|
name: nightly-e2e-ios-${{ github.run_id }}
|
|
path: downloaded-artifacts/ios
|
|
|
|
- name: Download Android artifacts
|
|
continue-on-error: true
|
|
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
with:
|
|
name: nightly-e2e-android-${{ github.run_id }}
|
|
path: downloaded-artifacts/android
|
|
|
|
- name: Resolve artifact links
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
run_url="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}#artifacts"
|
|
jq -n --arg run "$run_url" '{ios: $run, android: $run}' > artifact-links.json
|
|
if gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/artifacts?per_page=100" \
|
|
> artifact-response.json; then
|
|
jq --arg base "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/artifacts" \
|
|
--arg run "$run_url" \
|
|
'{
|
|
ios: (.artifacts | map(select(.name | startswith("nightly-e2e-ios-"))) | first | if . then ($base + "/" + (.id | tostring)) else $run end),
|
|
android: (.artifacts | map(select(.name | startswith("nightly-e2e-android-"))) | first | if . then ($base + "/" + (.id | tostring)) else $run end)
|
|
}' artifact-response.json > artifact-links.json
|
|
fi
|
|
|
|
- name: Summarize platform results
|
|
id: summary
|
|
env:
|
|
IOS_STATUS: ${{ needs.ios.result }}
|
|
ANDROID_STATUS: ${{ needs.android.result }}
|
|
run: |
|
|
node .github/scripts/summarize-maestro.mjs \
|
|
--ios-status "$IOS_STATUS" \
|
|
--android-status "$ANDROID_STATUS" \
|
|
--ios-root downloaded-artifacts/ios \
|
|
--android-root downloaded-artifacts/android \
|
|
--artifact-urls artifact-links.json \
|
|
--sha "$GITHUB_SHA" \
|
|
--run-url "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" \
|
|
--commit-url "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}" \
|
|
> e2e-summary.json
|
|
echo "notify=$(jq -r .notify e2e-summary.json)" >> "$GITHUB_OUTPUT"
|
|
echo "payload=$(jq -c .payload e2e-summary.json)" >> "$GITHUB_OUTPUT"
|
|
jq -r .payload.text e2e-summary.json >> "$GITHUB_STEP_SUMMARY"
|
|
|
|
- name: Notify Slack of E2E failures
|
|
if: steps.summary.outputs.notify == 'true'
|
|
uses: slackapi/slack-github-action@45a88b9581bfab2566dc881e2cd66d334e621e2c # v3.0.3
|
|
with:
|
|
webhook: ${{ secrets.E2E_FAILURES_SLACK_WEBHOOK }}
|
|
webhook-type: incoming-webhook
|
|
payload: ${{ steps.summary.outputs.payload }}
|