Compare commits

...

8 Commits

Author SHA1 Message Date
daz
af1da67850 Prevent concurrent jobs in integ-test-full 2024-08-03 15:54:44 -06:00
daz
f8ba43cf0a Better names for suite workflows 2024-08-03 15:10:49 -06:00
daz
bcd07e6643 Refactor integ-tests into suites
- Extract 2 suites to make it possible to reduce concurrency
- Add separate workflow for integ-test and integ-test-full
2024-08-03 14:56:37 -06:00
daz
d74ee73e9f Refactor integ-tests
- Include test name in all job names
- Remove cache key delegation as it is unused
2024-08-03 14:56:37 -06:00
bigdaz
fb2e6938b6 [bot] Update dist directory 2024-08-02 21:57:19 +00:00
Daz DeBoer
07190022f8 Improve error messages for min-wrapper-count (#321) 2024-08-02 15:56:14 -06:00
daz
ac3aebda93 Improve error messages for min-wrapper-count
- Specific message when no wrappers are found
- Better message when wrapper count is less than configured

Fixes #284
2024-08-02 15:51:41 -06:00
daz
d473db0899 Add tests for wrapper-validation with insufficient wrappers
- Test min-wrapper-count greater than wrappers
- Test caswrapper-validation with insufficient wrappers
2024-08-02 15:50:28 -06:00
35 changed files with 417 additions and 388 deletions

View File

@@ -0,0 +1,35 @@
name: CI-integ-test-full
on:
workflow_dispatch:
push:
paths:
- 'dist/**'
permissions:
contents: write
concurrency:
group: integ-test-${{ github.ref }}
cancel-in-progress: false
jobs:
caching-integ-tests:
uses: ./.github/workflows/suite-integ-test-caching.yml
concurrency:
group: CI-integ-test-full
cancel-in-progress: false
with:
runner-os: '["ubuntu-latest", "windows-latest", "macos-latest"]'
skip-dist: true
secrets: inherit
other-integ-tests:
uses: ./.github/workflows/suite-integ-test-other.yml
concurrency:
group: CI-integ-test-full
cancel-in-progress: false
with:
runner-os: '["ubuntu-latest", "windows-latest", "macos-latest"]'
skip-dist: true
secrets: inherit

View File

@@ -8,43 +8,18 @@ on:
- 'main' - 'main'
- 'release/**' - 'release/**'
- 'dev/**' # Allow running tests on dev branches without a PR - 'dev/**' # Allow running tests on dev branches without a PR
paths-ignore:
- 'dist/**'
permissions:
contents: write
concurrency: concurrency:
group: integ-tests-${{ github.ref }} group: integ-test-${{ github.ref }}
cancel-in-progress: false cancel-in-progress: false
jobs: jobs:
determine-suite:
runs-on: ubuntu-latest
outputs:
runner-os: ${{ steps.determine-suite.outputs.suite == 'quick' && '["ubuntu-latest"]' || '["ubuntu-latest", "windows-latest", "macos-latest"]' }}
cache-key-prefix: '0' # TODO DAZ Try this again ${{ steps.determine-suite.outputs.suite == 'quick' && '0' || github.run_number }}
suite: ${{ steps.determine-suite.outputs.suite }}
steps:
- name: Determine suite to run
id: determine-suite
run: |
# Always run quick suite if we are not in the core `gradle/actions` repository
# This reduces the load for developers working on 'main' on forks
if [ "${{ github.repository }}" != "gradle/actions" ]; then
echo "Not in core repository: suite=quick"
echo "suite=quick" >> "$GITHUB_OUTPUT"
exit 0
fi
# Run full suite for push trigger with "[bot] Update dist directory" commit message
if [ "${{ github.event.head_commit.message }}" == "[bot] Update dist directory" ]; then
echo "Bot commit to main branch: suite=full"
echo "suite=full" >> "$GITHUB_OUTPUT"
exit 0
fi
# Run quick suite for everything else
echo "Everything else: suite=quick"
echo "suite=quick" >> "$GITHUB_OUTPUT"
build-distribution: build-distribution:
needs: [determine-suite]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout sources - name: Checkout sources
@@ -53,150 +28,16 @@ jobs:
if: ${{ needs.determine-suite.outputs.suite != 'full' }} if: ${{ needs.determine-suite.outputs.suite != 'full' }}
uses: ./.github/actions/build-dist uses: ./.github/actions/build-dist
build-scan-publish: caching-integ-tests:
needs: [determine-suite, build-distribution] needs: build-distribution
uses: ./.github/workflows/integ-test-build-scan-publish.yml uses: ./.github/workflows/suite-integ-test-caching.yml
with: with:
runner-os: '${{ needs.determine-suite.outputs.runner-os }}' skip-dist: false
cache-key-prefix: '${{ needs.determine-suite.outputs.cache-key-prefix }}-' secrets: inherit
skip-dist: ${{ needs.determine-suite.outputs.suite == 'full' }}
cache-cleanup: other-integ-tests:
needs: [determine-suite, build-distribution] needs: build-distribution
uses: ./.github/workflows/integ-test-cache-cleanup.yml uses: ./.github/workflows/suite-integ-test-other.yml
with: with:
runner-os: '${{ needs.determine-suite.outputs.runner-os }}' skip-dist: false
cache-key-prefix: '${{ needs.determine-suite.outputs.suite}}-${{github.run_number}}-' # Requires a fresh cache entry each run secrets: inherit
skip-dist: ${{ needs.determine-suite.outputs.suite == 'full' }}
caching-config:
needs: [determine-suite, build-distribution]
uses: ./.github/workflows/integ-test-caching-config.yml
with:
runner-os: '${{ needs.determine-suite.outputs.runner-os }}'
cache-key-prefix: '${{ needs.determine-suite.outputs.cache-key-prefix }}-'
skip-dist: ${{ needs.determine-suite.outputs.suite == 'full' }}
dependency-graph:
if: ${{ ! github.event.pull_request.head.repo.fork }}
needs: [determine-suite, build-distribution]
uses: ./.github/workflows/integ-test-dependency-graph.yml
permissions:
contents: write
with:
runner-os: '${{ needs.determine-suite.outputs.runner-os }}'
cache-key-prefix: '${{ needs.determine-suite.outputs.cache-key-prefix }}-'
skip-dist: ${{ needs.determine-suite.outputs.suite == 'full' }}
dependency-submission:
if: ${{ ! github.event.pull_request.head.repo.fork }}
needs: [determine-suite, build-distribution]
uses: ./.github/workflows/integ-test-dependency-submission.yml
permissions:
contents: write
with:
runner-os: '${{ needs.determine-suite.outputs.runner-os }}'
cache-key-prefix: '${{ needs.determine-suite.outputs.cache-key-prefix }}-'
skip-dist: ${{ needs.determine-suite.outputs.suite == 'full' }}
dependency-submission-failures:
if: ${{ ! github.event.pull_request.head.repo.fork }}
needs: [determine-suite, build-distribution]
uses: ./.github/workflows/integ-test-dependency-submission-failures.yml
permissions:
contents: write
with:
runner-os: '${{ needs.determine-suite.outputs.runner-os }}'
cache-key-prefix: '${{ needs.determine-suite.outputs.cache-key-prefix }}-'
skip-dist: ${{ needs.determine-suite.outputs.suite == 'full' }}
develocity-injection:
if: ${{ ! github.event.pull_request.head.repo.fork }}
needs: [determine-suite, build-distribution]
uses: ./.github/workflows/integ-test-inject-develocity.yml
with:
runner-os: '["ubuntu-latest"]'
cache-key-prefix: '${{ needs.determine-suite.outputs.cache-key-prefix }}-'
skip-dist: ${{ needs.determine-suite.outputs.suite == 'full' }}
secrets:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DV_SOLUTIONS_ACCESS_KEY }}
provision-gradle-versions:
needs: [determine-suite, build-distribution]
uses: ./.github/workflows/integ-test-provision-gradle-versions.yml
with:
runner-os: '["ubuntu-latest"]'
cache-key-prefix: '${{ needs.determine-suite.outputs.cache-key-prefix }}-'
skip-dist: ${{ needs.determine-suite.outputs.suite == 'full' }}
restore-configuration-cache:
if: ${{ ! github.event.pull_request.head.repo.fork }}
needs: [determine-suite, build-distribution]
uses: ./.github/workflows/integ-test-restore-configuration-cache.yml
with:
runner-os: '["ubuntu-latest"]'
cache-key-prefix: '${{ needs.determine-suite.outputs.cache-key-prefix }}-'
skip-dist: ${{ needs.determine-suite.outputs.suite == 'full' }}
secrets:
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
restore-containerized-gradle-home:
needs: [determine-suite, build-distribution]
uses: ./.github/workflows/integ-test-restore-containerized-gradle-home.yml
with:
cache-key-prefix: '${{ needs.determine-suite.outputs.cache-key-prefix }}-'
skip-dist: ${{ needs.determine-suite.outputs.suite == 'full' }}
restore-custom-gradle-home:
needs: [determine-suite, build-distribution]
uses: ./.github/workflows/integ-test-restore-custom-gradle-home.yml
with:
cache-key-prefix: '${{ needs.determine-suite.outputs.cache-key-prefix }}-'
skip-dist: ${{ needs.determine-suite.outputs.suite == 'full' }}
restore-gradle-home:
needs: [determine-suite, build-distribution]
uses: ./.github/workflows/integ-test-restore-gradle-home.yml
with:
runner-os: '["ubuntu-latest"]'
cache-key-prefix: '${{ needs.determine-suite.outputs.cache-key-prefix }}-'
skip-dist: ${{ needs.determine-suite.outputs.suite == 'full' }}
restore-java-toolchain:
needs: [determine-suite, build-distribution]
uses: ./.github/workflows/integ-test-restore-java-toolchain.yml
with:
runner-os: '["ubuntu-latest"]'
cache-key-prefix: '${{ needs.determine-suite.outputs.cache-key-prefix }}-'
skip-dist: ${{ needs.determine-suite.outputs.suite == 'full' }}
sample-kotlin-dsl:
needs: [determine-suite, build-distribution]
uses: ./.github/workflows/integ-test-sample-kotlin-dsl.yml
with:
runner-os: '["ubuntu-latest"]'
cache-key-prefix: '${{ needs.determine-suite.outputs.cache-key-prefix }}-'
skip-dist: ${{ needs.determine-suite.outputs.suite == 'full' }}
sample-gradle-plugin:
needs: [determine-suite, build-distribution]
uses: ./.github/workflows/integ-test-sample-gradle-plugin.yml
with:
runner-os: '["ubuntu-latest"]'
cache-key-prefix: '${{ needs.determine-suite.outputs.cache-key-prefix }}-'
skip-dist: ${{ needs.determine-suite.outputs.suite == 'full' }}
toolchain-detection:
needs: [determine-suite, build-distribution]
uses: ./.github/workflows/integ-test-detect-java-toolchains.yml
with:
runner-os: '["ubuntu-latest"]'
cache-key-prefix: '${{ needs.determine-suite.outputs.cache-key-prefix }}-'
skip-dist: ${{ needs.determine-suite.outputs.suite == 'full' }}
wrapper-validation:
needs: [determine-suite, build-distribution]
uses: ./.github/workflows/integ-test-wrapper-validation.yml
with:
runner-os: '["ubuntu-latest"]'
skip-dist: ${{ needs.determine-suite.outputs.suite == 'full' }}

