From 5a2a0e3d6d0b0b209a507458bf9a220ead59b61f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Mon, 28 Dec 2020 22:45:21 +0100 Subject: [PATCH] Github workflow config improvements (#1056) --- .github/workflows/test.yml | 20 ++++++++++---------- .gitignore | 1 + settings.gradle | 7 +++++++ 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d78c5099..426f22be 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,9 +28,9 @@ jobs: ~/.gradle/wrapper key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }} - name: Build - run: ./gradlew compileFdroidDebugUnitTestKotlin packageFdroidDebug preFdroidDebugAndroidTestBuild + run: ./gradlew --build-cache compileFdroidDebugUnitTestKotlin preFdroidDebugAndroidTestBuild dexBuilderFdroidDebugAndroidTest packageFdroidDebug packageFdroidDebugAndroidTest - name: Prepare build cache - run: tar -cvf prebuild.tar .gradle app/build + run: tar -cf prebuild.tar .build-cache .gradle app/build - uses: actions/upload-artifact@v2 with: name: prebuild.tar @@ -56,18 +56,18 @@ jobs: with: name: prebuild.tar - name: Extract build cache - run: tar -xvf prebuild.tar app/build + run: tar -xf prebuild.tar - name: Unit tests run: | - ./gradlew -Pcoverage testFdroidDebugUnitTest --stacktrace - ./gradlew -Pcoverage jacocoTestReport --stacktrace + ./gradlew --build-cache -Pcoverage testFdroidDebugUnitTest --stacktrace + ./gradlew --build-cache -Pcoverage jacocoTestReport --stacktrace - uses: codecov/codecov-action@v1 with: flags: unit instrumentation-tests: name: Instrumentation tests - runs-on: ubuntu-latest + runs-on: macOS-latest timeout-minutes: 15 needs: [ build ] strategy: @@ -89,15 +89,15 @@ jobs: with: name: prebuild.tar - name: Extract build cache - run: tar -xvf prebuild.tar app/build + run: tar -xf prebuild.tar - name: Instrumentation tests uses: reactivecircus/android-emulator-runner@v2.13.0 with: api-level: ${{ matrix.api-level }} arch: x86 script: | - ./gradlew -Pcoverage connectedFdroidDebugAndroidTest --stacktrace - ./gradlew -Pcoverage jacocoTestReport --stacktrace + ./gradlew --build-cache -Pcoverage connectedFdroidDebugAndroidTest --stacktrace + ./gradlew --build-cache -Pcoverage jacocoTestReport --stacktrace - uses: codecov/codecov-action@v1 with: flags: instrumented,api-${{ matrix.api-level }} @@ -124,7 +124,7 @@ jobs: with: name: prebuild.tar - name: Extract build cache - run: tar -xvf prebuild.tar app/build + run: tar -xf prebuild.tar - name: Decrypt keys env: ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY }} diff --git a/.gitignore b/.gitignore index 5daeb6b9..5d3321e3 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ out/ # Gradle files .gradle/ build/ +.build-cache # Local configuration file (sdk path, etc) local.properties diff --git a/settings.gradle b/settings.gradle index e7b4def4..058beb21 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,8 @@ include ':app' + +buildCache { + local { + directory = new File(rootDir, '.build-cache') + removeUnusedEntriesAfterDays = 30 + } +}