Add unit test for #1118 #933
Workflow file for this run
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: All tests | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
# This allows a subsequently queued workflow run to interrupt previous runs | |
concurrency: | |
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java-version: [ 17, 19, 21 ] # test LTS versions, and the newest | |
kotlin-version: [ 1.5.31, 1.6.21, 1.7.22, 1.8.20, 1.9.10, 2.0.0 ] | |
fail-fast: false # in case one JDK fails, we still want to see results from others | |
name: "[java=${{ matrix.java-version }}, kotlin=${{ matrix.kotlin-version }}]" | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK ${{ matrix.java-version }} | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: ${{ matrix.java-version }} | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Run tests with Gradle | |
run: > | |
./gradlew check | |
--stacktrace | |
-Pio_mockk_kotlin_version=${{ matrix.kotlin-version }} | |
-Pio_mockk_java_toolchain_test_version=${{ matrix.java-version }} | |
android-instrumented-tests: | |
runs-on: macos-12 | |
strategy: | |
matrix: | |
api-level: [ 30 ] # Relevant SDK versions to test for MockK Android projects | |
fail-fast: false # in case one API-level fails, we still want to see results from others | |
name: "[api-level=${{ matrix.api-level }}]" | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 17 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Set AVD Architecture Based on API Level | |
run: echo "ARCH=$(if [ ${{ matrix.api-level }} -eq 27 ]; then echo 'x86'; else echo 'x86_64'; fi)" >> $GITHUB_ENV | |
- name: AVD cache | |
uses: actions/cache@v3 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: ${{ runner.os }}-avd-${{ matrix.api-level }} | |
- name: create AVD and generate snapshot for caching | |
if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
arch: ${{ env.ARCH }} | |
api-level: ${{ matrix.api-level }} | |
force-avd-creation: false | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: false | |
script: echo "Generated AVD snapshot for caching." | |
emulator-build: 7425822 # workaround for emulator bug: https://github.com/ReactiveCircus/android-emulator-runner/issues/160 | |
- name: run tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
arch: ${{ env.ARCH }} | |
api-level: ${{ matrix.api-level }} | |
script: ./gradlew connectedCheck | |
emulator-build: 7425822 # workaround for emulator bug: https://github.com/ReactiveCircus/android-emulator-runner/issues/160 |