View File

@@ -5,9 +5,10 @@ on:
inputs: inputs:
cache-key-prefix: cache-key-prefix:
type: string type: string
default: '0'
runner-os: runner-os:
type: string type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]' default: '["ubuntu-latest"]'
skip-dist: skip-dist:
type: boolean type: boolean
default: false default: false

View File

@@ -5,19 +5,21 @@ on:
inputs: inputs:
cache-key-prefix: cache-key-prefix:
type: string type: string
default: '0'
runner-os: runner-os:
type: string type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]' default: '["ubuntu-latest"]'
skip-dist: skip-dist:
type: boolean type: boolean
default: false default: false
env: env:
SKIP_DIST: ${{ inputs.skip-dist }} SKIP_DIST: ${{ inputs.skip-dist }}
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: cache-cleanup-${{ inputs.cache-key-prefix }} # Requires a fresh cache entry each run
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: cache-cleanup-${{ inputs.cache-key-prefix }}-${{github.run_number}}
jobs: jobs:
full-build: cache-cleanup-full-build:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -38,8 +40,8 @@ jobs:
run: ./gradlew --no-daemon --build-cache -Dcommons_math3_version="3.1" build run: ./gradlew --no-daemon --build-cache -Dcommons_math3_version="3.1" build
# Second build will use the cache from the first build, but cleanup should remove unused artifacts # Second build will use the cache from the first build, but cleanup should remove unused artifacts
assemble-build: cache-cleanup-assemble-build:
needs: full-build needs: cache-cleanup-full-build
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -60,8 +62,8 @@ jobs:
working-directory: sources/test/jest/resources/cache-cleanup working-directory: sources/test/jest/resources/cache-cleanup
run: ./gradlew --no-daemon --build-cache -Dcommons_math3_version="3.1.1" build run: ./gradlew --no-daemon --build-cache -Dcommons_math3_version="3.1.1" build
check-clean-cache: cache-cleanup-check-clean-cache:
needs: assemble-build needs: cache-cleanup-assemble-build
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:

View File

@@ -5,9 +5,10 @@ on:
inputs: inputs:
cache-key-prefix: cache-key-prefix:
type: string type: string
default: '0'
runner-os: runner-os:
type: string type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]' default: '["ubuntu-latest"]'
skip-dist: skip-dist:
type: boolean type: boolean
default: false default: false
@@ -17,7 +18,7 @@ env:
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: caching-config-${{ inputs.cache-key-prefix }} GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: caching-config-${{ inputs.cache-key-prefix }}
jobs: jobs:
seed-build: caching-config-seed-build:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -46,8 +47,8 @@ jobs:
run: ./gradlew test run: ./gradlew test
# Test that the gradle-user-home cache will cache dependencies, by running build with --offline # Test that the gradle-user-home cache will cache dependencies, by running build with --offline
verify-build: caching-config-verify-build:
needs: seed-build needs: caching-config-seed-build
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -75,7 +76,7 @@ jobs:
run: ./gradlew test --offline run: ./gradlew test --offline
# Test that build scans are captured when caching is explicitly disabled # Test that build scans are captured when caching is explicitly disabled
cache-disabled: caching-config-cache-disabled:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -103,7 +104,7 @@ jobs:
core.setFailed('No Build Scan detected') core.setFailed('No Build Scan detected')
# Test that build scans are captured when caching is disabled because Gradle User Home already exists # Test that build scans are captured when caching is disabled because Gradle User Home already exists
cache-disabled-pre-existing-gradle-home: caching-config-cache-disabled-pre-existing-gradle-home:
runs-on: ubuntu-latest # This test only runs on Ubuntu runs-on: ubuntu-latest # This test only runs on Ubuntu
steps: steps:
- name: Checkout sources - name: Checkout sources
@@ -127,9 +128,9 @@ jobs:
core.setFailed('No Build Scan detected') core.setFailed('No Build Scan detected')
# Test seed the cache with cache-write-only and verify with cache-read-only # Test seed the cache with cache-write-only and verify with cache-read-only
seed-build-write-only: caching-config-seed-write-only:
env: env:
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{ inputs.cache-key-prefix }}-write-only- GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: caching-config-write-only-${{ inputs.cache-key-prefix }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -149,10 +150,10 @@ jobs:
working-directory: .github/workflow-samples/groovy-dsl working-directory: .github/workflow-samples/groovy-dsl
run: ./gradlew test run: ./gradlew test
verify-write-only-build: caching-config-verify-write-only:
env: env:
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{ inputs.cache-key-prefix }}-write-only- GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: caching-config-write-only-${{ inputs.cache-key-prefix }}
needs: seed-build-write-only needs: caching-config-seed-write-only
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:

View File

@@ -5,9 +5,10 @@ on:
inputs: inputs:
cache-key-prefix: cache-key-prefix:
type: string type: string
default: '0'
runner-os: runner-os:
type: string type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]' default: '["ubuntu-latest"]'
skip-dist: skip-dist:
type: boolean type: boolean
default: false default: false
@@ -21,7 +22,7 @@ env:
GITHUB_DEPENDENCY_GRAPH_REF: 'refs/tags/v0.0.1' # Use a different ref to avoid updating the real dependency graph for the repository GITHUB_DEPENDENCY_GRAPH_REF: 'refs/tags/v0.0.1' # Use a different ref to avoid updating the real dependency graph for the repository
jobs: jobs:
groovy-upload: dependency-graph-groovy-upload:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -41,8 +42,8 @@ jobs:
run: ./gradlew build run: ./gradlew build
working-directory: .github/workflow-samples/groovy-dsl working-directory: .github/workflow-samples/groovy-dsl
groovy-submit: dependency-graph-groovy-submit:
needs: [groovy-upload] needs: [dependency-graph-groovy-upload]
runs-on: "ubuntu-latest" runs-on: "ubuntu-latest"
steps: steps:
- name: Checkout sources - name: Checkout sources
@@ -57,7 +58,7 @@ jobs:
env: env:
DEPENDENCY_GRAPH_DOWNLOAD_ARTIFACT_NAME: groovy-upload DEPENDENCY_GRAPH_DOWNLOAD_ARTIFACT_NAME: groovy-upload
kotlin-generate-and-submit: dependency-graph-kotlin-generate-and-submit:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -77,7 +78,7 @@ jobs:
run: ./gradlew build run: ./gradlew build
working-directory: .github/workflow-samples/kotlin-dsl working-directory: .github/workflow-samples/kotlin-dsl
multiple-builds: dependency-graph-multiple-builds:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -122,7 +123,7 @@ jobs:
exit 1 exit 1
fi fi
config-cache: dependency-graph-config-cache:
runs-on: ubuntu-latest # Test is not compatible with Windows runs-on: ubuntu-latest # Test is not compatible with Windows
steps: steps:
- name: Checkout sources - name: Checkout sources

View File

@@ -5,6 +5,7 @@ on:
inputs: inputs:
cache-key-prefix: cache-key-prefix:
type: string type: string
default: '0'
runner-os: runner-os:
type: string type: string
default: '["ubuntu-latest"]' default: '["ubuntu-latest"]'
@@ -18,7 +19,7 @@ env:
GITHUB_DEPENDENCY_GRAPH_REF: 'refs/tags/v0.0.1' # Use a different ref to avoid updating the real dependency graph for the repository GITHUB_DEPENDENCY_GRAPH_REF: 'refs/tags/v0.0.1' # Use a different ref to avoid updating the real dependency graph for the repository
jobs: jobs:
failing-build: dependency-submission-failures-failing-build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout sources - name: Checkout sources
@@ -47,7 +48,7 @@ jobs:
exit 1 exit 1
fi fi
unsupported-gradle-version: dependency-submission-failures-unsupported-gradle-version:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout sources - name: Checkout sources
@@ -76,7 +77,7 @@ jobs:
exit 1 exit 1
fi fi
insufficient-permissions: dependency-submission-failures-insufficient-permissions:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: read contents: read

View File

