Repository navigation
71 lines (62 loc) · 2.99 KB
/
Copy pathci.yml
File metadata and controls
71 lines (62 loc) · 2.99 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
# Build check for every PR into master and every push to master: the library and every example
# module in settings.gradle, then the library's unit tests. A driver pin bump is proven against
# the examples and the tests before it merges (DEV-1115); each Java API release opens one
# (DEV-1359). Releases are a separate, dispatch-only workflow (release.yml).
#
# assembleDebug is run by name from the Gradle root, so Gradle runs it in every module that has
# it: a module added to settings.gradle is built here without editing this file. --continue keeps
# building after a failure so one run lists every broken module; the run still fails if any did.
#
# Reading the driver from Shimmer-Java-Android-API's GitHub Packages uses this repo's GITHUB_TOKEN
# only, never a long-lived token: PR builds run the PR's own build scripts, which could read it.
# If that is refused (401/403 resolving com.shimmerresearch:shimmerdriver), give this repo read
# access in the package's "Manage Actions access" settings rather than adding a token here.
name: CI
on:
pull_request:
branches: [master]
push:
branches: [master]
concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
working-directory: ShimmerAndroidInstrumentDriver
jobs:
build:
name: Build and test
runs-on: ubuntu-latest
timeout-minutes: 30 # a hung Gradle daemon otherwise holds the runner for 6 hours
permissions:
contents: read
packages: read
env:
# Read by the repositories in the root build.gradle to resolve the driver.
USERNAME: ${{ github.actor }}
TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
# AGP 8 needs JDK 17.
- name: Set up JDK 17
uses: actions/setup-java@cf277c60eb25467037889841efdb72551f06f6c3 # v4.9.1
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0
# gradle.properties is gitignored here, so android.useAndroidX (needed for the androidx
# dependencies) and the daemon heap are passed on the command line. Gradle's default 512 MB
# heap runs out while dexing the examples, and the daemon then hangs instead of failing.
- name: Build the library and every example
run: >-
./gradlew assembleDebug --continue -Pandroid.useAndroidX=true
-Dorg.gradle.jvmargs="-Xmx4g -XX:MaxMetaspaceSize=1g"
# The library's JVM unit tests (src/test, AAPI_*), on the debug variant only: the release
# variant runs the same tests. They run even if an example failed to build, so one run reports
# both. Same flags as above, so Gradle reuses the daemon.
- name: Run the library's unit tests
if: ${{ !cancelled() }}
run: >-
./gradlew :ShimmerAndroidInstrumentDriver:testDebugUnitTest -Pandroid.useAndroidX=true
-Dorg.gradle.jvmargs="-Xmx4g -XX:MaxMetaspaceSize=1g"