Repository navigation
209 lines (179 loc) · 6.28 KB
/
Copy pathtests.yml
File metadata and controls
209 lines (179 loc) · 6.28 KB
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
name: Tests
on:
push:
branches: [ master, 'robolectric-*.x', 'google' ]
paths-ignore:
- '**.md'
pull_request:
branches: [ master ]
paths-ignore:
- '**.md'
# Run by the release workflow.
workflow_call:
inputs:
ref:
description: 'The commit to test'
type: string
required: true
concurrency:
# When called by another workflow, github.workflow is the caller's name.
group: tests-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
# Empty, so the default, except when called by the release workflow.
ref: ${{ inputs.ref }}
- name: Set up JDK
uses: actions/setup-java@v6
with:
distribution: 'temurin'
java-version-file: .github/.java-version
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v6
with:
# The android-all jars (about 2 GB) are downloaded from Maven Central, not cached.
gradle-home-cache-excludes: |
caches/modules-2/files-2.1/org.robolectric/android-all
caches/modules-2/files-2.1/org.robolectric/android-all-instrumented
- name: Build
env:
SKIP_ERRORPRONE: true
SKIP_JAVADOC: true
run: ./gradlew assemble testClasses --stacktrace
unit-tests:
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
api-versions: [
'24,25,26',
'27,28,29',
'30,31,32',
'33,34,35',
'36,37'
]
steps:
- name: Checkout
uses: actions/checkout@v7
with:
# Empty, so the default, except when called by the release workflow.
ref: ${{ inputs.ref }}
- name: Set up JDK
uses: actions/setup-java@v6
with:
distribution: 'temurin'
java-version-file: .github/.java-version
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v6
with:
# The android-all jars (about 2 GB) are downloaded from Maven Central, not cached.
gradle-home-cache-excludes: |
caches/modules-2/files-2.1/org.robolectric/android-all
caches/modules-2/files-2.1/org.robolectric/android-all-instrumented
- name: Run unit tests
env:
SKIP_ERRORPRONE: true
SKIP_JAVADOC: true
run: >
./gradlew test
--stacktrace --continue
-Drobolectric.enabledSdks=${{ matrix.api-versions }}
-Drobolectric.alwaysIncludeVariantMarkersInTestName=true
-x :integration_tests:nativegraphics:test
-x :integration_tests:roborazzi:test
-x :integration_tests:ctesque:testDebugUnitTestNativeResources
- name: Upload Test Results
uses: actions/upload-artifact@v7
if: always()
with:
name: test_results_${{ matrix.api-versions }}
path: '**/build/test-results/**/TEST-*.xml'
instrumentation-tests:
runs-on: ubuntu-latest
timeout-minutes: 90
needs: build
strategy:
# Allow tests to continue on other devices if they fail on one device.
fail-fast: false
matrix:
api-level: [ 30, 37 ]
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@v2.0.0
with:
preinstalled-runtimes: true
android: false
- name: Checkout
uses: actions/checkout@v7
with:
# Empty, so the default, except when called by the release workflow.
ref: ${{ inputs.ref }}
- name: Set up JDK
uses: actions/setup-java@v6
with:
distribution: 'temurin'
java-version-file: .github/.java-version
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v6
with:
# The android-all jars (about 2 GB) are downloaded from Maven Central, not cached.
gradle-home-cache-excludes: |
caches/modules-2/files-2.1/org.robolectric/android-all
caches/modules-2/files-2.1/org.robolectric/android-all-instrumented
- 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: Accept Android SDK licences
run: yes | "$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager" --licenses > /dev/null
- name: Run device tests
env:
SKIP_ERRORPRONE: true
SKIP_JAVADOC: true
run: ./gradlew -Pandroid.sdk.channel=3 nexusOneApi${{ matrix.api-level }}DebugAndroidTest --stacktrace
- name: Upload test results
if: always()
uses: actions/upload-artifact@v7
with:
name: test-results-${{ matrix.api-level }}
path: |
**/build/reports/androidTests/**
**/build/outputs/androidTest-results/**
publish-to-snapshots:
runs-on: ubuntu-latest
env:
SONATYPE_LOGIN: ${{ secrets.SONATYPE_LOGIN }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
needs: unit-tests
if: github.repository == 'robolectric/robolectric' && github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v7
with:
# Empty, so the default, except when called by the release workflow.
ref: ${{ inputs.ref }}
- name: Set up JDK
uses: actions/setup-java@v6
with:
distribution: 'temurin'
java-version-file: .github/.java-version
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v6
with:
# Only the test jobs save the cache, to keep its entries within GitHub's 10 GB limit.
cache-read-only: true
# The android-all jars (about 2 GB) are downloaded from Maven Central, not cached.
gradle-home-cache-excludes: |
caches/modules-2/files-2.1/org.robolectric/android-all
caches/modules-2/files-2.1/org.robolectric/android-all-instrumented
- name: Publish
run: ./gradlew publish --stacktrace