From 079e4844d6c520457b6cf6c827d94cb85dfc2a64 Mon Sep 17 00:00:00 2001 From: Daz DeBoer Date: Fri, 29 Oct 2021 08:14:50 -0600 Subject: [PATCH] Split tests for caching - Separate testing of Gradle Home caching from configuration-cache caching - Add test for configuration-cache when Gradle Home is not fully restored --- .../integTest-caching-configuration-cache.yml | 65 +++++++++++++++++++ ....yml => integTest-caching-gradle-home.yml} | 26 +------- 2 files changed, 66 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/integTest-caching-configuration-cache.yml rename .github/workflows/{integTest-caching.yml => integTest-caching-gradle-home.yml} (73%) diff --git a/.github/workflows/integTest-caching-configuration-cache.yml b/.github/workflows/integTest-caching-configuration-cache.yml new file mode 100644 index 0000000..0f3607c --- /dev/null +++ b/.github/workflows/integTest-caching-configuration-cache.yml @@ -0,0 +1,65 @@ +name: Test save/restore configuration-cache state + +on: + pull_request: + push: + workflow_dispatch: + +env: + GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}- + GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true + +jobs: + # Run initial Gradle builds to push initial cache entries + # These builds should start fresh without cache hits, due to the seed injected into the cache key above. + seed-build: + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout sources + uses: actions/checkout@v2 + - name: Build with configuration-cache enabled + uses: ./ + with: + build-root-directory: __tests__/samples/groovy-dsl + arguments: test --configuration-cache + + # Test that the project-dot-gradle cache will cache and restore configuration-cache + configuration-cache: + needs: seed-build + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout sources + uses: actions/checkout@v2 + - name: Execute Gradle build and verify cached configuration + uses: ./ + env: + VERIFY_CACHED_CONFIGURATION: true + with: + build-root-directory: __tests__/samples/groovy-dsl + arguments: test --configuration-cache + cache-read-only: true + + # Check that the build can run when no bundles are restored + no-bundles-restored: + needs: seed-build + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout sources + uses: actions/checkout@v2 + - name: Execute Gradle build with no cache artifact bundles restored + uses: ./ + with: + build-root-directory: __tests__/samples/groovy-dsl + arguments: test --configuration-cache + cache-read-only: true + gradle-home-cache-artifact-bundles: '[]' + diff --git a/.github/workflows/integTest-caching.yml b/.github/workflows/integTest-caching-gradle-home.yml similarity index 73% rename from .github/workflows/integTest-caching.yml rename to .github/workflows/integTest-caching-gradle-home.yml index 2b9b5d8..2a66a1a 100644 --- a/.github/workflows/integTest-caching.yml +++ b/.github/workflows/integTest-caching-gradle-home.yml @@ -1,4 +1,4 @@ -name: Test caching +name: Test save/restore Gradle Home directory on: pull_request: @@ -24,11 +24,6 @@ jobs: with: build-root-directory: __tests__/samples/groovy-dsl arguments: test - - name: Build with configuration-cache enabled - uses: ./ - with: - build-root-directory: __tests__/samples/groovy-dsl - arguments: test --configuration-cache # Test that the gradle-user-home cache will cache dependencies, by running build with --offline dependencies-cache: @@ -64,25 +59,6 @@ jobs: arguments: test -DverifyCachedBuild=true cache-read-only: true - # Test that the project-dot-gradle cache will cache and restore configuration-cache - configuration-cache: - needs: seed-build - strategy: - matrix: - os: [ubuntu-latest, windows-latest] - runs-on: ${{ matrix.os }} - steps: - - name: Checkout sources - uses: actions/checkout@v2 - - name: Execute Gradle build and verify cached configuration - uses: ./ - env: - VERIFY_CACHED_CONFIGURATION: true - with: - build-root-directory: __tests__/samples/groovy-dsl - arguments: test --configuration-cache - cache-read-only: true - # Check that the build can run when no bundles are restored no-bundles-restored: needs: seed-build