Performance measures for Android #44
This file contains 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: Performance measures for Android | |
on: | |
workflow_dispatch: | |
inputs: | |
test_iterations: | |
description: 'How many test iterations to run' | |
required: true | |
default: 1 | |
max_retries: | |
description: 'Max retries if there is any test errors' | |
required: true | |
default: 1 | |
api_level: | |
description: 'Define API level' | |
required: true | |
default: 29 | |
branch: | |
description: 'Define branch to test' | |
required: true | |
default: 'master' | |
schedule: | |
- cron: '0 7 * * *' | |
jobs: | |
run_tests: | |
name: Performance measures for Android | |
runs-on: macos-latest | |
environment: atb | |
timeout-minutes: 90 | |
steps: | |
- name: Set env variables | |
env: | |
DEFAULT_BRANCH: 'master' | |
DEFAULT_API_LEVEL: 29 | |
DEFAULT_TEST_ITERATIONS: 1 | |
DEFAULT_MAX_RETRIES: 1 | |
run: | | |
echo "INPUT_BRANCH=${{ github.event.inputs.branch || env.DEFAULT_BRANCH }}" >> $GITHUB_ENV | |
echo "INPUT_API_LEVEL=${{ github.event.inputs.api_level || env.DEFAULT_API_LEVEL }}" >> $GITHUB_ENV | |
echo "INPUT_TEST_ITERATIONS=${{ github.event.inputs.test_iterations || env.DEFAULT_TEST_ITERATIONS }}" >> $GITHUB_ENV | |
echo "INPUT_MAX_RETRIES=${{ github.event.inputs.max_retries || env.DEFAULT_MAX_RETRIES }}" >> $GITHUB_ENV | |
echo "JAVA_HOME=$JAVA_HOME_11_X64" >> $GITHUB_ENV | |
- name: Checkout project | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ env.INPUT_BRANCH }} | |
# Download APK | |
- name: Get AppCenter APK | |
run: bash ./scripts/get-appcenter-apk.sh | |
working-directory: e2e | |
env: | |
APPCENTER_APP_SECRET: ${{ secrets.APPCENTER_ANDROID_APP_SECRET }} | |
APPCENTER_USER_API_TOKEN: ${{ secrets.APPCENTER_USER_API_TOKEN }} | |
# E2E init | |
- name: Install Flashlight | |
run: sh ./scripts/install-flashlight.sh | |
working-directory: e2e | |
- name: Install Appium | |
run: npm install -g appium | |
- name: Install uiautomator2 driver | |
run: appium driver install uiautomator2 | |
- name: Add Entur private registry credentials | |
run: bash ./scripts/add-entur-private-registry.sh | |
env: | |
ENTUR_REGISTRY_USER: ${{ secrets.ENTUR_REGISTRY_USER }} | |
ENTUR_REGISTRY_TOKEN: ${{ secrets.ENTUR_REGISTRY_TOKEN }} | |
- name: Install E2E tests | |
run: yarn install | |
- name: tsc | |
run: ./node_modules/typescript/bin/tsc --noEmit --noErrorTruncation --pretty false --incremental false --project e2e | |
# E2E run | |
- name: Run tests on Android emulator | |
uses: reactivecircus/[email protected] | |
with: | |
avd-name: emulator-api${{ env.INPUT_API_LEVEL }} | |
api-level: ${{ env.INPUT_API_LEVEL }} | |
arch: x86_64 | |
profile: pixel_5 | |
emulator-build: 9536276 | |
emulator-boot-timeout: 900 | |
disable-spellchecker: true | |
script: /Users/runner/.flashlight/bin/flashlight test --bundleId no.mittatb.staging --testCommand "yarn test:android --spec e2e/test/flashlight/performanceMeasures.e2e.ts" --resultsTitle performance_measures --iterationCount ${{ env.INPUT_TEST_ITERATIONS }} --maxRetries ${{ env.INPUT_MAX_RETRIES }} | |
pre-emulator-launch-script: ./e2e/scripts/restart-adb.sh | |
env: | |
APP_PATH: ${{ github.workspace }} | |
IS_CI: "true" | |
# Results | |
- name: Upload performance reports | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: performance_measures | |
path: | | |
./performance_measures_*.json | |
retention-days: 1 | |
- name: Upload screenshots | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-screenshots | |
path: ./e2e/screenshots/*.png | |
retention-days: 1 |