mirror of
https://github.com/bitfireAT/davx5-ose
synced 2024-07-22 19:21:09 +00:00
[CI] Improve caching behavior
This commit is contained in:
parent
b88c35169e
commit
dd08415c84
10
.github/workflows/codeql.yml
vendored
10
.github/workflows/codeql.yml
vendored
|
@ -36,14 +36,14 @@ jobs:
|
|||
- uses: gradle/actions/setup-gradle@v3
|
||||
with:
|
||||
cache-encryption-key: ${{ secrets.gradle_encryption_key }}
|
||||
cache-read-only: true # gradle user home cache is generated by test jobs
|
||||
|
||||
- name: Use app/build and gradle configuration cache
|
||||
- name: Use incremental build cache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
key: app_build-tests-without-emulator
|
||||
path: |
|
||||
.gradle/configuration-cache
|
||||
app/build
|
||||
key: incremental-build-tests
|
||||
restore-keys: incremental-build-tests # restore cache from main branch
|
||||
path: app/build
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
|
|
48
.github/workflows/test-dev.yml
vendored
48
.github/workflows/test-dev.yml
vendored
|
@ -24,29 +24,19 @@ jobs:
|
|||
- uses: gradle/actions/setup-gradle@v3
|
||||
with:
|
||||
cache-encryption-key: ${{ secrets.gradle_encryption_key }}
|
||||
cache-write-only: ${{ env.is_main_branch }} # otherwise build cache will grow larger and larger
|
||||
cache-read-only: true # gradle user home cache is generated by test_on_emulator
|
||||
|
||||
- name: Create app/build and gradle configuration cache
|
||||
if: ${{ env.is_main_branch }}
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
key: app_build-tests-without-emulator-${{ github.run_id }}
|
||||
path: |
|
||||
.gradle/configuration-cache
|
||||
app/build
|
||||
- name: Use app/build and gradle configuration cache
|
||||
if: ${{ !env.is_main_branch }}
|
||||
- name: Use incremental build cache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
key: app_build-tests-without-emulator
|
||||
restore-keys: app_build-tests-without-emulator- # restore cache from main branch
|
||||
path: |
|
||||
.gradle/configuration-cache
|
||||
app/build
|
||||
key: incremental-build-tests
|
||||
restore-keys: incremental-build-tests # restore cache from main branch
|
||||
path: app/build
|
||||
|
||||
- name: Run lint and unit tests
|
||||
run: ./gradlew --build-cache --configuration-cache --configuration-cache-problems=warn app:check
|
||||
run: ./gradlew --build-cache --configuration-cache --configuration-cache-problems=warn --no-daemon app:check
|
||||
|
||||
# generates the build caches because it uses more gradle dependencies
|
||||
test_on_emulator:
|
||||
name: Tests with emulator
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -59,22 +49,14 @@ jobs:
|
|||
- uses: gradle/actions/setup-gradle@v3
|
||||
with:
|
||||
cache-encryption-key: ${{ secrets.gradle_encryption_key }}
|
||||
cache-write-only: ${{ env.is_main_branch }} # otherwise build cache will grow larger and larger
|
||||
gradle-home-cache-cleanup: true # avoid ever-growing gradle user home cache
|
||||
|
||||
- name: Create app/build and gradle configuration cache
|
||||
if: ${{ env.is_main_branch }}
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
key: app_build-tests-with-emulator-${{ github.run_id }}
|
||||
path: |
|
||||
.gradle/configuration-cache
|
||||
app/build
|
||||
- name: Use app/build and gradle configuration cache
|
||||
- name: Use incremental build cache
|
||||
if: ${{ !env.is_main_branch }}
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
key: app_build-tests-with-emulator
|
||||
restore-keys: app_build-tests-with-emulator- # restore cache from main branch
|
||||
key: incremental-build-tests
|
||||
restore-keys: incremental-build-tests # restore cache from main branch
|
||||
path: |
|
||||
.gradle/configuration-cache
|
||||
app/build
|
||||
|
@ -92,5 +74,11 @@ jobs:
|
|||
key: avd-${{ hashFiles('app/build.gradle.kts') }} # gradle-managed devices are defined there
|
||||
|
||||
- name: Run device tests
|
||||
run: ./gradlew --build-cache --configuration-cache --configuration-cache-problems=warn app:virtualCheck
|
||||
run: ./gradlew --build-cache --configuration-cache --configuration-cache-problems=warn --no-daemon app:virtualCheck
|
||||
|
||||
- name: Create incremental build cache
|
||||
if: ${{ env.is_main_branch }}
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
key: incremental-build-tests-${{ github.run_id }}
|
||||
path: app/build
|
||||
|
|
Loading…
Reference in a new issue