Skip to content

Experiment smoke tests for android-tou-experience-0-experiment #300

Experiment smoke tests for android-tou-experience-0-experiment

Experiment smoke tests for android-tou-experience-0-experiment #300

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: "['126.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
experiment-server:
description: 'The server that the experiment exists on (stage/prod)'
default: 'prod'
required: true
type: choice
options:
- stage
- stage/preview
- prod
extra-arguments:
description: 'Additional testing arguments'
default: ''
required: false
type: string
run-name: Experiment ${{ inputs.feature-name }} tests for ${{ inputs.slug }}
jobs:
android-klaatu-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
firefox: ${{ fromJSON(inputs.firefox-version) }}
branch: ${{ fromJSON(inputs.branch) }}
api-level: [34]
name: ${{ inputs.feature-name }} tests for ${{ inputs.slug }} on firefox android ${{ matrix.firefox }} branch ${{ matrix.branch }}
steps:
- name: Set FF Version for downloader
id: ff-version
run: |
version=${{ matrix.firefox }}
major_version=$(echo $version | cut -d'.' -f1)
echo "FF_VERSION=$major_version" >> "$GITHUB_OUTPUT"
- name: Checkout klaatu repo
uses: actions/checkout@v4
with:
path: klaatu
- name: Clone mozilla central
uses: actions/checkout@v4
with:
sparse-checkout: mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix
repository: mozilla-firefox/firefox
path: firefox
- 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: '17'
- name: Enable KVM group perms
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: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}
- 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: Fetch Fenix APKs from CircleCI
env:
CIRCLECI_TOKEN: ${{ secrets.CIRCLECI_TOKEN }}
CIRCLECI_BRANCH: update_firefox_versions
CIRCLECI_OUTPUT_DIR: .
CIRCLECI_JOB_NAME: Build\ Fenix\ APKs
working-directory: klaatu
run: ./utilities/fetch_circleci_apks.sh
- name: Setup Emulator and run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: google_apis
arch: x86_64
profile: pixel_3a
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -noaudio -no-boot-anim -camera-back none
disable-animations: true
cores: 4
ram-size: 4096M
script: 'SLUG="${{ inputs.slug }}" BRANCH="${{ matrix.branch }}" EXPERIMENT_SERVER="${{ inputs.experiment-server }}" FEATURE_NAME="${{ inputs.feature-name }}" FIREFOX_VERSION="${{ matrix.firefox }}" EXTRA_ARGUMENTS="${{ inputs.extra-arguments }}" ./klaatu/utilities/start_android_klaatu_tests.sh'
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: ${{ inputs.slug }} HTML Test Report on firefox v${{ matrix.firefox }} branch ${{ matrix.branch }}
path: /home/runner/work/klaatu/klaatu/firefox/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/experimentintegration/results/index.html