Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 'all tests' GitHub action, enable Gradle Build Cache #862

Merged
merged 8 commits into from Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
80 changes: 48 additions & 32 deletions .github/workflows/gradle.yml
Expand Up @@ -6,59 +6,75 @@ on:
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: [11, 12, 13, 14, 15, 16, 17]
kotlin-version: [1.5.31, 1.6.0, 1.7.10]
kotlin-ir-enabled: [true, false]
java-version: [ 11, 17, 18 ] # test LTS versions, and the newest
kotlin-version: [ 1.5.31, 1.6.21, 1.7.10 ]
kotlin-ir-enabled: [ true, false ]
# in case one JDK fails, we still want to see results from others
fail-fast: false
runs-on: ubuntu-latest

timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ matrix.java-version }}-${{ matrix.kotlin-version }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-${{ matrix.java-version }}-gradle-
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java-version }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Run tests with Gradle
uses: eskatos/gradle-command-action@v1
with:
arguments: test --stacktrace -Pkotlin.version=${{ matrix.kotlin-version }} -Pkotlin.ir.enabled=${{ matrix.kotlin-ir-enabled }}
- uses: actions/checkout@v2

- name: Setup Gradle Dependencies Cache
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }}

- name: Setup Gradle Wrapper Cache
uses: actions/cache@v3
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}

- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java-version }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Run tests with Gradle
uses: eskatos/gradle-command-action@v1
with:
arguments: test --stacktrace -Pkotlin.version=${{ matrix.kotlin-version }} -Pkotlin.ir.enabled=${{ matrix.kotlin-ir-enabled }}

android-instrumented-tests:
runs-on: macos-latest
strategy:
matrix:
api-level: [ 28, 29 ]
timeout-minutes: 30
steps:
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- uses: actions/checkout@v2
- uses: actions/cache@v2

- name: Setup Gradle Dependencies Cache
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ matrix.api-level }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-${{ matrix.api-level }}-gradle-
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }}

- name: Setup Gradle Wrapper Cache
uses: actions/cache@v3
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}

- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
script: ./gradlew connectedCheck

6 changes: 5 additions & 1 deletion gradle.properties
@@ -1,6 +1,10 @@
version=1.12.5-SNAPSHOT
org.gradle.parallel=true
# Enable Gradle build cache https://docs.gradle.org/current/userguide/build_cache.html
org.gradle.caching=true
org.gradle.configureondemand=false
org.gradle.parallel=true
# disable annoying Gradle Welcome in CI/CD
org.gradle.welcome=never
org.gradle.jvmargs=-XX:MaxMetaspaceSize=768m
# localrepo=build/mockk-repo
localrepo=/Users/raibaz/.m2/repository
Expand Down