Android Klaatu Tests #5
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: Android Klaatu Tests | |
on: | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'Experiment Branch' | |
default: 'control' | |
required: true | |
type: string | |
slug: | |
description: 'Experiment Slug' | |
default: 'an-awesome-experiment' | |
required: true | |
type: string | |
firefox-version: | |
description: 'The Firefox Version(s) you want to test' | |
default: "['latest-beta', 'latest', '123.0']" | |
required: false | |
type: string | |
feature-name: | |
description: 'The Feature you want to test' | |
default: 'smoke' | |
required: true | |
type: choice | |
options: | |
- smoke | |
- messaging_survey | |
- messaging_homescreen | |
extra-arguments: | |
description: 'Additional testing arguments' | |
default: '' | |
required: false | |
type: string | |
jobs: | |
android-klaatu-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
firefox: ${{ fromJSON(inputs.firefox-version) }} | |
name: ${{ inputs.feature-name }} tests for ${{ inputs.slug }} on firefox android ${{ matrix.firefox }} | |
steps: | |
- name: Clone android branch | |
run: | | |
firefox_version=$(echo "${{ matrix.firefox }}" | tr '.' '_') | |
curl -sSL https://hg.mozilla.org/releases/mozilla-release/archive/FIREFOX-ANDROID_${firefox_version}_BUILD1.zip -o firefox-android.zip | |
- name: Setup files | |
run: | | |
unzip -q -o firefox-android.zip -d firefox-android | |
ls -l | |
pwd | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Setup JDK | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' | |
java-version: '11' | |
- name: Cache Gradle dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ~/.gradle/caches | |
key: firefox-${{ matrix.firefox }}-gradle-${{ hashFiles('**/*.gradle*', '**/*.kts') }} | |
restore-keys: | | |
firefox-${{ matrix.firefox }}-gradle- | |
- name: Setup build | |
run: | | |
cd firefox-android/mobile/android/fenix | |
cp app/src/androidTest/java/org/mozilla/fenix/experimentintegration/local.properties ./ | |
- name: Start emulator | |
run: | | |
echo no | android create avd --force -n test -k "system-images;android-34;google_apis;x86" --device "Pixel 3a" | |
emulator -avd test -no-audio -no-window -gpu swiftshader -no-snapshot -no-accel & | |
- name: Wait for emulator to start | |
run: | | |
android-wait-for-emulator | |
adb devices | |
- name: Build Test files | |
run: | | |
cd firefox-android/mobile/android/fenix | |
./gradlew clean app:assembleFenixDebugAndroidTest | |
adb install app/build/outputs/apk/androidTest/fenix/debug/app-fenix-debug-androidTest.apk | |
- name: Build Fenix App | |
run: | | |
cd firefox-android/mobile/android/fenix | |
adb uninstall org.mozilla.fenix.debug | |
./gradlew clean app:assembleFenixDebug | |
adb install app/build/outputs/apk/fenix/debug/app-fenix-x86_64-debug.apk | |
- name: Install Nimbus CLI | |
run: curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/mozilla/application-services/main/install-nimbus-cli.sh | bash | |
- name: Run Tests | |
run: | | |
cd firefox-android/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/experimentintegration | |
pip3 install virtualenv poetry | |
poetry install | |
poetry run python generate_smoke_tests.py | |
poetry run pytest --experiment ${{ inputs.slug }} --experiment-branch ${{ inputs.branch }} --experiment-feature ${{ inputs.feature-name }} ${{ inputs.extra-arguments }} | |
- name: HTML Test Report | |
if: ${{ always() }} | |
run: zip -r results.zip ~/gecko-dev/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/experimentintegration/results/index.html |