@@ -5,9 +5,10 @@ on:
inputs: inputs:
cache-key-prefix: cache-key-prefix:
type: string type: string
default: '0'
runner-os: runner-os:
type: string type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]' default: '["ubuntu-latest"]'
skip-dist: skip-dist:
type: boolean type: boolean
default: false default: false
@@ -21,7 +22,7 @@ env:
GITHUB_DEPENDENCY_GRAPH_REF: 'refs/tags/v0.0.1' # Use a different ref to avoid updating the real dependency graph for the repository GITHUB_DEPENDENCY_GRAPH_REF: 'refs/tags/v0.0.1' # Use a different ref to avoid updating the real dependency graph for the repository
jobs: jobs:
groovy-generate-and-upload: dependency-submission-groovy-generate-and-upload:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -42,8 +43,8 @@ jobs:
env: env:
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: groovy-dependency-submission GRADLE_BUILD_ACTION_CACHE_KEY_JOB: groovy-dependency-submission
groovy-restore-cache: dependency-submission-groovy-restore-cache:
needs: [groovy-generate-and-upload] needs: [dependency-submission-groovy-generate-and-upload]
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -63,8 +64,8 @@ jobs:
env: env:
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: groovy-dependency-submission GRADLE_BUILD_ACTION_CACHE_KEY_JOB: groovy-dependency-submission
groovy-download-and-submit: dependency-submission-groovy-download-and-submit:
needs: [groovy-generate-and-upload] needs: [dependency-submission-groovy-generate-and-upload]
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -83,7 +84,7 @@ jobs:
env: env:
DEPENDENCY_GRAPH_DOWNLOAD_ARTIFACT_NAME: groovy-generate-and-upload-${{ matrix.os }} DEPENDENCY_GRAPH_DOWNLOAD_ARTIFACT_NAME: groovy-generate-and-upload-${{ matrix.os }}
kotlin-generate-and-submit: dependency-submission-kotlin-generate-and-submit:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -100,7 +101,7 @@ jobs:
with: with:
build-root-directory: .github/workflow-samples/kotlin-dsl build-root-directory: .github/workflow-samples/kotlin-dsl
multiple-builds: dependency-submission-multiple-builds:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -145,7 +146,7 @@ jobs:
exit 1 exit 1
fi fi
multiple-builds-upload: dependency-submission-multiple-builds-upload:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -168,7 +169,7 @@ jobs:
dependency-graph: generate-and-upload dependency-graph: generate-and-upload
build-root-directory: .github/workflow-samples/groovy-dsl build-root-directory: .github/workflow-samples/groovy-dsl
config-cache: dependency-submission-config-cache:
runs-on: ubuntu-latest # Test is not compatible with Windows runs-on: ubuntu-latest # Test is not compatible with Windows
steps: steps:
- name: Checkout sources - name: Checkout sources
@@ -203,7 +204,7 @@ jobs:
exit 1 exit 1
fi fi
gradle-versions: dependency-submission-gradle-versions:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -227,7 +228,7 @@ jobs:
gradle-version: ${{ matrix.gradle }} gradle-version: ${{ matrix.gradle }}
build-root-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }} build-root-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
with-setup-gradle: dependency-submission-with-setup-gradle:
runs-on: ubuntu-latest # Test is not compatible with Windows runs-on: ubuntu-latest # Test is not compatible with Windows
steps: steps:
- name: Checkout sources - name: Checkout sources
@@ -262,7 +263,7 @@ jobs:
exit 1 exit 1
fi fi
with-includes-and-excludes: dependency-submission-with-includes-and-excludes:
runs-on: ubuntu-latest # Test is not compatible with Windows runs-on: ubuntu-latest # Test is not compatible with Windows
steps: steps:
- name: Checkout sources - name: Checkout sources
@@ -296,7 +297,7 @@ jobs:
fi fi
custom-report-dir-submit: dependency-submission-custom-report-dir-submit:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -330,7 +331,7 @@ jobs:
exit 1 exit 1
fi fi
custom-report-dir-upload: dependency-submission-custom-report-dir-upload:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout sources - name: Checkout sources
@@ -347,7 +348,7 @@ jobs:
build-root-directory: .github/workflow-samples/groovy-dsl build-root-directory: .github/workflow-samples/groovy-dsl
custom-report-dir-download-and-submit: custom-report-dir-download-and-submit:
needs: custom-report-dir-upload needs: [dependency-submission-custom-report-dir-upload]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout sources - name: Checkout sources

View File

@@ -5,9 +5,10 @@ on:
inputs: inputs:
cache-key-prefix: cache-key-prefix:
type: string type: string
default: '0'
runner-os: runner-os:
type: string type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]' default: '["ubuntu-latest"]'
skip-dist: skip-dist:
type: boolean type: boolean
default: false default: false
@@ -18,7 +19,7 @@ env:
jobs: jobs:
# Test that pre-installed runner JDKs are detected # Test that pre-installed runner JDKs are detected
pre-installed-toolchains: detect-toolchains-pre-installed-jdks:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -48,7 +49,7 @@ jobs:
grep -q 'Eclipse Temurin JDK 21' output.txt || (echo "::error::Did not detect preinstalled JDK 21" && exit 1) grep -q 'Eclipse Temurin JDK 21' output.txt || (echo "::error::Did not detect preinstalled JDK 21" && exit 1)
# Test that JDKs provisioned by setup-java are detected # Test that JDKs provisioned by setup-java are detected
setup-java-installed-toolchain: detect-toolchains-setup-java-jdks:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:

View File

@@ -5,9 +5,10 @@ on:
inputs: inputs:
cache-key-prefix: cache-key-prefix:
type: string type: string
default: '0'
runner-os: runner-os:
type: string type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]' default: '["ubuntu-latest"]'
skip-dist: skip-dist:
type: boolean type: boolean
default: false default: false

View File

@@ -5,9 +5,10 @@ on:
inputs: inputs:
cache-key-prefix: cache-key-prefix:
type: string type: string
default: '0'
runner-os: runner-os:
type: string type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]' default: '["ubuntu-latest"]'
skip-dist: skip-dist:
type: boolean type: boolean
default: false default: false
@@ -69,7 +70,7 @@ jobs:
script: | script: |
core.setFailed('Gradle version parameter not set correctly: value was "${{ steps.gradle-current.outputs.gradle-version }}"') core.setFailed('Gradle version parameter not set correctly: value was "${{ steps.gradle-current.outputs.gradle-version }}"')
gradle-versions: provision-gradle-version:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:

View File

@@ -5,9 +5,10 @@ on:
inputs: inputs:
cache-key-prefix: cache-key-prefix:
type: string type: string
default: '0'
runner-os: runner-os:
type: string type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]' default: '["ubuntu-latest"]'
skip-dist: skip-dist:
type: boolean type: boolean
default: false default: false
@@ -20,7 +21,7 @@ env:
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-configuration-cache-${{ inputs.cache-key-prefix }} GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-configuration-cache-${{ inputs.cache-key-prefix }}
jobs: jobs:
seed-build-groovy: restore-cc-seed-build-groovy:
env: env:
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-groovy GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-groovy
strategy: strategy:
@@ -50,11 +51,11 @@ jobs:
working-directory: .github/workflow-samples/groovy-dsl working-directory: .github/workflow-samples/groovy-dsl
run: gradle test --configuration-cache run: gradle test --configuration-cache
verify-build-groovy: restore-cc-verify-build-groovy:
env: env:
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-groovy GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-groovy
GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION: ${{github.sha}}_1 GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION: ${{github.sha}}_1
needs: seed-build-groovy needs: restore-cc-seed-build-groovy
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -91,11 +92,11 @@ jobs:
fi fi
# Ensure that cache-cleanup doesn't remove all necessary files # Ensure that cache-cleanup doesn't remove all necessary files
verify-no-cache-cleanup-groovy: restore-cc-verify-no-cache-cleanup-groovy:
env: env:
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-groovy GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-groovy
GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION: ${{github.sha}}_2 GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION: ${{github.sha}}_2
needs: verify-build-groovy needs: restore-cc-verify-build-groovy
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -131,11 +132,11 @@ jobs:
fi fi
# Check that the build can run when no extracted cache entries are restored # Check that the build can run when no extracted cache entries are restored
gradle-user-home-not-fully-restored: restore-cc-gradle-user-home-not-fully-restored:
env: env:
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-groovy GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-groovy
GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION: ${{github.sha}}_x GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION: ${{github.sha}}_x
needs: seed-build-groovy needs: restore-cc-seed-build-groovy
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -164,7 +165,7 @@ jobs:
working-directory: .github/workflow-samples/groovy-dsl working-directory: .github/workflow-samples/groovy-dsl
run: gradle test --configuration-cache run: gradle test --configuration-cache
seed-build-kotlin: restore-cc-seed-build-kotlin:
env: env:
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-kotlin GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-kotlin
strategy: strategy:
@@ -194,11 +195,11 @@ jobs:
working-directory: .github/workflow-samples/kotlin-dsl working-directory: .github/workflow-samples/kotlin-dsl
run: gradle help --configuration-cache run: gradle help --configuration-cache
modify-build-kotlin: restore-cc-modify-build-kotlin:
env: env:
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-kotlin GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-kotlin
GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION: ${{github.sha}}_1 GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION: ${{github.sha}}_1
needs: seed-build-kotlin needs: restore-cc-seed-build-kotlin
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -226,11 +227,11 @@ jobs:
run: gradle test --configuration-cache run: gradle test --configuration-cache
# Test restore configuration-cache from the third build invocation # Test restore configuration-cache from the third build invocation
verify-build-kotlin: restore-cc-verify-build-kotlin:
env: env:
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-kotlin GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-cc-kotlin
GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION: ${{github.sha}}_2 GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION: ${{github.sha}}_2
needs: modify-build-kotlin needs: restore-cc-modify-build-kotlin
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:

View File

@@ -5,6 +5,7 @@ on:
inputs: inputs:
cache-key-prefix: cache-key-prefix:
type: string type: string
default: '0'
skip-dist: skip-dist:
type: boolean type: boolean
default: false default: false
@@ -14,7 +15,7 @@ env:
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-containerized-gradle-home-${{ inputs.cache-key-prefix }} GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-containerized-gradle-home-${{ inputs.cache-key-prefix }}
jobs: jobs:
seed-build: restore-containerized-seed-build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: fedora:latest container: fedora:latest
steps: steps:
@@ -32,8 +33,8 @@ jobs:
run: ./gradlew test run: ./gradlew test
# Test that the gradle-user-home cache will cache dependencies, by running build with --offline # Test that the gradle-user-home cache will cache dependencies, by running build with --offline
dependencies-cache: restore-containerized-dependencies-cache:
needs: seed-build needs: restore-containerized-seed-build
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: fedora:latest container: fedora:latest
steps: steps:

