mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-11-26 11:02:10 +00:00
Update most test workflows to separate config from execution
This commit is contained in:
parent
0e8b9655a0
commit
e977669c8c
7 changed files with 154 additions and 76 deletions
20
.github/workflows/integTest-caching-config.yml
vendored
20
.github/workflows/integTest-caching-config.yml
vendored
|
@ -11,8 +11,6 @@ env:
|
|||
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:
|
||||
|
@ -21,11 +19,9 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
- name: Build using Gradle wrapper
|
||||
- name: Setup Gradle
|
||||
uses: ./
|
||||
with:
|
||||
build-root-directory: __tests__/samples/groovy-dsl
|
||||
arguments: test
|
||||
# Add "wrapper" to main cache entry and remove 'wrapper-zips' cache entry
|
||||
# Exclude build-cache from main cache entry
|
||||
gradle-home-cache-includes: |
|
||||
|
@ -41,6 +37,9 @@ jobs:
|
|||
["instrumented-jars", "caches/jars-*/*/"],
|
||||
["kotlin-dsl", "caches/*/kotlin-dsl/*/*/"]
|
||||
]
|
||||
- name: Build using Gradle wrapper
|
||||
working-directory: __tests__/samples/groovy-dsl
|
||||
run: ./gradlew test
|
||||
|
||||
# Test that the gradle-user-home cache will cache dependencies, by running build with --offline
|
||||
verify-build:
|
||||
|
@ -52,13 +51,10 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
- name: Execute Gradle build with --offline
|
||||
- name: Setup Gradle
|
||||
uses: ./
|
||||
with:
|
||||
build-root-directory: __tests__/samples/groovy-dsl
|
||||
arguments: test --offline
|
||||
cache-read-only: true
|
||||
# Need the same configuration when restoring state from cache
|
||||
# Use the same configuration when restoring state from cache
|
||||
gradle-home-cache-includes: |
|
||||
caches
|
||||
notifications
|
||||
|
@ -72,5 +68,9 @@ jobs:
|
|||
["instrumented-jars", "caches/jars-*/*/"],
|
||||
["kotlin-dsl", "caches/*/kotlin-dsl/*/*/"]
|
||||
]
|
||||
cache-read-only: true
|
||||
- name: Execute Gradle build with --offline
|
||||
working-directory: __tests__/samples/groovy-dsl
|
||||
run: ./gradlew test --offline
|
||||
|
||||
|
||||
|
|
|
@ -21,19 +21,16 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
- name: Build with configuration-cache enabled
|
||||
- name: Setup Gradle
|
||||
uses: ./
|
||||
with:
|
||||
build-root-directory: __tests__/samples/groovy-dsl
|
||||
arguments: test --configuration-cache
|
||||
- name: Second build with configuration-cache enabled
|
||||
uses: ./
|
||||
with:
|
||||
build-root-directory: __tests__/samples/kotlin-dsl
|
||||
arguments: test --configuration-cache
|
||||
- name: Groovy build with configuration-cache enabled
|
||||
working-directory: __tests__/samples/groovy-dsl
|
||||
run: ./gradlew test --configuration-cache
|
||||
- name: Kotlin build with configuration-cache enabled
|
||||
working-directory: __tests__/samples/kotlin-dsl
|
||||
run: ./gradlew test --configuration-cache
|
||||
|
||||
# Test restore configuration-cache
|
||||
configuration-cache:
|
||||
configuration-cache-groovy:
|
||||
needs: seed-build
|
||||
strategy:
|
||||
matrix:
|
||||
|
@ -42,17 +39,18 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
- name: Execute Gradle build and verify cached configuration
|
||||
- name: Setup Gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: true
|
||||
- name: Execute Gradle build and verify cached configuration
|
||||
env:
|
||||
VERIFY_CACHED_CONFIGURATION: true
|
||||
with:
|
||||
build-root-directory: __tests__/samples/groovy-dsl
|
||||
arguments: test --configuration-cache
|
||||
cache-read-only: true
|
||||
working-directory: __tests__/samples/groovy-dsl
|
||||
run: ./gradlew test --configuration-cache
|
||||
|
||||
# Test restore configuration-cache from second build invocation
|
||||
configuration-cache-2:
|
||||
# Test restore configuration-cache from the second build invocation
|
||||
configuration-cache-kotlin:
|
||||
needs: seed-build
|
||||
strategy:
|
||||
matrix:
|
||||
|
@ -61,14 +59,15 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
- name: Execute Gradle build and verify cached configuration
|
||||
- name: Setup Gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: true
|
||||
- name: Execute Gradle build and verify cached configuration
|
||||
env:
|
||||
VERIFY_CACHED_CONFIGURATION: true
|
||||
with:
|
||||
build-root-directory: __tests__/samples/kotlin-dsl
|
||||
arguments: test --configuration-cache
|
||||
cache-read-only: true
|
||||
working-directory: __tests__/samples/kotlin-dsl
|
||||
run: ./gradlew test --configuration-cache
|
||||
|
||||
# Check that the build can run when no extracted cache entries are restored
|
||||
no-extracted-cache-entries-restored:
|
||||
|
@ -80,11 +79,11 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
- name: Execute Gradle build with no cache extracted cache entries restored
|
||||
- name: Setup Gradle with no cache extracted cache entries restored
|
||||
uses: ./
|
||||
with:
|
||||
build-root-directory: __tests__/samples/groovy-dsl
|
||||
arguments: test --configuration-cache
|
||||
cache-read-only: true
|
||||
gradle-home-extracted-cache-entries: '[]'
|
||||
|
||||
- name: Check execute Gradle build with configuration cache enabled (but not restored)
|
||||
working-directory: __tests__/samples/groovy-dsl
|
||||
run: ./gradlew test --configuration-cache
|
||||
|
|
|
@ -10,8 +10,6 @@ env:
|
|||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}-
|
||||
|
||||
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:
|
||||
|
@ -20,11 +18,11 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
- name: Build using Gradle wrapper
|
||||
- name: Setup Gradle
|
||||
uses: ./
|
||||
with:
|
||||
build-root-directory: __tests__/samples/groovy-dsl
|
||||
arguments: test
|
||||
- name: Build using Gradle wrapper
|
||||
working-directory: __tests__/samples/groovy-dsl
|
||||
run: ./gradlew test
|
||||
|
||||
# Test that the gradle-user-home cache will cache dependencies, by running build with --offline
|
||||
dependencies-cache:
|
||||
|
@ -36,12 +34,13 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
- name: Execute Gradle build with --offline
|
||||
- name: Setup Gradle
|
||||
uses: ./
|
||||
with:
|
||||
build-root-directory: __tests__/samples/groovy-dsl
|
||||
arguments: test --offline
|
||||
cache-read-only: true
|
||||
- name: Execute Gradle build with --offline
|
||||
working-directory: __tests__/samples/groovy-dsl
|
||||
run: ./gradlew test --offline
|
||||
|
||||
# Test that the gradle-user-home cache will cache and restore local build-cache
|
||||
build-cache:
|
||||
|
@ -53,12 +52,13 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
- name: Execute Gradle build and verify tasks from cache
|
||||
- name: Setup Gradle
|
||||
uses: ./
|
||||
with:
|
||||
build-root-directory: __tests__/samples/groovy-dsl
|
||||
arguments: test -DverifyCachedBuild=true
|
||||
cache-read-only: true
|
||||
- name: Execute Gradle build and verify tasks from cache
|
||||
working-directory: __tests__/samples/groovy-dsl
|
||||
run: ./gradlew test -DverifyCachedBuild=true
|
||||
|
||||
# Check that the build can run when Gradle User Home is not fully restored
|
||||
no-extracted-cache-entries-restored:
|
||||
|
@ -70,11 +70,12 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
- name: Execute Gradle build with no extracted cache entries restored
|
||||
- name: Setup Gradle with no extracted cache entries restored
|
||||
uses: ./
|
||||
with:
|
||||
build-root-directory: __tests__/samples/groovy-dsl
|
||||
arguments: test
|
||||
cache-read-only: true
|
||||
gradle-home-extracted-cache-entries: '[]'
|
||||
- name: Check executee Gradle build
|
||||
working-directory: __tests__/samples/groovy-dsl
|
||||
run: ./gradlew test
|
||||
|
||||
|
|
24
.github/workflows/integTest-gradle-user-home.yml
vendored
24
.github/workflows/integTest-gradle-user-home.yml
vendored
|
@ -8,7 +8,7 @@ on:
|
|||
|
||||
env:
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}-
|
||||
GRADLE_USER_HOME: custom/gradle/home
|
||||
GRADLE_USER_HOME: ${{github.workspace}}/custom/gradle/home
|
||||
|
||||
jobs:
|
||||
# Run initial Gradle builds to push initial cache entries
|
||||
|
@ -21,11 +21,11 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
- name: Build using Gradle wrapper
|
||||
- name: Setup Gradle
|
||||
uses: ./
|
||||
with:
|
||||
build-root-directory: __tests__/samples/groovy-dsl
|
||||
arguments: test
|
||||
- name: Build using Gradle wrapper
|
||||
working-directory: __tests__/samples/groovy-dsl
|
||||
run: ./gradlew test --info
|
||||
|
||||
# Test that the gradle-user-home cache will cache dependencies, by running build with --offline
|
||||
dependencies-cache:
|
||||
|
@ -37,12 +37,13 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
- name: Execute Gradle build with --offline
|
||||
- name: Setup Gradle
|
||||
uses: ./
|
||||
with:
|
||||
build-root-directory: __tests__/samples/groovy-dsl
|
||||
arguments: test --offline
|
||||
cache-read-only: true
|
||||
- name: Execute Gradle build with --offline
|
||||
working-directory: __tests__/samples/groovy-dsl
|
||||
run: ./gradlew test --offline --info
|
||||
|
||||
# Test that the gradle-user-home cache will cache and restore local build-cache
|
||||
build-cache:
|
||||
|
@ -54,9 +55,10 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
- name: Execute Gradle build and verify tasks from cache
|
||||
- name: Setup Gradle
|
||||
uses: ./
|
||||
with:
|
||||
build-root-directory: __tests__/samples/groovy-dsl
|
||||
arguments: test -DverifyCachedBuild=true
|
||||
cache-read-only: true
|
||||
- name: Execute Gradle build and verify tasks from cache
|
||||
working-directory: __tests__/samples/groovy-dsl
|
||||
run: ./gradlew test -DverifyCachedBuild=true --info
|
||||
|
|
77
.github/workflows/integTest-gradle-versions.yml
vendored
Normal file
77
.github/workflows/integTest-gradle-versions.yml
vendored
Normal file
|
@ -0,0 +1,77 @@
|
|||
name: Test provision different Gradle versions
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [assigned, review_requested]
|
||||
push:
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}-
|
||||
|
||||
jobs:
|
||||
# Tests for executing with different Gradle versions.
|
||||
# Each build verifies that it is executed with the expected Gradle version.
|
||||
provision-gradle:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
include:
|
||||
- os: windows-latest
|
||||
script-suffix: '.bat'
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup Gradle with v6.9
|
||||
uses: ./
|
||||
with:
|
||||
gradle-version: 6.9
|
||||
- name: Test uses Gradle v6.9
|
||||
working-directory: __tests__/samples/no-wrapper
|
||||
run: gradle help "-DgradleVersionCheck=6.9"
|
||||
- name: Setup Gradle with v7.1.1
|
||||
uses: ./
|
||||
with:
|
||||
gradle-version: 7.1.1
|
||||
- name: Test uses Gradle v7.1.1
|
||||
working-directory: __tests__/samples/no-wrapper
|
||||
run: gradle help "-DgradleVersionCheck=7.1.1"
|
||||
- name: Setup Gradle with release-candidate
|
||||
uses: ./
|
||||
with:
|
||||
gradle-version: release-candidate
|
||||
- name: Test use release-candidate
|
||||
working-directory: __tests__/samples/no-wrapper
|
||||
run: gradle help
|
||||
|
||||
gradle-versions:
|
||||
strategy:
|
||||
matrix:
|
||||
gradle: [7.3, 6.9, 5.6.4, 4.10.3]
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
include:
|
||||
- gradle: 5.6.4
|
||||
build-root-suffix: -gradle-5
|
||||
- gradle: 4.10.3
|
||||
build-root-suffix: -gradle-4
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup Gradle
|
||||
uses: ./
|
||||
with:
|
||||
gradle-version: ${{ matrix.gradle }}
|
||||
- name: Run Gradle build
|
||||
id: gradle
|
||||
working-directory: __tests__/samples/no-wrapper${{ matrix.build-root-suffix }}
|
||||
run: gradle help "-DgradleVersionCheck=${{matrix.gradle}}"
|
||||
- name: Check build scan url
|
||||
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
||||
uses: actions/github-script@v3
|
||||
with:
|
||||
script: |
|
||||
core.setFailed('No build scan detected')
|
||||
|
||||
|
16
.github/workflows/integTest-kotlin-dsl.yml
vendored
16
.github/workflows/integTest-kotlin-dsl.yml
vendored
|
@ -20,11 +20,11 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
- name: Build kotlin-dsl project
|
||||
- name: Setup Gradle
|
||||
uses: ./
|
||||
with:
|
||||
build-root-directory: __tests__/samples/kotlin-dsl
|
||||
arguments: test
|
||||
- name: Build kotlin-dsl project
|
||||
working-directory: __tests__/samples/kotlin-dsl
|
||||
run: ./gradlew test
|
||||
|
||||
# Check that the build can run --offline
|
||||
verify-build:
|
||||
|
@ -36,8 +36,8 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
- name: Build kotlin-dsl project
|
||||
- name: Setup Gradle
|
||||
uses: ./
|
||||
with:
|
||||
build-root-directory: __tests__/samples/kotlin-dsl
|
||||
arguments: test --offline
|
||||
- name: Build kotlin-dsl project
|
||||
working-directory: __tests__/samples/kotlin-dsl
|
||||
run: ./gradlew test --offline
|
||||
|
|
9
.github/workflows/pr-build-scan-comment.yml
vendored
9
.github/workflows/pr-build-scan-comment.yml
vendored
|
@ -8,11 +8,10 @@ jobs:
|
|||
- uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
- uses: gradle/gradle-build-action@v2
|
||||
id: gradle
|
||||
with:
|
||||
build-root-directory: __tests__/samples/kotlin-dsl
|
||||
arguments: help
|
||||
- uses: ./
|
||||
- id: gradle
|
||||
working-directory: __tests__/samples/kotlin-dsl
|
||||
run: ./gradlew help
|
||||
- name: "Comment build scan url"
|
||||
uses: actions/github-script@v3
|
||||
with:
|
||||
|
|
Loading…
Reference in a new issue