Selectel UI #5
Workflow file for this run
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
| name: Selectel UI | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| devices: | |
| description: Fixed device set | |
| type: choice | |
| options: [single, all] | |
| default: single | |
| required: true | |
| permissions: | |
| contents: read | |
| # Manual runs on the same branch wait for cleanup instead of cancelling a paid session. | |
| concurrency: | |
| group: selectel-ui-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 35 | |
| env: | |
| FASTLANE_SKIP_DOCS: "1" | |
| DEVICE_PROFILE: ${{ inputs.devices }} | |
| outputs: | |
| devices: ${{ steps.matrix.outputs.devices }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: "21" | |
| cache: gradle | |
| - uses: actions/setup-go@v7 | |
| with: | |
| go-version-file: native/go.mod | |
| cache-dependency-path: native/go.sum | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.4.10" | |
| bundler-cache: true | |
| - name: Install Android SDK components | |
| run: | | |
| sdkmanager="$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" | |
| yes | "$sdkmanager" --licenses >/dev/null || true | |
| "$sdkmanager" "platforms;android-36" "build-tools;36.0.0" "ndk;29.0.14206865" | |
| echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/29.0.14206865" >> "$GITHUB_ENV" | |
| - name: Read fixed device matrix | |
| id: matrix | |
| run: echo "devices=$(python3 scripts/selectel_ui.py matrix --profile "$DEVICE_PROFILE")" >> "$GITHUB_OUTPUT" | |
| - name: Build application and UI test APKs before renting | |
| run: bundle exec fastlane android ui_test_artifacts profile:"$DEVICE_PROFILE" | |
| - uses: actions/upload-artifact@v7 | |
| id: apks | |
| with: | |
| name: selectel-apks-${{ github.run_id }}-${{ github.run_attempt }} | |
| path: | | |
| app/build/outputs/apk/debug/*.apk | |
| app/build/outputs/apk/androidTest/debug/*.apk | |
| if-no-files-found: error | |
| retention-days: 3 | |
| - name: Publish APK link | |
| env: | |
| APK_URL: ${{ steps.apks.outputs.artifact-url }} | |
| run: echo "[Debug application and UI test APKs]($APK_URL)" >> "$GITHUB_STEP_SUMMARY" | |
| ui-tests: | |
| needs: build | |
| name: UI · ${{ matrix.model }} · API ${{ matrix.api }} · ${{ matrix.abi }} | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 2 | |
| matrix: ${{ fromJSON(needs.build.outputs.devices) }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 25 | |
| env: | |
| FASTLANE_SKIP_DOCS: "1" | |
| SELECTEL_DEVICE_MODEL: ${{ matrix.model }} | |
| SELECTEL_DEVICE_MANUFACTURER: ${{ matrix.manufacturer }} | |
| SELECTEL_ANDROID_API: ${{ matrix.api }} | |
| SELECTEL_DEVICE_ABI: ${{ matrix.abi }} | |
| SELECTEL_RESULT_ID: ${{ matrix.id }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.4.10" | |
| bundler-cache: true | |
| - name: Add ADB to PATH | |
| run: echo "$ANDROID_HOME/platform-tools" >> "$GITHUB_PATH" | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: selectel-apks-${{ github.run_id }}-${{ github.run_attempt }} | |
| path: app/build/outputs/apk | |
| - name: Acquire Selectel device | |
| env: | |
| SELECTEL_USERNAME: ${{ secrets.SELECTEL_USERNAME }} | |
| SELECTEL_PASSWORD: ${{ secrets.SELECTEL_PASSWORD }} | |
| SELECTEL_ACCOUNT_ID: ${{ secrets.SELECTEL_ACCOUNT_ID }} | |
| SELECTEL_PROJECT_ID: ${{ secrets.SELECTEL_PROJECT_ID }} | |
| run: bundle exec fastlane android selectel_acquire | |
| - name: Persist lease journal for recovery (no credentials) | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: selectel-lease-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.id }} | |
| path: .selectel/lease.json | |
| include-hidden-files: true | |
| if-no-files-found: ignore | |
| retention-days: 14 | |
| - name: Run device UI tests | |
| run: bundle exec fastlane android selectel_run | |
| - name: Release paid device lease | |
| if: always() | |
| env: | |
| SELECTEL_USERNAME: ${{ secrets.SELECTEL_USERNAME }} | |
| SELECTEL_PASSWORD: ${{ secrets.SELECTEL_PASSWORD }} | |
| SELECTEL_ACCOUNT_ID: ${{ secrets.SELECTEL_ACCOUNT_ID }} | |
| SELECTEL_PROJECT_ID: ${{ secrets.SELECTEL_PROJECT_ID }} | |
| run: bundle exec fastlane android selectel_release | |
| - name: Upload UI reports | |
| if: always() | |
| id: reports | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: selectel-ui-results-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.id }} | |
| path: app/build/reports/selectel/ | |
| if-no-files-found: ignore | |
| retention-days: 14 | |
| - name: Publish report link | |
| if: always() | |
| env: | |
| REPORT_URL: ${{ steps.reports.outputs.artifact-url }} | |
| run: | | |
| if [[ -n "$REPORT_URL" ]]; then | |
| echo "[Selectel UI reports and screenshots]($REPORT_URL)" >> "$GITHUB_STEP_SUMMARY" | |
| fi | |
| required: | |
| name: Selectel UI required | |
| if: always() | |
| needs: [build, ui-tests] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Require successful build and every selected device | |
| env: | |
| BUILD_RESULT: ${{ needs.build.result }} | |
| UI_RESULT: ${{ needs.ui-tests.result }} | |
| run: test "$BUILD_RESULT" = success && test "$UI_RESULT" = success |