View File

@@ -5,6 +5,7 @@ on:
inputs: inputs:
cache-key-prefix: cache-key-prefix:
type: string type: string
default: '0'
skip-dist: skip-dist:
type: boolean type: boolean
default: false default: false
@@ -14,7 +15,7 @@ env:
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-custom-gradle-home-${{ inputs.cache-key-prefix }} GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-custom-gradle-home-${{ inputs.cache-key-prefix }}
jobs: jobs:
seed-build: restore-custom-gradle-home-seed-build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout sources - name: Checkout sources
@@ -35,8 +36,8 @@ jobs:
run: ./gradlew test --info run: ./gradlew test --info
# Test that the gradle-user-home cache will cache dependencies, by running build with --offline # Test that the gradle-user-home cache will cache dependencies, by running build with --offline
dependencies-cache: restore-custom-gradle-home-dependencies-cache:
needs: seed-build needs: restore-custom-gradle-home-seed-build
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout sources - name: Checkout sources
@@ -57,8 +58,8 @@ jobs:
run: ./gradlew test --offline --info run: ./gradlew test --offline --info
# Test that the gradle-user-home cache will cache and restore local build-cache # Test that the gradle-user-home cache will cache and restore local build-cache
build-cache: restore-custom-gradle-home-build-cache:
needs: seed-build needs: restore-custom-gradle-home-seed-build
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout sources - name: Checkout sources

View File

@@ -5,9 +5,10 @@ on:
inputs: inputs:
cache-key-prefix: cache-key-prefix:
type: string type: string
default: '0'
runner-os: runner-os:
type: string type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]' default: '["ubuntu-latest"]'
skip-dist: skip-dist:
type: boolean type: boolean
default: false default: false
@@ -18,7 +19,7 @@ env:
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-gradle-home GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-gradle-home
jobs: jobs:
seed-build: restore-gradle-home-seed-build:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -39,8 +40,8 @@ jobs:
run: ./gradlew test run: ./gradlew test
# Test that the gradle-user-home cache will cache dependencies, by running build with --offline # Test that the gradle-user-home cache will cache dependencies, by running build with --offline
dependencies-cache: restore-gradle-home-dependencies-cache:
needs: seed-build needs: restore-gradle-home-seed-build
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -61,8 +62,8 @@ jobs:
run: ./gradlew test --offline run: ./gradlew test --offline
# Test that the gradle-user-home cache will cache and restore local build-cache # Test that the gradle-user-home cache will cache and restore local build-cache
build-cache: restore-gradle-home-build-cache:
needs: seed-build needs: restore-gradle-home-seed-build
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -83,8 +84,8 @@ jobs:
run: ./gradlew test -DverifyCachedBuild=true run: ./gradlew test -DverifyCachedBuild=true
# Check that the build can run when Gradle User Home is not fully restored # Check that the build can run when Gradle User Home is not fully restored
no-extracted-cache-entries-restored: restore-gradle-home-no-extracted-cache-entries-restored:
needs: seed-build needs: restore-gradle-home-seed-build
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -107,8 +108,8 @@ jobs:
run: ./gradlew test run: ./gradlew test
# Test that a pre-existing gradle-user-home can be overwritten by the restored cache # Test that a pre-existing gradle-user-home can be overwritten by the restored cache
pre-existing-gradle-home: restore-gradle-home-pre-existing-gradle-home:
needs: seed-build needs: restore-gradle-home-seed-build
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:

View File

@@ -5,9 +5,10 @@ on:
inputs: inputs:
cache-key-prefix: cache-key-prefix:
type: string type: string
default: '0'
runner-os: runner-os:
type: string type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]' default: '["ubuntu-latest"]'
skip-dist: skip-dist:
type: boolean type: boolean
default: false default: false
@@ -17,7 +18,7 @@ env:
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-java-toolchain-${{ inputs.cache-key-prefix }} GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-java-toolchain-${{ inputs.cache-key-prefix }}
jobs: jobs:
seed-build: restore-java-toolchain-seed-build:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -38,8 +39,8 @@ jobs:
run: ./gradlew test --info run: ./gradlew test --info
# Test that the gradle-user-home cache will cache the toolchain, by running build with --offline # Test that the gradle-user-home cache will cache the toolchain, by running build with --offline
toolchain-cache: restore-java-toolchain-verify-build:
needs: seed-build needs: restore-java-toolchain-seed-build
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:

View File

@@ -5,9 +5,10 @@ on:
inputs: inputs:
cache-key-prefix: cache-key-prefix:
type: string type: string
default: '0'
runner-os: runner-os:
type: string type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]' default: '["ubuntu-latest"]'
skip-dist: skip-dist:
type: boolean type: boolean
default: false default: false
@@ -17,7 +18,7 @@ env:
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: sample-gradle-plugin-${{ inputs.cache-key-prefix }} GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: sample-gradle-plugin-${{ inputs.cache-key-prefix }}
jobs: jobs:
seed-build: sample-gradle-plugin-seed-build:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -37,8 +38,8 @@ jobs:
working-directory: .github/workflow-samples/gradle-plugin working-directory: .github/workflow-samples/gradle-plugin
run: ./gradlew build run: ./gradlew build
verify-build: sample-gradle-plugin-verify-build:
needs: seed-build needs: sample-gradle-plugin-seed-build
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:

View File

@@ -5,9 +5,10 @@ on:
inputs: inputs:
cache-key-prefix: cache-key-prefix:
type: string type: string
default: '0'
runner-os: runner-os:
type: string type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]' default: '["ubuntu-latest"]'
skip-dist: skip-dist:
type: boolean type: boolean
default: false default: false
@@ -17,7 +18,7 @@ env:
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: sample-kotlin-dsl-${{ inputs.cache-key-prefix }} GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: sample-kotlin-dsl-${{ inputs.cache-key-prefix }}
jobs: jobs:
seed-build: sample-kotlin-dsl-seed-build:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -37,8 +38,8 @@ jobs:
working-directory: .github/workflow-samples/kotlin-dsl working-directory: .github/workflow-samples/kotlin-dsl
run: ./gradlew build run: ./gradlew build
verify-build: sample-kotlin-dsl-verify-build:
needs: seed-build needs: sample-kotlin-dsl-seed-build
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:

View File

@@ -5,7 +5,7 @@ on:
inputs: inputs:
runner-os: runner-os:
type: string type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]' default: '["ubuntu-latest"]'
skip-dist: skip-dist:
type: boolean type: boolean
default: false default: false
@@ -14,7 +14,7 @@ env:
SKIP_DIST: ${{ inputs.skip-dist }} SKIP_DIST: ${{ inputs.skip-dist }}
jobs: jobs:
test-setup-gradle-validation: wrapper-validation-setup-gradle:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -34,13 +34,14 @@ jobs:
continue-on-error: true continue-on-error: true
- name: Check failure - name: Check failure
shell: bash
run: | run: |
if [ "${{ steps.setup-gradle.outcome}}" != "failure" ] ; then if [ "${{ steps.setup-gradle.outcome}}" != "failure" ] ; then
echo "Expected validation to fail, but it didn't" echo "Expected validation to fail, but it didn't"
exit 1 exit 1
fi fi
test-validation-success: wrapper-validation-success:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout sources - name: Checkout sources
@@ -54,6 +55,7 @@ jobs:
with: with:
# to allow the invalid wrapper jar present in test data # to allow the invalid wrapper jar present in test data
allow-checksums: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 allow-checksums: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
min-wrapper-count: 10
- name: Check outcome - name: Check outcome
env: env:
@@ -61,13 +63,14 @@ jobs:
# below to not accidentally inject code into shell script or break its syntax # below to not accidentally inject code into shell script or break its syntax
FAILED_WRAPPERS: ${{ steps.action-test.outputs.failed-wrapper }} FAILED_WRAPPERS: ${{ steps.action-test.outputs.failed-wrapper }}
FAILED_WRAPPERS_MATCHES: ${{ steps.action-test.outputs.failed-wrapper == '' }} FAILED_WRAPPERS_MATCHES: ${{ steps.action-test.outputs.failed-wrapper == '' }}
shell: bash
run: | run: |
if [ "$FAILED_WRAPPERS_MATCHES" != "true" ] ; then if [ "$FAILED_WRAPPERS_MATCHES" != "true" ] ; then
echo "'outputs.failed-wrapper' has unexpected content: $FAILED_WRAPPERS" echo "'outputs.failed-wrapper' has unexpected content: $FAILED_WRAPPERS"
exit 1 exit 1
fi fi
test-validation-error: wrapper-validation-error:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout sources - name: Checkout sources
@@ -88,6 +91,7 @@ jobs:
VALIDATION_FAILED: ${{ steps.action-test.outcome == 'failure' }} VALIDATION_FAILED: ${{ steps.action-test.outcome == 'failure' }}
FAILED_WRAPPERS: ${{ steps.action-test.outputs.failed-wrapper }} FAILED_WRAPPERS: ${{ steps.action-test.outputs.failed-wrapper }}
FAILED_WRAPPERS_MATCHES: ${{ steps.action-test.outputs.failed-wrapper == 'sources/test/jest/wrapper-validation/data/invalid/gradle-wrapper.jar|sources/test/jest/wrapper-validation/data/invalid/gradlе-wrapper.jar' }} FAILED_WRAPPERS_MATCHES: ${{ steps.action-test.outputs.failed-wrapper == 'sources/test/jest/wrapper-validation/data/invalid/gradle-wrapper.jar|sources/test/jest/wrapper-validation/data/invalid/gradlе-wrapper.jar' }}
shell: bash
run: | run: |
if [ "$VALIDATION_FAILED" != "true" ] ; then if [ "$VALIDATION_FAILED" != "true" ] ; then
echo "Expected validation to fail, but it didn't" echo "Expected validation to fail, but it didn't"
@@ -98,3 +102,64 @@ jobs:
echo "'outputs.failed-wrapper' has unexpected content: $FAILED_WRAPPERS" echo "'outputs.failed-wrapper' has unexpected content: $FAILED_WRAPPERS"
exit 1 exit 1
fi fi
wrapper-validation-minimum-wrapper-count:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Initialize integ-test
uses: ./.github/actions/init-integ-test
- name: Run wrapper-validation-action
id: action-test
uses: ./wrapper-validation
with:
# to allow the invalid wrapper jar present in test data
allow-checksums: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
min-wrapper-count: 11
# Expected to fail; validated below
continue-on-error: true
- name: Check outcome
env:
# Evaluate workflow expressions here as env variable values instead of inside shell script
# below to not accidentally inject code into shell script or break its syntax
VALIDATION_FAILED: ${{ steps.action-test.outcome == 'failure' }}
shell: bash
run: |
if [ "$VALIDATION_FAILED" != "true" ] ; then
echo "Expected validation to fail, but it didn't"
exit 1
fi
wrapper-validation-zero-wrappers:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4 # Checkout the repository with no wrappers
with:
sparse-checkout: |
.github/actions
dist
wrapper-validation
- name: Initialize integ-test
uses: ./.github/actions/init-integ-test
- name: Run wrapper-validation-action
id: action-test
uses: ./wrapper-validation
# Expected to fail; validated below
continue-on-error: true
- name: Check outcome
env:
# Evaluate workflow expressions here as env variable values instead of inside shell script
# below to not accidentally inject code into shell script or break its syntax
VALIDATION_FAILED: ${{ steps.action-test.outcome == 'failure' }}
shell: bash
run: |
if [ "$VALIDATION_FAILED" != "true" ] ; then
echo "Expected validation to fail, but it didn't"
exit 1
fi

