Performance measures for Android #128
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: 30 | |
branch: | |
description: 'Define branch to test' | |
required: true | |
default: 'master' | |
schedule: | |
- cron: '0 7 * * *' | |
jobs: | |
run_tests: | |
name: Performance measures for Android | |
runs-on: ubuntu-latest | |
environment: atb | |
timeout-minutes: 90 | |
steps: | |
- name: Set env variables | |
env: | |
DEFAULT_BRANCH: 'master' | |
DEFAULT_API_LEVEL: 30 | |
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: 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: Install Flashlight | |
#run: sh ./scripts/install-flashlight.sh | |
run: curl https://get.flashlight.dev | bash | |
#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 | |
working-directory: e2e | |
- name: tsc | |
working-directory: e2e | |
run: ./node_modules/typescript/bin/tsc --noEmit --noErrorTruncation --pretty false --incremental false | |
# E2E run | |
- name: Run tests on Android emulator | |
uses: reactivecircus/android-emulator-runner@v2 | |
continue-on-error: true | |
with: | |
avd-name: emulator-api${{ env.INPUT_API_LEVEL }} | |
api-level: ${{ env.INPUT_API_LEVEL }} | |
arch: x86_64 | |
profile: pixel_5 | |
emulator-build: 11237101 | |
emulator-boot-timeout: 900 | |
disable-spellchecker: true | |
script: /home/runner/.flashlight/bin/flashlight test --bundleId no.mittatb.staging --testCommand "yarn test:android --spec 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 | |
working-directory: e2e | |
env: | |
APP_PATH: ${{ github.workspace }} | |
IS_CI: "true" | |
# Results | |
- name: Check for performance report | |
run: | | |
if [ ! -f ./e2e/performance_measures_*.json ]; | |
then | |
exit 1 | |
fi | |
- name: Upload performance reports | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: performance_measures | |
path: | | |
./e2e/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 |