-
Notifications
You must be signed in to change notification settings - Fork 5
ci: add e2e-staging workflow for nightly staging tests #1253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
piotr-iohk
wants to merge
2
commits into
master
Choose a base branch
from
cursor/e2e-staging-workflow-d3c9
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+257
−0
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,257 @@ | ||
| name: E2E Staging | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| e2e_branch: | ||
| description: "Branch of synonymdev/bitkit-e2e-tests to use (main | default-feature-branch | custom branch name)" | ||
| required: false | ||
| default: "default-feature-branch" | ||
| schedule: | ||
| - cron: "0 4 * * *" | ||
| pull_request: | ||
| types: [opened, synchronize, reopened, ready_for_review] | ||
|
|
||
| env: | ||
| TERM: xterm-256color | ||
| FORCE_COLOR: 1 | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build-staging: | ||
| if: github.event.pull_request.draft == false | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v7 | ||
|
|
||
| - name: Setup Java | ||
| uses: actions/setup-java@v6 | ||
| with: | ||
| java-version: "17" | ||
| distribution: "temurin" | ||
|
|
||
| - name: Setup Gradle | ||
| uses: gradle/actions/setup-gradle@v6 | ||
|
|
||
| - name: Decode google-services.json | ||
| run: | | ||
| set -euo pipefail | ||
| if [ -z "${GOOGLE_SERVICES_JSON_BASE64:-}" ]; then | ||
| echo "GOOGLE_SERVICES_JSON_BASE64 is empty; using checked-in placeholder." | ||
| exit 0 | ||
| fi | ||
| mkdir -p app/src/debug | ||
| printf '%s' "$GOOGLE_SERVICES_JSON_BASE64" | base64 -d > app/src/debug/google-services.json | ||
| env: | ||
| GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }} | ||
|
|
||
| - name: Build debug app (regtest) | ||
| env: | ||
| GITHUB_ACTOR: ${{ github.actor }} | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| CHATWOOT_API: ${{ secrets.CHATWOOT_API }} | ||
| E2E: true | ||
| E2E_BACKEND: network | ||
| GEO: false | ||
| TREZOR_BRIDGE: true | ||
| TREZOR_BRIDGE_URL: http://10.0.2.2:21325 | ||
| run: ./gradlew assembleDevDebug | ||
|
|
||
| - name: Rename APK | ||
| run: | | ||
| apk=$(find app/build/outputs/bitkit/devDebug -name 'bitkit-dev-debug-*-universal.apk') | ||
| mv "$apk" app/build/outputs/bitkit/devDebug/bitkit_e2e.apk | ||
|
|
||
| - name: Upload APK (regtest) | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: bitkit-e2e-apk-staging_${{ github.run_number }} | ||
| path: app/build/outputs/bitkit/devDebug/bitkit_e2e.apk | ||
|
|
||
| e2e-branch: | ||
| if: github.event.pull_request.draft == false | ||
| uses: synonymdev/bitkit-e2e-tests/.github/workflows/determine-e2e-branch.yml@main | ||
| with: | ||
| app_branch: ${{ github.head_ref || github.ref_name }} | ||
| e2e_branch_input: ${{ github.event.inputs.e2e_branch || 'default-feature-branch' }} | ||
|
|
||
| e2e-tests-staging: | ||
| if: github.event.pull_request.draft == false | ||
| runs-on: ubuntu-latest | ||
| needs: [build-staging, e2e-branch] | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| shard: | ||
| - { name: multi_address_2_regtest, grep: "@multi_address_2" } | ||
| - { name: pubky_paykit, grep: "@pubky" } | ||
| - { name: hardware_wallet, grep: "@hardware_wallet" } | ||
| - { name: transfer_staging, grep: "@transfer_1|@transfer_max" } | ||
|
|
||
| name: e2e-tests-staging - ${{ matrix.shard.name }} | ||
|
|
||
| steps: | ||
| - name: Show selected E2E branch | ||
| env: | ||
| E2E_BRANCH: ${{ needs.e2e-branch.outputs.branch }} | ||
| run: echo $E2E_BRANCH | ||
|
|
||
| - name: Clone E2E tests | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| repository: synonymdev/bitkit-e2e-tests | ||
| path: bitkit-e2e-tests | ||
| ref: ${{ needs.e2e-branch.outputs.branch }} | ||
|
|
||
| - name: Enable KVM | ||
| run: | | ||
| echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | ||
| sudo udevadm control --reload-rules | ||
| sudo udevadm trigger --name-match=kvm | ||
|
|
||
| - name: AVD cache | ||
| uses: actions/cache@v6 | ||
| id: avd-cache | ||
| with: | ||
| path: | | ||
| ~/.android/avd/* | ||
| ~/.android/adb* | ||
| key: avd-33-x86_64-pixel_6 | ||
|
|
||
| - name: Create AVD and generate snapshot for caching | ||
| if: steps.avd-cache.outputs.cache-hit != 'true' | ||
| uses: reactivecircus/android-emulator-runner@v2 | ||
| with: | ||
| profile: pixel_6 | ||
| api-level: 33 | ||
| arch: x86_64 | ||
| avd-name: Pixel_6 | ||
| force-avd-creation: false | ||
| emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-front none | ||
| disable-animations: false | ||
| script: echo "Generated AVD snapshot for caching." | ||
|
|
||
| - name: Download APK (regtest) | ||
| uses: actions/download-artifact@v8 | ||
| with: | ||
| name: bitkit-e2e-apk-staging_${{ github.run_number }} | ||
| path: bitkit-e2e-tests/aut | ||
|
|
||
| - name: List APK directory contents | ||
| run: ls -l bitkit-e2e-tests/aut | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v7 | ||
| with: | ||
| node-version: 22 | ||
|
|
||
| - name: Cache npm cache | ||
| uses: actions/cache@v6 | ||
| with: | ||
| path: ~/.npm | ||
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-node- | ||
|
|
||
| - name: Install dependencies | ||
| working-directory: bitkit-e2e-tests | ||
| run: npm ci | ||
|
|
||
| - name: Pull Trezor emulator image | ||
| if: matrix.shard.name == 'hardware_wallet' | ||
| working-directory: bitkit-e2e-tests | ||
| run: | | ||
| cd docker | ||
| docker compose --profile trezor pull --quiet trezor-user-env | ||
|
|
||
| - name: Run E2E Tests 1 (${{ matrix.shard.name }}) | ||
| continue-on-error: true | ||
| id: test1 | ||
| uses: reactivecircus/android-emulator-runner@v2 | ||
| with: | ||
| profile: pixel_6 | ||
| api-level: 33 | ||
| arch: x86_64 | ||
| avd-name: Pixel_6 | ||
| force-avd-creation: false | ||
| emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-front none | ||
| script: cd bitkit-e2e-tests && ./ci_run_android.sh --mochaOpts.grep "${{ matrix.shard.grep }}" | ||
| env: | ||
| BACKEND: regtest | ||
| RECORD_VIDEO: true | ||
| ATTEMPT: 1 | ||
|
|
||
| - name: Run E2E Tests 2 (${{ matrix.shard.name }}) | ||
| continue-on-error: true | ||
| id: test2 | ||
| if: steps.test1.outcome != 'success' | ||
| uses: reactivecircus/android-emulator-runner@v2 | ||
| with: | ||
| profile: pixel_6 | ||
| api-level: 33 | ||
| arch: x86_64 | ||
| avd-name: Pixel_6 | ||
| force-avd-creation: false | ||
| emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-front none | ||
| script: cd bitkit-e2e-tests && ./ci_run_android.sh --mochaOpts.grep "${{ matrix.shard.grep }}" | ||
| env: | ||
| BACKEND: regtest | ||
| RECORD_VIDEO: true | ||
| ATTEMPT: 2 | ||
|
|
||
| - name: Run E2E Tests 3 (${{ matrix.shard.name }}) | ||
| id: test3 | ||
| if: steps.test1.outcome != 'success' && steps.test2.outcome != 'success' | ||
| uses: reactivecircus/android-emulator-runner@v2 | ||
| with: | ||
| profile: pixel_6 | ||
| api-level: 33 | ||
| arch: x86_64 | ||
| avd-name: Pixel_6 | ||
| force-avd-creation: false | ||
| emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-front none | ||
| script: cd bitkit-e2e-tests && ./ci_run_android.sh --mochaOpts.grep "${{ matrix.shard.grep }}" | ||
| env: | ||
| BACKEND: regtest | ||
| RECORD_VIDEO: true | ||
| ATTEMPT: 3 | ||
|
|
||
| - name: Upload E2E Artifacts (${{ matrix.shard.name }}) | ||
| if: failure() | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: e2e-artifacts-staging_${{ matrix.shard.name }}_${{ github.run_number }} | ||
| path: bitkit-e2e-tests/artifacts/ | ||
|
|
||
| - name: Dump docker logs on failure (${{ matrix.shard.name }}) | ||
| if: failure() | ||
| uses: jwalton/gh-docker-logs@v2 | ||
|
|
||
| notify-failure: | ||
| if: >- | ||
| always() && | ||
| github.event_name != 'pull_request' && | ||
| (needs.build-staging.result == 'failure' || | ||
| needs.e2e-branch.result == 'failure' || | ||
| needs.e2e-tests-staging.result == 'failure') | ||
| needs: [build-staging, e2e-branch, e2e-tests-staging] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Notify Slack on failure | ||
| uses: slackapi/slack-github-action@e598089eaef53883a2d9b325e044899548518a03 | ||
| with: | ||
| webhook: ${{ secrets.SLACK_WEBHOOK_URL_STAGING }} | ||
| webhook-type: incoming-webhook | ||
| payload: | | ||
| text: "❌ E2E Staging nightly failed" | ||
| blocks: | ||
| - type: "section" | ||
| text: | ||
| type: "mrkdwn" | ||
| text: "❌ *E2E Staging nightly failed*\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View workflow run>" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This unrestricted trigger runs the new workflow on every future pull request. Because
e2e.ymlstill runs the same multi-address, Pubky, and hardware-wallet shards, each PR will launch those expensive emulator jobs twice. Remove or explicitly scope this trigger if it was only intended to self-test this PR.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intentional for PR A per bitkit-e2e-tests#221. This PR self-tests the real staging matrix; the double-run with
e2e.ymlis expected.PR B will add skip-success logic to
e2e.ymlso staging shards there become no-ops onrelease-*branches, eliminating the duplication for normal PRs while keeping full coverage in this dedicated workflow.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood. Given issue #221, running the full staging matrix on this PR is intentional, and PR B will remove the duplicate work for normal PRs by making the corresponding
e2e.ymlshards no-ops onrelease-*branches. No change is needed here.Tip: You can customize Greptile's behavior for this repo with
.greptile/rules.mdand.greptile/config.json.