View File

@@ -0,0 +1,52 @@
name: suite-integ-test-caching
on:
workflow_call:
inputs:
runner-os:
type: string
default: '["ubuntu-latest"]'
skip-dist:
type: boolean
default: false
jobs:
cache-cleanup:
uses: ./.github/workflows/integ-test-cache-cleanup.yml
with:
runner-os: '${{ inputs.runner-os }}'
skip-dist: ${{ inputs.skip-dist }}
caching-config:
uses: ./.github/workflows/integ-test-caching-config.yml
with:
runner-os: '${{ inputs.runner-os }}'
skip-dist: ${{ inputs.skip-dist }}
restore-configuration-cache:
if: ${{ ! github.event.pull_request.head.repo.fork }}
uses: ./.github/workflows/integ-test-restore-configuration-cache.yml
with:
skip-dist: ${{ inputs.skip-dist }}
secrets:
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
restore-containerized-gradle-home:
uses: ./.github/workflows/integ-test-restore-containerized-gradle-home.yml
with:
skip-dist: ${{ inputs.skip-dist }}
restore-custom-gradle-home:
uses: ./.github/workflows/integ-test-restore-custom-gradle-home.yml
with:
skip-dist: ${{ inputs.skip-dist }}
restore-gradle-home:
uses: ./.github/workflows/integ-test-restore-gradle-home.yml
with:
skip-dist: ${{ inputs.skip-dist }}
restore-java-toolchain:
uses: ./.github/workflows/integ-test-restore-java-toolchain.yml
with:
skip-dist: ${{ inputs.skip-dist }}

View File

@@ -0,0 +1,82 @@
name: suite-integ-test-other
on:
workflow_call:
inputs:
runner-os:
type: string
default: '["ubuntu-latest"]'
skip-dist:
type: boolean
default: false
jobs:
build-scan-publish:
uses: ./.github/workflows/integ-test-build-scan-publish.yml
with:
runner-os: '${{ inputs.runner-os }}'
skip-dist: ${{ inputs.skip-dist }}
dependency-graph:
if: ${{ ! github.event.pull_request.head.repo.fork }}
uses: ./.github/workflows/integ-test-dependency-graph.yml
permissions:
contents: write
with:
runner-os: '${{ inputs.runner-os }}'
skip-dist: ${{ inputs.skip-dist }}
dependency-submission:
if: ${{ ! github.event.pull_request.head.repo.fork }}
uses: ./.github/workflows/integ-test-dependency-submission.yml
permissions:
contents: write
with:
runner-os: '${{ inputs.runner-os }}'
skip-dist: ${{ inputs.skip-dist }}
dependency-submission-failures:
if: ${{ ! github.event.pull_request.head.repo.fork }}
uses: ./.github/workflows/integ-test-dependency-submission-failures.yml
permissions:
contents: write
with:
runner-os: '${{ inputs.runner-os }}'
skip-dist: ${{ inputs.skip-dist }}
develocity-injection:
if: ${{ ! github.event.pull_request.head.repo.fork }}
uses: ./.github/workflows/integ-test-inject-develocity.yml
with:
skip-dist: ${{ inputs.skip-dist }}
secrets:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DV_SOLUTIONS_ACCESS_KEY }}
provision-gradle-versions:
uses: ./.github/workflows/integ-test-provision-gradle-versions.yml
with:
runner-os: '${{ inputs.runner-os }}'
skip-dist: ${{ inputs.skip-dist }}
sample-kotlin-dsl:
uses: ./.github/workflows/integ-test-sample-kotlin-dsl.yml
with:
runner-os: '${{ inputs.runner-os }}'
skip-dist: ${{ inputs.skip-dist }}
sample-gradle-plugin:
uses: ./.github/workflows/integ-test-sample-gradle-plugin.yml
with:
runner-os: '${{ inputs.runner-os }}'
skip-dist: ${{ inputs.skip-dist }}
toolchain-detection:
uses: ./.github/workflows/integ-test-detect-toolchains.yml
with:
skip-dist: ${{ inputs.skip-dist }}
wrapper-validation:
uses: ./.github/workflows/integ-test-wrapper-validation.yml
with:
runner-os: '${{ inputs.runner-os }}'
skip-dist: ${{ inputs.skip-dist }}

View File

