Repository navigation
chore(ci): Run UI tests on local emulator instead of SauceLabs #5639
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
Closed
Closed
Changes from all commits
Commits
Show all changes
3 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 |
|---|---|---|
|
|
@@ -13,11 +13,7 @@ jobs: | |
| test: | ||
| name: Ui tests | ||
| runs-on: ubuntu-latest | ||
|
|
||
| # we copy the secret to the env variable in order to access it in the workflow | ||
| env: | ||
| SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} | ||
| SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} | ||
| timeout-minutes: 30 | ||
|
|
||
| steps: | ||
| - name: Git checkout | ||
|
|
@@ -32,62 +28,45 @@ jobs: | |
| - name: Setup Gradle | ||
| uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1 | ||
|
|
||
| # Clean, build and release a test apk, but only if we will run the benchmark | ||
| - name: Make assembleUiTests | ||
| if: env.SAUCE_USERNAME != null | ||
| run: make assembleUiTests | ||
|
|
||
| - name: Install SauceLabs CLI | ||
| uses: saucelabs/saucectl-run-action@283660aa934c02723c497efa151d582a3acc5801 # [email protected] | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| with: | ||
| skip-run: true | ||
| if: env.SAUCE_USERNAME != null | ||
|
|
||
| - name: Run Tests | ||
| id: saucelabs | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| run: | | ||
| exec &> >(tee -a "test_logs.txt") | ||
| saucectl run -c .sauce/sentry-uitest-android-ui.yml | ||
| if: env.SAUCE_USERNAME != null | ||
| continue-on-error: true | ||
|
|
||
| - name: Verify Test Results | ||
| - name: Enable KVM | ||
| run: | | ||
| processCrashed=$(cat test_logs.txt | grep "Instrumentation run failed due to 'Process crashed.'" | wc -l) | ||
| if [[ ${{ steps.saucelabs.outcome }} == 'success' ]]; then | ||
| exit 0 | ||
| elif [[ "$processCrashed" -ne 0 ]]; then | ||
| exit 0 | ||
| else | ||
| exit 1 | ||
| fi | ||
| if: env.SAUCE_USERNAME != null | ||
| 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@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | ||
| id: avd-cache | ||
| with: | ||
| path: | | ||
| ~/.android/avd/* | ||
| ~/.android/adb* | ||
| key: avd-api-35-x86_64-google_apis | ||
|
|
||
| - name: Install Sentry CLI | ||
| if: ${{ !cancelled() && env.SAUCE_USERNAME != null }} | ||
| uses: getsentry/action-setup-cli@70d7e587b84c2e78cf4d37cd33d7b74fb3729c1b # v1 | ||
| - name: Create AVD and generate snapshot for caching | ||
| if: steps.avd-cache.outputs.cache-hit != 'true' | ||
| uses: reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d # pin@v2 | ||
| with: | ||
| api-level: 35 | ||
| target: google_apis | ||
| channel: canary | ||
| arch: x86_64 | ||
| force-avd-creation: false | ||
| disable-animations: true | ||
| disable-spellchecker: true | ||
| emulator-options: -memory 4096 -no-window -gpu auto -noaudio -no-boot-anim -camera-back none | ||
| disk-size: 4096M | ||
| script: echo "Generated AVD snapshot for caching." | ||
|
|
||
| - name: Upload Replay Snapshots to Sentry | ||
| # Skip on PRs from forks, which don't have access to the upload secret | ||
| if: ${{ !cancelled() && env.SAUCE_USERNAME != null && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }} | ||
| run: | | ||
| # find instead of `shopt -s globstar`, which macOS's bash 3.2 doesn't support | ||
| mkdir -p replay-snapshots | ||
| if [ -d artifacts ]; then | ||
| find artifacts -type f -name '*.png' -exec cp {} replay-snapshots/ \; | ||
| fi | ||
| if [ -n "$(ls -A replay-snapshots)" ]; then | ||
| sentry-cli snapshots upload ./replay-snapshots \ | ||
| --app-id sentry-android-replay | ||
| else | ||
| echo "No replay snapshot files found, skipping upload" | ||
| fi | ||
| env: | ||
| SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | ||
| SENTRY_ORG: sentry-sdks | ||
| SENTRY_PROJECT: sentry-android | ||
| - name: Run tests | ||
| uses: reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d # pin@v2 | ||
| with: | ||
| api-level: 35 | ||
| target: google_apis | ||
| channel: canary | ||
| arch: x86_64 | ||
| force-avd-creation: false | ||
| disable-animations: true | ||
| disable-spellchecker: true | ||
| emulator-options: -memory 4096 -no-window -gpu auto -noaudio -no-boot-anim -camera-back none -no-snapshot-save | ||
| script: ./gradlew :sentry-android-integration-tests:sentry-uitest-android:connectedReleaseAndroidTest -Denvironment=github | ||
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.
Uh oh!
There was an error while loading. Please reload this page.