Skip to content

Commit

Permalink
Add new test pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
amberin committed Apr 3, 2024
1 parent 4221bb2 commit 1cc6818
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Run tests

on:
pull_request:
branches:
- 'master'
push:
branches:
- 'master'
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
# TODO: Use strategy.matrix and always run on lowest and highest supported API
steps:
- name: checkout
uses: actions/checkout@v4

- 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: Load Gradle from cache (or install + cache)
uses: gradle/actions/setup-gradle@v3

- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-29
save-always: true

- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
arch: x86_64
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
disable-spellchecker: true
profile: Nexus 6
script: echo "Generated AVD snapshot for caching."

- name: Save AVD to cache
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-29

- name: Add Dropbox API credentials
shell: bash
run: |
echo "dropbox.refresh_token = \"${{ secrets.DROPBOX_REFRESH_TOKEN }}\"" >> app.properties
echo "dropbox.app_key = \"${{ secrets.DROPBOX_APP_KEY }}\"" >> app.properties
- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
arch: x86_64
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
disable-spellchecker: true
profile: Nexus 6
# Tests should use the build which includes Dropbox code.
script: ./gradlew connectedPremiumDebugAndroidTest

0 comments on commit 1cc6818

Please sign in to comment.