@@ -157632,12 +157632,9 @@ const find = __importStar(__nccwpck_require__(849));
const checksums = __importStar(__nccwpck_require__(50907)); const checksums = __importStar(__nccwpck_require__(50907));
const hash = __importStar(__nccwpck_require__(60079)); const hash = __importStar(__nccwpck_require__(60079));
const path_1 = __nccwpck_require__(71017); const path_1 = __nccwpck_require__(71017);
async function findInvalidWrapperJars(gitRepoRoot, minWrapperCount, allowSnapshots, allowedChecksums, previouslyValidatedChecksums = [], knownValidChecksums = checksums.KNOWN_CHECKSUMS) { async function findInvalidWrapperJars(gitRepoRoot, allowSnapshots, allowedChecksums, previouslyValidatedChecksums = [], knownValidChecksums = checksums.KNOWN_CHECKSUMS) {
const wrapperJars = await find.findWrapperJars(gitRepoRoot); const wrapperJars = await find.findWrapperJars(gitRepoRoot);
const result = new ValidationResult([], []); const result = new ValidationResult([], []);
if (wrapperJars.length < minWrapperCount) {
result.errors.push(`Expected to find at least ${minWrapperCount} Gradle Wrapper JARs but got only ${wrapperJars.length}`);
}
if (wrapperJars.length > 0) { if (wrapperJars.length > 0) {
const notYetValidatedWrappers = []; const notYetValidatedWrappers = [];
for (const wrapperJar of wrapperJars) { for (const wrapperJar of wrapperJars) {
@@ -157670,23 +157667,17 @@ exports.findInvalidWrapperJars = findInvalidWrapperJars;
class ValidationResult { class ValidationResult {
constructor(valid, invalid) { constructor(valid, invalid) {
this.fetchedChecksums = false; this.fetchedChecksums = false;
this.errors = [];
this.valid = valid; this.valid = valid;
this.invalid = invalid; this.invalid = invalid;
} }
isValid() { isValid() {
return this.invalid.length === 0 && this.errors.length === 0; return this.invalid.length === 0;
} }
toDisplayString() { toDisplayString() {
let displayString = ''; let displayString = '';
if (this.invalid.length > 0) { if (this.invalid.length > 0) {
displayString += `✗ Found unknown Gradle Wrapper JAR files:\n${ValidationResult.toDisplayList(this.invalid)}`; displayString += `✗ Found unknown Gradle Wrapper JAR files:\n${ValidationResult.toDisplayList(this.invalid)}`;
} }
if (this.errors.length > 0) {
if (displayString.length > 0)
displayString += '\n';
displayString += `✗ Other validation errors:\n ${this.errors.join(`\n `)}`;
}
if (this.valid.length > 0) { if (this.valid.length > 0) {
if (displayString.length > 0) if (displayString.length > 0)
displayString += '\n'; displayString += '\n';
@@ -157754,16 +157745,16 @@ async function validateWrappers(config, workspaceRoot, gradleUserHome) {
const checksumCache = new cache_1.ChecksumCache(gradleUserHome); const checksumCache = new cache_1.ChecksumCache(gradleUserHome);
const allowedChecksums = process.env['ALLOWED_GRADLE_WRAPPER_CHECKSUMS']?.split(',') || []; const allowedChecksums = process.env['ALLOWED_GRADLE_WRAPPER_CHECKSUMS']?.split(',') || [];
const previouslyValidatedChecksums = checksumCache.load(); const previouslyValidatedChecksums = checksumCache.load();
const result = await (0, validate_1.findInvalidWrapperJars)(workspaceRoot, 0, config.allowSnapshotWrappers(), allowedChecksums, previouslyValidatedChecksums); const result = await (0, validate_1.findInvalidWrapperJars)(workspaceRoot, config.allowSnapshotWrappers(), allowedChecksums, previouslyValidatedChecksums);
if (result.isValid()) { if (result.isValid()) {
await core.group('All Gradle Wrapper jars are valid', async () => { await core.group('All Gradle Wrapper jars are valid', async () => {
core.info(`Loaded previously validated checksums from cache: ${previouslyValidatedChecksums.join(', ')}`); core.debug(`Loaded previously validated checksums from cache: ${previouslyValidatedChecksums.join(', ')}`);
core.info(result.toDisplayString()); core.info(result.toDisplayString());
}); });
} }
else { else {
core.info(result.toDisplayString()); core.info(result.toDisplayString());
throw new errors_1.JobFailure(`Gradle Wrapper Validation Failed!\n See https://github.com/gradle/actions/blob/main/docs/wrapper-validation.md#validation-failures\n${result.toDisplayString()}`); throw new errors_1.JobFailure(`At least one Gradle Wrapper Jar failed validation!\n See https://github.com/gradle/actions/blob/main/docs/wrapper-validation.md#validation-failures\n${result.toDisplayString()}`);
} }
checksumCache.save(result.valid.map(wrapper => wrapper.checksum)); checksumCache.save(result.valid.map(wrapper => wrapper.checksum));
} }

File diff suppressed because one or more lines are too long

View File

@@ -111256,12 +111256,9 @@ const find = __importStar(__nccwpck_require__(849));
const checksums = __importStar(__nccwpck_require__(50907)); const checksums = __importStar(__nccwpck_require__(50907));
const hash = __importStar(__nccwpck_require__(60079)); const hash = __importStar(__nccwpck_require__(60079));
const path_1 = __nccwpck_require__(71017); const path_1 = __nccwpck_require__(71017);
async function findInvalidWrapperJars(gitRepoRoot, minWrapperCount, allowSnapshots, allowedChecksums, previouslyValidatedChecksums = [], knownValidChecksums = checksums.KNOWN_CHECKSUMS) { async function findInvalidWrapperJars(gitRepoRoot, allowSnapshots, allowedChecksums, previouslyValidatedChecksums = [], knownValidChecksums = checksums.KNOWN_CHECKSUMS) {
const wrapperJars = await find.findWrapperJars(gitRepoRoot); const wrapperJars = await find.findWrapperJars(gitRepoRoot);
const result = new ValidationResult([], []); const result = new ValidationResult([], []);
if (wrapperJars.length < minWrapperCount) {
result.errors.push(`Expected to find at least ${minWrapperCount} Gradle Wrapper JARs but got only ${wrapperJars.length}`);
}
if (wrapperJars.length > 0) { if (wrapperJars.length > 0) {
const notYetValidatedWrappers = []; const notYetValidatedWrappers = [];
for (const wrapperJar of wrapperJars) { for (const wrapperJar of wrapperJars) {
@@ -111294,23 +111291,17 @@ exports.findInvalidWrapperJars = findInvalidWrapperJars;
class ValidationResult { class ValidationResult {
constructor(valid, invalid) { constructor(valid, invalid) {
this.fetchedChecksums = false; this.fetchedChecksums = false;
this.errors = [];
this.valid = valid; this.valid = valid;
this.invalid = invalid; this.invalid = invalid;
} }
isValid() { isValid() {
return this.invalid.length === 0 && this.errors.length === 0; return this.invalid.length === 0;
} }
toDisplayString() { toDisplayString() {
let displayString = ''; let displayString = '';
if (this.invalid.length > 0) { if (this.invalid.length > 0) {
displayString += `✗ Found unknown Gradle Wrapper JAR files:\n${ValidationResult.toDisplayList(this.invalid)}`; displayString += `✗ Found unknown Gradle Wrapper JAR files:\n${ValidationResult.toDisplayList(this.invalid)}`;
} }
if (this.errors.length > 0) {
if (displayString.length > 0)
displayString += '\n';
displayString += `✗ Other validation errors:\n ${this.errors.join(`\n `)}`;
}
if (this.valid.length > 0) { if (this.valid.length > 0) {
if (displayString.length > 0) if (displayString.length > 0)
displayString += '\n'; displayString += '\n';
@@ -111378,16 +111369,16 @@ async function validateWrappers(config, workspaceRoot, gradleUserHome) {
const checksumCache = new cache_1.ChecksumCache(gradleUserHome); const checksumCache = new cache_1.ChecksumCache(gradleUserHome);
const allowedChecksums = process.env['ALLOWED_GRADLE_WRAPPER_CHECKSUMS']?.split(',') || []; const allowedChecksums = process.env['ALLOWED_GRADLE_WRAPPER_CHECKSUMS']?.split(',') || [];
const previouslyValidatedChecksums = checksumCache.load(); const previouslyValidatedChecksums = checksumCache.load();
const result = await (0, validate_1.findInvalidWrapperJars)(workspaceRoot, 0, config.allowSnapshotWrappers(), allowedChecksums, previouslyValidatedChecksums); const result = await (0, validate_1.findInvalidWrapperJars)(workspaceRoot, config.allowSnapshotWrappers(), allowedChecksums, previouslyValidatedChecksums);
if (result.isValid()) { if (result.isValid()) {
await core.group('All Gradle Wrapper jars are valid', async () => { await core.group('All Gradle Wrapper jars are valid', async () => {
core.info(`Loaded previously validated checksums from cache: ${previouslyValidatedChecksums.join(', ')}`); core.debug(`Loaded previously validated checksums from cache: ${previouslyValidatedChecksums.join(', ')}`);
core.info(result.toDisplayString()); core.info(result.toDisplayString());
}); });
} }
else { else {
core.info(result.toDisplayString()); core.info(result.toDisplayString());
throw new errors_1.JobFailure(`Gradle Wrapper Validation Failed!\n See https://github.com/gradle/actions/blob/main/docs/wrapper-validation.md#validation-failures\n${result.toDisplayString()}`); throw new errors_1.JobFailure(`At least one Gradle Wrapper Jar failed validation!\n See https://github.com/gradle/actions/blob/main/docs/wrapper-validation.md#validation-failures\n${result.toDisplayString()}`);
} }
checksumCache.save(result.valid.map(wrapper => wrapper.checksum)); checksumCache.save(result.valid.map(wrapper => wrapper.checksum));
} }

File diff suppressed because one or more lines are too long

View File

@@ -157562,12 +157562,9 @@ const find = __importStar(__nccwpck_require__(849));
const checksums = __importStar(__nccwpck_require__(50907)); const checksums = __importStar(__nccwpck_require__(50907));
const hash = __importStar(__nccwpck_require__(60079)); const hash = __importStar(__nccwpck_require__(60079));
const path_1 = __nccwpck_require__(71017); const path_1 = __nccwpck_require__(71017);
async function findInvalidWrapperJars(gitRepoRoot, minWrapperCount, allowSnapshots, allowedChecksums, previouslyValidatedChecksums = [], knownValidChecksums = checksums.KNOWN_CHECKSUMS) { async function findInvalidWrapperJars(gitRepoRoot, allowSnapshots, allowedChecksums, previouslyValidatedChecksums = [], knownValidChecksums = checksums.KNOWN_CHECKSUMS) {
const wrapperJars = await find.findWrapperJars(gitRepoRoot); const wrapperJars = await find.findWrapperJars(gitRepoRoot);
const result = new ValidationResult([], []); const result = new ValidationResult([], []);
if (wrapperJars.length < minWrapperCount) {
result.errors.push(`Expected to find at least ${minWrapperCount} Gradle Wrapper JARs but got only ${wrapperJars.length}`);
}
if (wrapperJars.length > 0) { if (wrapperJars.length > 0) {
const notYetValidatedWrappers = []; const notYetValidatedWrappers = [];
for (const wrapperJar of wrapperJars) { for (const wrapperJar of wrapperJars) {
@@ -157600,23 +157597,17 @@ exports.findInvalidWrapperJars = findInvalidWrapperJars;
class ValidationResult { class ValidationResult {
constructor(valid, invalid) { constructor(valid, invalid) {
this.fetchedChecksums = false; this.fetchedChecksums = false;
this.errors = [];
this.valid = valid; this.valid = valid;
this.invalid = invalid; this.invalid = invalid;
} }
isValid() { isValid() {
return this.invalid.length === 0 && this.errors.length === 0; return this.invalid.length === 0;
} }
toDisplayString() { toDisplayString() {
let displayString = ''; let displayString = '';
if (this.invalid.length > 0) { if (this.invalid.length > 0) {
displayString += `✗ Found unknown Gradle Wrapper JAR files:\n${ValidationResult.toDisplayList(this.invalid)}`; displayString += `✗ Found unknown Gradle Wrapper JAR files:\n${ValidationResult.toDisplayList(this.invalid)}`;
} }
if (this.errors.length > 0) {
if (displayString.length > 0)
displayString += '\n';
displayString += `✗ Other validation errors:\n ${this.errors.join(`\n `)}`;
}
if (this.valid.length > 0) { if (this.valid.length > 0) {
if (displayString.length > 0) if (displayString.length > 0)
displayString += '\n'; displayString += '\n';
@@ -157684,16 +157675,16 @@ async function validateWrappers(config, workspaceRoot, gradleUserHome) {
const checksumCache = new cache_1.ChecksumCache(gradleUserHome); const checksumCache = new cache_1.ChecksumCache(gradleUserHome);
const allowedChecksums = process.env['ALLOWED_GRADLE_WRAPPER_CHECKSUMS']?.split(',') || []; const allowedChecksums = process.env['ALLOWED_GRADLE_WRAPPER_CHECKSUMS']?.split(',') || [];
const previouslyValidatedChecksums = checksumCache.load(); const previouslyValidatedChecksums = checksumCache.load();
const result = await (0, validate_1.findInvalidWrapperJars)(workspaceRoot, 0, config.allowSnapshotWrappers(), allowedChecksums, previouslyValidatedChecksums); const result = await (0, validate_1.findInvalidWrapperJars)(workspaceRoot, config.allowSnapshotWrappers(), allowedChecksums, previouslyValidatedChecksums);
if (result.isValid()) { if (result.isValid()) {
await core.group('All Gradle Wrapper jars are valid', async () => { await core.group('All Gradle Wrapper jars are valid', async () => {
core.info(`Loaded previously validated checksums from cache: ${previouslyValidatedChecksums.join(', ')}`); core.debug(`Loaded previously validated checksums from cache: ${previouslyValidatedChecksums.join(', ')}`);
core.info(result.toDisplayString()); core.info(result.toDisplayString());
}); });
} }
else { else {
core.info(result.toDisplayString()); core.info(result.toDisplayString());
throw new errors_1.JobFailure(`Gradle Wrapper Validation Failed!\n See https://github.com/gradle/actions/blob/main/docs/wrapper-validation.md#validation-failures\n${result.toDisplayString()}`); throw new errors_1.JobFailure(`At least one Gradle Wrapper Jar failed validation!\n See https://github.com/gradle/actions/blob/main/docs/wrapper-validation.md#validation-failures\n${result.toDisplayString()}`);
} }
checksumCache.save(result.valid.map(wrapper => wrapper.checksum)); checksumCache.save(result.valid.map(wrapper => wrapper.checksum));
} }

File diff suppressed because one or more lines are too long

View File

@@ -157557,12 +157557,9 @@ const find = __importStar(__nccwpck_require__(849));
const checksums = __importStar(__nccwpck_require__(50907)); const checksums = __importStar(__nccwpck_require__(50907));
const hash = __importStar(__nccwpck_require__(60079)); const hash = __importStar(__nccwpck_require__(60079));
const path_1 = __nccwpck_require__(71017); const path_1 = __nccwpck_require__(71017);
async function findInvalidWrapperJars(gitRepoRoot, minWrapperCount, allowSnapshots, allowedChecksums, previouslyValidatedChecksums = [], knownValidChecksums = checksums.KNOWN_CHECKSUMS) { async function findInvalidWrapperJars(gitRepoRoot, allowSnapshots, allowedChecksums, previouslyValidatedChecksums = [], knownValidChecksums = checksums.KNOWN_CHECKSUMS) {
const wrapperJars = await find.findWrapperJars(gitRepoRoot); const wrapperJars = await find.findWrapperJars(gitRepoRoot);
const result = new ValidationResult([], []); const result = new ValidationResult([], []);
if (wrapperJars.length < minWrapperCount) {
result.errors.push(`Expected to find at least ${minWrapperCount} Gradle Wrapper JARs but got only ${wrapperJars.length}`);
}
if (wrapperJars.length > 0) { if (wrapperJars.length > 0) {
const notYetValidatedWrappers = []; const notYetValidatedWrappers = [];
for (const wrapperJar of wrapperJars) { for (const wrapperJar of wrapperJars) {
@@ -157595,23 +157592,17 @@ exports.findInvalidWrapperJars = findInvalidWrapperJars;
class ValidationResult { class ValidationResult {
constructor(valid, invalid) { constructor(valid, invalid) {
this.fetchedChecksums = false; this.fetchedChecksums = false;
this.errors = [];
this.valid = valid; this.valid = valid;
this.invalid = invalid; this.invalid = invalid;
} }
isValid() { isValid() {
return this.invalid.length === 0 && this.errors.length === 0; return this.invalid.length === 0;
} }
toDisplayString() { toDisplayString() {
let displayString = ''; let displayString = '';
if (this.invalid.length > 0) { if (this.invalid.length > 0) {
displayString += `✗ Found unknown Gradle Wrapper JAR files:\n${ValidationResult.toDisplayList(this.invalid)}`; displayString += `✗ Found unknown Gradle Wrapper JAR files:\n${ValidationResult.toDisplayList(this.invalid)}`;
} }
if (this.errors.length > 0) {
if (displayString.length > 0)
displayString += '\n';
displayString += `✗ Other validation errors:\n ${this.errors.join(`\n `)}`;
}
if (this.valid.length > 0) { if (this.valid.length > 0) {
if (displayString.length > 0) if (displayString.length > 0)
displayString += '\n'; displayString += '\n';
@@ -157679,16 +157670,16 @@ async function validateWrappers(config, workspaceRoot, gradleUserHome) {
const checksumCache = new cache_1.ChecksumCache(gradleUserHome); const checksumCache = new cache_1.ChecksumCache(gradleUserHome);
const allowedChecksums = process.env['ALLOWED_GRADLE_WRAPPER_CHECKSUMS']?.split(',') || []; const allowedChecksums = process.env['ALLOWED_GRADLE_WRAPPER_CHECKSUMS']?.split(',') || [];
const previouslyValidatedChecksums = checksumCache.load(); const previouslyValidatedChecksums = checksumCache.load();
const result = await (0, validate_1.findInvalidWrapperJars)(workspaceRoot, 0, config.allowSnapshotWrappers(), allowedChecksums, previouslyValidatedChecksums); const result = await (0, validate_1.findInvalidWrapperJars)(workspaceRoot, config.allowSnapshotWrappers(), allowedChecksums, previouslyValidatedChecksums);
if (result.isValid()) { if (result.isValid()) {
await core.group('All Gradle Wrapper jars are valid', async () => { await core.group('All Gradle Wrapper jars are valid', async () => {
core.info(`Loaded previously validated checksums from cache: ${previouslyValidatedChecksums.join(', ')}`); core.debug(`Loaded previously validated checksums from cache: ${previouslyValidatedChecksums.join(', ')}`);
core.info(result.toDisplayString()); core.info(result.toDisplayString());
}); });
} }
else { else {
core.info(result.toDisplayString()); core.info(result.toDisplayString());
throw new errors_1.JobFailure(`Gradle Wrapper Validation Failed!\n See https://github.com/gradle/actions/blob/main/docs/wrapper-validation.md#validation-failures\n${result.toDisplayString()}`); throw new errors_1.JobFailure(`At least one Gradle Wrapper Jar failed validation!\n See https://github.com/gradle/actions/blob/main/docs/wrapper-validation.md#validation-failures\n${result.toDisplayString()}`);
} }
checksumCache.save(result.valid.map(wrapper => wrapper.checksum)); checksumCache.save(result.valid.map(wrapper => wrapper.checksum));
} }

File diff suppressed because one or more lines are too long

View File

@@ -100928,12 +100928,19 @@ async function run() {
(0, deprecation_collector_1.failOnUseOfRemovedFeature)('The action `gradle/wrapper-validation-action` has been replaced by `gradle/actions/wrapper-validation`'); (0, deprecation_collector_1.failOnUseOfRemovedFeature)('The action `gradle/wrapper-validation-action` has been replaced by `gradle/actions/wrapper-validation`');
} }
(0, configuration_1.setActionId)('gradle/actions/wrapper-validation'); (0, configuration_1.setActionId)('gradle/actions/wrapper-validation');
const result = await validate.findInvalidWrapperJars(path.resolve('.'), +core.getInput('min-wrapper-count'), core.getInput('allow-snapshots') === 'true', core.getInput('allow-checksums').split(',')); const result = await validate.findInvalidWrapperJars(path.resolve('.'), core.getInput('allow-snapshots') === 'true', core.getInput('allow-checksums').split(','));
if (result.isValid()) { if (result.isValid()) {
core.info(result.toDisplayString()); core.info(result.toDisplayString());
const minWrapperCount = +core.getInput('min-wrapper-count');
if (result.valid.length < minWrapperCount) {
const message = result.valid.length === 0
? 'Wrapper validation failed: no Gradle Wrapper jars found. Did you forget to checkout the repository?'
: `Wrapper validation failed: expected at least ${minWrapperCount} Gradle Wrapper jars, but found ${result.valid.length}.`;
core.setFailed(message);
}
} }
else { else {
core.setFailed(`Gradle Wrapper Validation Failed!\n See https://github.com/gradle/actions/blob/main/docs/wrapper-validation.md#reporting-failures\n${result.toDisplayString()}`); core.setFailed(`At least one Gradle Wrapper Jar failed validation!\n See https://github.com/gradle/actions/blob/main/docs/wrapper-validation.md#validation-failures\n${result.toDisplayString()}`);
if (result.invalid.length > 0) { if (result.invalid.length > 0) {
core.setOutput('failed-wrapper', `${result.invalid.map(w => w.path).join('|')}`); core.setOutput('failed-wrapper', `${result.invalid.map(w => w.path).join('|')}`);
} }
@@ -101770,12 +101777,9 @@ const find = __importStar(__nccwpck_require__(849));
const checksums = __importStar(__nccwpck_require__(907)); const checksums = __importStar(__nccwpck_require__(907));
const hash = __importStar(__nccwpck_require__(79)); const hash = __importStar(__nccwpck_require__(79));
const path_1 = __nccwpck_require__(1017); const path_1 = __nccwpck_require__(1017);
async function findInvalidWrapperJars(gitRepoRoot, minWrapperCount, allowSnapshots, allowedChecksums, previouslyValidatedChecksums = [], knownValidChecksums = checksums.KNOWN_CHECKSUMS) { async function findInvalidWrapperJars(gitRepoRoot, allowSnapshots, allowedChecksums, previouslyValidatedChecksums = [], knownValidChecksums = checksums.KNOWN_CHECKSUMS) {
const wrapperJars = await find.findWrapperJars(gitRepoRoot); const wrapperJars = await find.findWrapperJars(gitRepoRoot);
const result = new ValidationResult([], []); const result = new ValidationResult([], []);
if (wrapperJars.length < minWrapperCount) {
result.errors.push(`Expected to find at least ${minWrapperCount} Gradle Wrapper JARs but got only ${wrapperJars.length}`);
}
if (wrapperJars.length > 0) { if (wrapperJars.length > 0) {
const notYetValidatedWrappers = []; const notYetValidatedWrappers = [];
for (const wrapperJar of wrapperJars) { for (const wrapperJar of wrapperJars) {
@@ -101808,23 +101812,17 @@ exports.findInvalidWrapperJars = findInvalidWrapperJars;
class ValidationResult { class ValidationResult {
constructor(valid, invalid) { constructor(valid, invalid) {
this.fetchedChecksums = false; this.fetchedChecksums = false;
this.errors = [];
this.valid = valid; this.valid = valid;
this.invalid = invalid; this.invalid = invalid;
} }
isValid() { isValid() {
return this.invalid.length === 0 && this.errors.length === 0; return this.invalid.length === 0;
} }
toDisplayString() { toDisplayString() {
let displayString = ''; let displayString = '';
if (this.invalid.length > 0) { if (this.invalid.length > 0) {
displayString += `✗ Found unknown Gradle Wrapper JAR files:\n${ValidationResult.toDisplayList(this.invalid)}`; displayString += `✗ Found unknown Gradle Wrapper JAR files:\n${ValidationResult.toDisplayList(this.invalid)}`;
} }
if (this.errors.length > 0) {
if (displayString.length > 0)
displayString += '\n';
displayString += `✗ Other validation errors:\n ${this.errors.join(`\n `)}`;
}
if (this.valid.length > 0) { if (this.valid.length > 0) {
if (displayString.length > 0) if (displayString.length > 0)
displayString += '\n'; displayString += '\n';

File diff suppressed because one or more lines are too long

View File

@@ -18,15 +18,23 @@ export async function run(): Promise<void> {
const result = await validate.findInvalidWrapperJars( const result = await validate.findInvalidWrapperJars(
path.resolve('.'), path.resolve('.'),
+core.getInput('min-wrapper-count'),
core.getInput('allow-snapshots') === 'true', core.getInput('allow-snapshots') === 'true',
core.getInput('allow-checksums').split(',') core.getInput('allow-checksums').split(',')
) )
if (result.isValid()) { if (result.isValid()) {
core.info(result.toDisplayString()) core.info(result.toDisplayString())
const minWrapperCount = +core.getInput('min-wrapper-count')
if (result.valid.length < minWrapperCount) {
const message =
result.valid.length === 0
? 'Wrapper validation failed: no Gradle Wrapper jars found. Did you forget to checkout the repository?'
: `Wrapper validation failed: expected at least ${minWrapperCount} Gradle Wrapper jars, but found ${result.valid.length}.`
core.setFailed(message)
}
} else { } else {
core.setFailed( core.setFailed(
`Gradle Wrapper Validation Failed!\n See https://github.com/gradle/actions/blob/main/docs/wrapper-validation.md#reporting-failures\n${result.toDisplayString()}` `At least one Gradle Wrapper Jar failed validation!\n See https://github.com/gradle/actions/blob/main/docs/wrapper-validation.md#validation-failures\n${result.toDisplayString()}`
) )
if (result.invalid.length > 0) { if (result.invalid.length > 0) {
core.setOutput('failed-wrapper', `${result.invalid.map(w => w.path).join('|')}`) core.setOutput('failed-wrapper', `${result.invalid.map(w => w.path).join('|')}`)

View File

@@ -5,7 +5,6 @@ import {resolve} from 'path'
export async function findInvalidWrapperJars( export async function findInvalidWrapperJars(
gitRepoRoot: string, gitRepoRoot: string,
minWrapperCount: number,
allowSnapshots: boolean, allowSnapshots: boolean,
allowedChecksums: string[], allowedChecksums: string[],
previouslyValidatedChecksums: string[] = [], previouslyValidatedChecksums: string[] = [],
@@ -13,11 +12,6 @@ export async function findInvalidWrapperJars(
): Promise<ValidationResult> { ): Promise<ValidationResult> {
const wrapperJars = await find.findWrapperJars(gitRepoRoot) const wrapperJars = await find.findWrapperJars(gitRepoRoot)
const result = new ValidationResult([], []) const result = new ValidationResult([], [])
if (wrapperJars.length < minWrapperCount) {
result.errors.push(
`Expected to find at least ${minWrapperCount} Gradle Wrapper JARs but got only ${wrapperJars.length}`
)
}
if (wrapperJars.length > 0) { if (wrapperJars.length > 0) {
const notYetValidatedWrappers = [] const notYetValidatedWrappers = []
for (const wrapperJar of wrapperJars) { for (const wrapperJar of wrapperJars) {
@@ -54,7 +48,6 @@ export class ValidationResult {
valid: WrapperJar[] valid: WrapperJar[]
invalid: WrapperJar[] invalid: WrapperJar[]
fetchedChecksums = false fetchedChecksums = false
errors: string[] = []
constructor(valid: WrapperJar[], invalid: WrapperJar[]) { constructor(valid: WrapperJar[], invalid: WrapperJar[]) {
this.valid = valid this.valid = valid
@@ -62,7 +55,7 @@ export class ValidationResult {
} }
isValid(): boolean { isValid(): boolean {
return this.invalid.length === 0 && this.errors.length === 0 return this.invalid.length === 0
} }
toDisplayString(): string { toDisplayString(): string {
@@ -72,10 +65,6 @@ export class ValidationResult {
this.invalid this.invalid
)}` )}`
} }
if (this.errors.length > 0) {
if (displayString.length > 0) displayString += '\n'
displayString += `✗ Other validation errors:\n ${this.errors.join(`\n `)}`
}
if (this.valid.length > 0) { if (this.valid.length > 0) {
if (displayString.length > 0) displayString += '\n' if (displayString.length > 0) displayString += '\n'
displayString += `✓ Found known Gradle Wrapper JAR files:\n${ValidationResult.toDisplayList(this.valid)}` displayString += `✓ Found known Gradle Wrapper JAR files:\n${ValidationResult.toDisplayList(this.valid)}`

View File

@@ -20,20 +20,19 @@ export async function validateWrappers(
const result = await findInvalidWrapperJars( const result = await findInvalidWrapperJars(
workspaceRoot, workspaceRoot,
0,
config.allowSnapshotWrappers(), config.allowSnapshotWrappers(),
allowedChecksums, allowedChecksums,
previouslyValidatedChecksums previouslyValidatedChecksums
) )
if (result.isValid()) { if (result.isValid()) {
await core.group('All Gradle Wrapper jars are valid', async () => { await core.group('All Gradle Wrapper jars are valid', async () => {
core.info(`Loaded previously validated checksums from cache: ${previouslyValidatedChecksums.join(', ')}`) core.debug(`Loaded previously validated checksums from cache: ${previouslyValidatedChecksums.join(', ')}`)
core.info(result.toDisplayString()) core.info(result.toDisplayString())
}) })
} else { } else {
core.info(result.toDisplayString()) core.info(result.toDisplayString())
throw new JobFailure( throw new JobFailure(
`Gradle Wrapper Validation Failed!\n See https://github.com/gradle/actions/blob/main/docs/wrapper-validation.md#validation-failures\n${result.toDisplayString()}` `At least one Gradle Wrapper Jar failed validation!\n See https://github.com/gradle/actions/blob/main/docs/wrapper-validation.md#validation-failures\n${result.toDisplayString()}`
) )
} }

View File

@@ -12,7 +12,7 @@ const baseDir = path.resolve('./test/jest/wrapper-validation')
const tmpDir = path.resolve('./test/jest/tmp') const tmpDir = path.resolve('./test/jest/tmp')
test('succeeds if all found wrapper jars are valid', async () => { test('succeeds if all found wrapper jars are valid', async () => {
const result = await validate.findInvalidWrapperJars(baseDir, 3, false, [ const result = await validate.findInvalidWrapperJars(baseDir, false, [
'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
]) ])
@@ -29,7 +29,7 @@ test('succeeds if all found wrapper jars are valid', async () => {
}) })
test('succeeds if all found wrapper jars are previously valid', async () => { test('succeeds if all found wrapper jars are previously valid', async () => {
const result = await validate.findInvalidWrapperJars(baseDir, 3, false, [], [ const result = await validate.findInvalidWrapperJars(baseDir, false, [], [
'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
'3888c76faa032ea8394b8a54e04ce2227ab1f4be64f65d450f8509fe112d38ce' '3888c76faa032ea8394b8a54e04ce2227ab1f4be64f65d450f8509fe112d38ce'
]) ])
@@ -50,7 +50,6 @@ test('succeeds if all found wrapper jars are valid (and checksums are fetched fr
const knownValidChecksums = new WrapperChecksums() const knownValidChecksums = new WrapperChecksums()
const result = await validate.findInvalidWrapperJars( const result = await validate.findInvalidWrapperJars(
baseDir, baseDir,
1,
false, false,
['e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'], ['e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'],
[], [],
@@ -71,7 +70,7 @@ test('succeeds if all found wrapper jars are valid (and checksums are fetched fr
}) })
test('fails if invalid wrapper jars are found', async () => { test('fails if invalid wrapper jars are found', async () => {
const result = await validate.findInvalidWrapperJars(baseDir, 3, false, []) const result = await validate.findInvalidWrapperJars(baseDir, false, [])
expect(result.isValid()).toBe(false) expect(result.isValid()).toBe(false)
@@ -102,26 +101,6 @@ test('fails if invalid wrapper jars are found', async () => {
) )
}) })
test('fails if not enough wrapper jars are found', async () => {
const result = await validate.findInvalidWrapperJars(baseDir, 4, false, [])
expect(result.isValid()).toBe(false)
expect(result.errors).toEqual([
'Expected to find at least 4 Gradle Wrapper JARs but got only 3'
])
expect(result.toDisplayString()).toBe(
'✗ Found unknown Gradle Wrapper JAR files:\n' +
' e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 data/invalid/gradle-wrapper.jar\n' +
' e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 data/invalid/gradlе-wrapper.jar\n' + // homoglyph
'✗ Other validation errors:\n' +
' Expected to find at least 4 Gradle Wrapper JARs but got only 3\n' +
'✓ Found known Gradle Wrapper JAR files:\n' +
' 3888c76faa032ea8394b8a54e04ce2227ab1f4be64f65d450f8509fe112d38ce data/valid/gradle-wrapper.jar'
)
})
test('can save and load checksums', async () => { test('can save and load checksums', async () => {
const cacheDir = path.join(tmpDir, 'wrapper-validation-cache') const cacheDir = path.join(tmpDir, 'wrapper-validation-cache')
fs.rmSync(cacheDir, {recursive: true, force: true}) fs.rmSync(cacheDir, {recursive: true, force: true})