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
|
- uses: gradle/actions/setup-gradle@v3
|
||||||
with:
|
with:
|
||||||
cache-encryption-key: ${{ secrets.gradle_encryption_key }}
|
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
|
uses: actions/cache/restore@v4
|
||||||
with:
|
with:
|
||||||
key: app_build-tests-without-emulator
|
key: incremental-build-tests
|
||||||
path: |
|
restore-keys: incremental-build-tests # restore cache from main branch
|
||||||
.gradle/configuration-cache
|
path: app/build
|
||||||
app/build
|
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
|
|
50
.github/workflows/test-dev.yml
vendored
50
.github/workflows/test-dev.yml
vendored
|
@ -24,29 +24,19 @@ jobs:
|
||||||
- uses: gradle/actions/setup-gradle@v3
|
- uses: gradle/actions/setup-gradle@v3
|
||||||
with:
|
with:
|
||||||
cache-encryption-key: ${{ secrets.gradle_encryption_key }}
|
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
|
- name: Use incremental build 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 }}
|
|
||||||
uses: actions/cache/restore@v4
|
uses: actions/cache/restore@v4
|
||||||
with:
|
with:
|
||||||
key: app_build-tests-without-emulator
|
key: incremental-build-tests
|
||||||
restore-keys: app_build-tests-without-emulator- # restore cache from main branch
|
restore-keys: incremental-build-tests # restore cache from main branch
|
||||||
path: |
|
path: app/build
|
||||||
.gradle/configuration-cache
|
|
||||||
app/build
|
|
||||||
|
|
||||||
- name: Run lint and unit tests
|
- 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:
|
test_on_emulator:
|
||||||
name: Tests with emulator
|
name: Tests with emulator
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -59,22 +49,14 @@ jobs:
|
||||||
- uses: gradle/actions/setup-gradle@v3
|
- uses: gradle/actions/setup-gradle@v3
|
||||||
with:
|
with:
|
||||||
cache-encryption-key: ${{ secrets.gradle_encryption_key }}
|
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
|
- name: Use incremental build 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
|
|
||||||
if: ${{ !env.is_main_branch }}
|
if: ${{ !env.is_main_branch }}
|
||||||
uses: actions/cache/restore@v4
|
uses: actions/cache/restore@v4
|
||||||
with:
|
with:
|
||||||
key: app_build-tests-with-emulator
|
key: incremental-build-tests
|
||||||
restore-keys: app_build-tests-with-emulator- # restore cache from main branch
|
restore-keys: incremental-build-tests # restore cache from main branch
|
||||||
path: |
|
path: |
|
||||||
.gradle/configuration-cache
|
.gradle/configuration-cache
|
||||||
app/build
|
app/build
|
||||||
|
@ -92,5 +74,11 @@ jobs:
|
||||||
key: avd-${{ hashFiles('app/build.gradle.kts') }} # gradle-managed devices are defined there
|
key: avd-${{ hashFiles('app/build.gradle.kts') }} # gradle-managed devices are defined there
|
||||||
|
|
||||||
- name: Run device tests
|
- 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