Skip to content

Instantly share code, notes, and snippets.

@testableapple
Last active December 1, 2024 13:01
Show Gist options
  • Save testableapple/7c5338009c8430fea2ee4d041c2b00df to your computer and use it in GitHub Desktop.
Save testableapple/7c5338009c8430fea2ee4d041c2b00df to your computer and use it in GitHub Desktop.
Optimizing Android Test Runs: Parsing Test Names and Implementing Parallelization
name: CI
on:
push:
jobs:
build:
name: Build
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4.2.2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
bundler-cache: true
- uses: actions/setup-java@v4
with:
distribution: adopt
java-version: 17
- name: Enable KVM group permissions
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
- run: bundle exec fastlane build
- uses: actions/upload-artifact@v4.4.3
with:
name: apks
path: |
./**/path/to/app.apk
./**/path/to/test.apk
test:
name: Test
runs-on: ubuntu-24.04
needs: build
strategy:
matrix:
include:
- batch_number: 0
- batch_number: 1
- batch_number: 2
steps:
- uses: actions/checkout@v4.2.2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
bundler-cache: true
- uses: actions/setup-java@v4
with:
distribution: adopt
java-version: 17
- uses: actions/download-artifact@v4.1.8
with:
name: apks
- name: Enable KVM group permissions
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
- uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 33
disable-animations: true
profile: pixel
arch : x86_64
emulator-options: -no-snapshot-save -no-window -no-audio -no-boot-anim -gpu swiftshader_indirect -camera-back none -camera-front none
script: bundle exec fastlane test batch_count:${{ strategy.job-total }} batch_number:${{ matrix.batch_number }}
- uses: actions/upload-artifact@v4.4.3
if: failure()
with:
name: report
path: ./**/build/reports/androidTests/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment