diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 5c3c90b35..aa2fea9db 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -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 - diff --git a/gradle.properties b/gradle.properties index 22747070c..f417ea718 100644 --- a/gradle.properties +++ b/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