From 73301d794c5ddb637c6f78ead714bae1fd54a0a5 Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Mon, 25 Jul 2022 19:25:53 +0200 Subject: [PATCH 1/8] formatting --- .github/workflows/gradle.yml | 39 ++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 5c3c90b35..27338317b 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -18,25 +18,25 @@ jobs: runs-on: ubuntu-latest 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 + - 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 }} android-instrumented-tests: runs-on: macos-latest strategy: @@ -61,4 +61,3 @@ jobs: with: api-level: ${{ matrix.api-level }} script: ./gradlew connectedCheck - From d04e042814b674cf3a60458124ae7c94634a743d Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Mon, 25 Jul 2022 19:26:05 +0200 Subject: [PATCH 2/8] add concurrency --- .github/workflows/gradle.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 27338317b..08247b0ac 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -17,6 +17,10 @@ jobs: fail-fast: false runs-on: ubuntu-latest + concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + steps: - uses: actions/checkout@v2 - uses: actions/cache@v2 From 98671f4dde13658e3d3e0c8b1e70192df13ce6af Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Mon, 25 Jul 2022 19:32:04 +0200 Subject: [PATCH 3/8] reduce number of JDK versions tested, bump Kotlin 1.6.0 to 1.6.21 --- .github/workflows/gradle.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 08247b0ac..c585c3ed7 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -10,9 +10,9 @@ jobs: tests: 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 From fbd393a66fa1b685dd0a1182ffc6f30885ca711e Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Mon, 25 Jul 2022 19:36:37 +0200 Subject: [PATCH 4/8] move concurrency block --- .github/workflows/gradle.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index c585c3ed7..9e930783d 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -6,6 +6,10 @@ on: pull_request: branches: [ master ] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: tests: strategy: @@ -16,11 +20,6 @@ jobs: # in case one JDK fails, we still want to see results from others fail-fast: false runs-on: ubuntu-latest - - concurrency: - group: ${{ github.ref }} - cancel-in-progress: true - steps: - uses: actions/checkout@v2 - uses: actions/cache@v2 @@ -41,6 +40,7 @@ jobs: 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: From 2ce0e654aa6ac31fbd4633406b59cbfbb1e86238 Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Mon, 25 Jul 2022 21:55:49 +0200 Subject: [PATCH 5/8] update to cachev3, separate Gradle caches, make hash key less strict --- .github/workflows/gradle.yml | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 9e930783d..f7f31d7d9 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -22,14 +22,21 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/cache@v2 + + # Cache Gradle dependencies + - name: Setup Gradle Dependencies Cache + uses: actions/cache@v3 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- + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }} + + # Cache Gradle Wrapper + - 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: From b9dbde22fd264a67c523d4221185d4b5231c4c2c Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Mon, 25 Jul 2022 22:12:44 +0200 Subject: [PATCH 6/8] enable Gradle Build Cache, disable Gradle Welcome message --- gradle.properties | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 From 6d810bad3c051aeba62daabd09907622c5409e34 Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Mon, 25 Jul 2022 22:25:46 +0200 Subject: [PATCH 7/8] use the same cache settings for android tests, update concurrency (hopefully android and kt tests run in parallel again?) --- .github/workflows/gradle.yml | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index f7f31d7d9..6ab1e5588 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -6,8 +6,9 @@ on: pull_request: branches: [ master ] +# This allows a subsequently queued workflow run to interrupt previous runs concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' cancel-in-progress: true jobs: @@ -23,14 +24,12 @@ jobs: steps: - uses: actions/checkout@v2 - # Cache Gradle dependencies - name: Setup Gradle Dependencies Cache uses: actions/cache@v3 with: path: ~/.gradle/caches key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }} - # Cache Gradle Wrapper - name: Setup Gradle Wrapper Cache uses: actions/cache@v3 with: @@ -59,14 +58,19 @@ jobs: 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 + key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts') }} + + - name: Setup Gradle Wrapper 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/wrapper + key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} + - name: run tests uses: reactivecircus/android-emulator-runner@v2 with: From 50bed947ae3454f104da20724523d5c1a269f22a Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Mon, 25 Jul 2022 22:39:24 +0200 Subject: [PATCH 8/8] add a timeout of 30 minutes (just in case...) --- .github/workflows/gradle.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 6ab1e5588..aa2fea9db 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -13,6 +13,7 @@ concurrency: jobs: tests: + runs-on: ubuntu-latest strategy: matrix: java-version: [ 11, 17, 18 ] # test LTS versions, and the newest @@ -20,7 +21,7 @@ jobs: 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 @@ -52,6 +53,7 @@ jobs: strategy: matrix: api-level: [ 28, 29 ] + timeout-minutes: 30 steps: - uses: actions/setup-java@v2 with: