diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..05ecf622 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,61 @@ +# Build check for every PR into master and every push to master: the library and every example +# module in settings.gradle. A driver pin bump is proven against the examples before it merges +# (DEV-1115). 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 library and examples + 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" diff --git a/ShimmerAndroidInstrumentDriver/gradlew b/ShimmerAndroidInstrumentDriver/gradlew old mode 100644 new mode 100755