forked from mockk/mockk
-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (79 loc) · 3.16 KB
/
gradle.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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