Improve GHA workflows (#148)

A bunch of improvements to the GHA workflow pipeline including:
- Separate workflow for unit tests
- Always use a locally-built dist directory for integ-tests
- Only run 'quick' integ-tests for non-PR commits. Once a PR is submitted, the 'full' suite will be run on each push.
This commit is contained in:
Daz DeBoer 2024-04-10 07:03:41 -06:00 committed by GitHub
commit 6a8b99d4b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
30 changed files with 206 additions and 308 deletions

View File

@ -6,6 +6,8 @@ runs:
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: sources/package-lock.json
- name: Build distribution
shell: bash
run: |

View File

@ -9,10 +9,8 @@ runs:
distribution: 'temurin'
java-version: 11
# Downloads a 'dist' directory artifact that was uploaded in an earlier step
# We control this with an environment variable to allow for easier global configuration.
# Downloads a 'dist' directory artifact that was uploaded in an earlier 'build-dist' step
- name: Download dist
if: ${{ env.DOWNLOAD_DIST == 'true' }}
uses: actions/download-artifact@v4
with:
name: dist

View File

@ -0,0 +1,30 @@
name: CI-check-and-unit-test
on:
push:
permissions:
contents: read
jobs:
check-format-and-unit-test:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: sources/package-lock.json
- name: Check formatting and compile
run: |
npm install
npm run check
npm run compile
working-directory: sources
- name: Run unit tests
run: |
npm test
working-directory: sources

View File

@ -1,28 +0,0 @@
# Dependency Review Action
#
# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
#
# Source repository: https://github.com/actions/dependency-review-action
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
name: CI-dependency-review
on: [pull_request]
permissions:
contents: write
jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v4
- name: Dependencies for groovy-dsl
uses: ./dependency-submission
with:
build-root-directory: .github/workflow-samples/groovy-dsl
- name: Dependencies for kotlin-dsl
uses: ./dependency-submission
with:
build-root-directory: .github/workflow-samples/kotlin-dsl
- name: 'Dependency Review'
uses: actions/dependency-review-action@v4

View File

@ -1,37 +1,48 @@
name: CI-full-check
name: CI-integ-test-full
on:
workflow_dispatch:
pull_request:
types:
- assigned
- review_requested
push:
branches:
- main
- release/**
paths:
- '.github/**'
- 'dist/**'
- '**/action.yml'
jobs:
build-distribution:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Build and upload distribution
uses: ./.github/actions/build-dist
action-inputs:
needs: build-distribution
uses: ./.github/workflows/integ-test-action-inputs.yml
with:
cache-key-prefix: ${{github.run_number}}-
build-scan-publish:
needs: build-distribution
uses: ./.github/workflows/integ-test-build-scan-publish.yml
with:
cache-key-prefix: ${{github.run_number}}-
cache-cleanup:
needs: build-distribution
uses: ./.github/workflows/integ-test-cache-cleanup.yml
with:
cache-key-prefix: ${{github.run_number}}-
caching-config:
needs: build-distribution
uses: ./.github/workflows/integ-test-caching-config.yml
with:
cache-key-prefix: ${{github.run_number}}-
dependency-graph:
needs: build-distribution
uses: ./.github/workflows/integ-test-dependency-graph.yml
permissions:
contents: write
@ -39,6 +50,7 @@ jobs:
cache-key-prefix: ${{github.run_number}}-
dependency-submission:
needs: build-distribution
uses: ./.github/workflows/integ-test-dependency-submission.yml
permissions:
contents: write
@ -46,21 +58,25 @@ jobs:
cache-key-prefix: ${{github.run_number}}-
dependency-submission-failures:
needs: build-distribution
uses: ./.github/workflows/integ-test-dependency-submission-failures.yml
with:
cache-key-prefix: ${{github.run_number}}-
execution-with-caching:
needs: build-distribution
uses: ./.github/workflows/integ-test-execution-with-caching.yml
with:
cache-key-prefix: ${{github.run_number}}-
execution:
needs: build-distribution
uses: ./.github/workflows/integ-test-execution.yml
with:
cache-key-prefix: ${{github.run_number}}-
develocity-injection:
needs: build-distribution
uses: ./.github/workflows/integ-test-inject-develocity.yml
with:
cache-key-prefix: ${{github.run_number}}-
@ -68,11 +84,13 @@ jobs:
DEVELOCITY_ACCESS_KEY: ${{ secrets.GE_SOLUTIONS_ACCESS_TOKEN }}
provision-gradle-versions:
needs: build-distribution
uses: ./.github/workflows/integ-test-provision-gradle-versions.yml
with:
cache-key-prefix: ${{github.run_number}}-
restore-configuration-cache:
needs: build-distribution
uses: ./.github/workflows/integ-test-restore-configuration-cache.yml
with:
cache-key-prefix: ${{github.run_number}}-
@ -80,36 +98,43 @@ jobs:
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
restore-custom-gradle-home:
needs: build-distribution
uses: ./.github/workflows/integ-test-restore-custom-gradle-home.yml
with:
cache-key-prefix: ${{github.run_number}}-
restore-containerized-gradle-home:
needs: build-distribution
uses: ./.github/workflows/integ-test-restore-containerized-gradle-home.yml
with:
cache-key-prefix: ${{github.run_number}}-
restore-gradle-home:
needs: build-distribution
uses: ./.github/workflows/integ-test-restore-gradle-home.yml
with:
cache-key-prefix: ${{github.run_number}}-
restore-java-toolchain:
needs: build-distribution
uses: ./.github/workflows/integ-test-restore-java-toolchain.yml
with:
cache-key-prefix: ${{github.run_number}}-
sample-kotlin-dsl:
needs: build-distribution
uses: ./.github/workflows/integ-test-sample-kotlin-dsl.yml
with:
cache-key-prefix: ${{github.run_number}}-
sample-gradle-plugin:
needs: build-distribution
uses: ./.github/workflows/integ-test-sample-gradle-plugin.yml
with:
cache-key-prefix: ${{github.run_number}}-
toolchain-detection:
needs: build-distribution
uses: ./.github/workflows/integ-test-detect-java-toolchains.yml
with:
cache-key-prefix: ${{github.run_number}}-

View File

@ -1,4 +1,4 @@
name: CI-quick-check
name: CI-integ-test-quick
on:
workflow_dispatch:
@ -8,7 +8,18 @@ on:
- release/**
jobs:
check-for-pr:
runs-on: ubuntu-latest
outputs:
is-pr-commit: ${{ steps.PR.outputs.pr_found }}
steps:
- name: Get current PR details
uses: 8BitJonny/gh-get-current-pr@3.0.0
id: PR
build-distribution:
needs: check-for-pr
if: ${{ needs.check-for-pr.outputs.is-pr-commit == 'false' }}
runs-on: ubuntu-latest
steps:
- name: Checkout sources
@ -16,34 +27,23 @@ jobs:
- name: Build and upload distribution
uses: ./.github/actions/build-dist
run-unit-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Configure Gradle as default for unit test
uses: ./setup-gradle
with:
gradle-version: 8.7
- name: Run tests
run: |
npm install
npm run all
working-directory: sources
action-inputs:
needs: build-distribution
uses: ./.github/workflows/integ-test-action-inputs.yml
with:
runner-os: '["ubuntu-latest"]'
download-dist: true
build-scan-publish:
needs: build-distribution
uses: ./.github/workflows/integ-test-build-scan-publish.yml
with:
runner-os: '["ubuntu-latest"]'
cache-cleanup:
needs: build-distribution
uses: ./.github/workflows/integ-test-cache-cleanup.yml
with:
runner-os: '["ubuntu-latest"]'
download-dist: true
cache-key-prefix: ${{github.run_number}}- # Requires a fresh cache entry each run
caching-config:
@ -51,7 +51,6 @@ jobs:
uses: ./.github/workflows/integ-test-caching-config.yml
with:
runner-os: '["ubuntu-latest"]'
download-dist: true
dependency-graph:
needs: build-distribution
@ -60,7 +59,6 @@ jobs:
contents: write
with:
runner-os: '["ubuntu-latest"]'
download-dist: true
dependency-submission:
needs: build-distribution
@ -69,7 +67,6 @@ jobs:
contents: write
with:
runner-os: '["ubuntu-latest"]'
download-dist: true
dependency-submission-failures:
needs: build-distribution
@ -78,28 +75,25 @@ jobs:
contents: write
with:
runner-os: '["ubuntu-latest"]'
download-dist: true
execution-with-caching:
needs: build-distribution
uses: ./.github/workflows/integ-test-execution-with-caching.yml
with:
runner-os: '["ubuntu-latest"]'
download-dist: true
execution:
needs: build-distribution
uses: ./.github/workflows/integ-test-execution.yml
with:
runner-os: '["ubuntu-latest"]'
download-dist: true
develocity-injection:
if: ${{ vars.HAS_GRADLE_ACTIONS_SECRETS == 'true' }}
needs: build-distribution
uses: ./.github/workflows/integ-test-inject-develocity.yml
with:
runner-os: '["ubuntu-latest"]'
download-dist: true
secrets:
DEVELOCITY_ACCESS_KEY: ${{ secrets.GE_SOLUTIONS_ACCESS_TOKEN }}
@ -108,60 +102,50 @@ jobs:
uses: ./.github/workflows/integ-test-provision-gradle-versions.yml
with:
runner-os: '["ubuntu-latest"]'
download-dist: true
restore-configuration-cache:
if: ${{ vars.HAS_GRADLE_ACTIONS_SECRETS == 'true' }}
needs: build-distribution
uses: ./.github/workflows/integ-test-restore-configuration-cache.yml
with:
runner-os: '["ubuntu-latest"]'
download-dist: true
secrets:
GRADLE_ENCRYPTION_KEY: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
restore-containerized-gradle-home:
needs: build-distribution
uses: ./.github/workflows/integ-test-restore-containerized-gradle-home.yml
with:
download-dist: true
restore-custom-gradle-home:
needs: build-distribution
uses: ./.github/workflows/integ-test-restore-custom-gradle-home.yml
with:
download-dist: true
restore-gradle-home:
needs: build-distribution
uses: ./.github/workflows/integ-test-restore-gradle-home.yml
with:
runner-os: '["ubuntu-latest"]'
download-dist: true
restore-java-toolchain:
needs: build-distribution
uses: ./.github/workflows/integ-test-restore-java-toolchain.yml
with:
runner-os: '["ubuntu-latest"]'
download-dist: true
sample-kotlin-dsl:
needs: build-distribution
uses: ./.github/workflows/integ-test-sample-kotlin-dsl.yml
with:
runner-os: '["ubuntu-latest"]'
download-dist: true
sample-gradle-plugin:
needs: build-distribution
uses: ./.github/workflows/integ-test-sample-gradle-plugin.yml
with:
runner-os: '["ubuntu-latest"]'
download-dist: true
toolchain-detection:
needs: build-distribution
uses: ./.github/workflows/integ-test-detect-java-toolchains.yml
with:
runner-os: '["ubuntu-latest"]'
download-dist: true

View File

@ -20,6 +20,8 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: sources/package-lock.json
- name: Build
run: |
npm -v

View File

@ -1,25 +0,0 @@
name: Test dependency-submission save
on:
workflow_dispatch:
push:
permissions:
contents: read
jobs:
dependency-submission-save:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Initialize integ-test
uses: ./.github/actions/init-integ-test
- name: Generate and save dependency graph
uses: ./dependency-submission
with:
build-root-directory: .github/workflow-samples/groovy-dsl
dependency-graph: generate-and-upload
env:
GITHUB_DEPENDENCY_GRAPH_REF: 'refs/tags/v0.0.1' # Use a different ref to avoid updating the real dependency graph for the repository

View File

@ -1,23 +0,0 @@
name: Test dependency-submission submit
on:
workflow_run:
workflows: ['Test dependency-submission save']
types: [completed]
permissions:
contents: write
jobs:
dependency-submission-submit:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Initialize integ-test
uses: ./.github/actions/init-integ-test
- name: Download and submit dependency graph
uses: ./dependency-submission
with:
dependency-graph: download-and-submit

View File

@ -1,65 +0,0 @@
name: Test dependency-submission
on:
workflow_dispatch:
push:
permissions:
contents: write
jobs:
test-dependency-submission:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Initialize integ-test
uses: ./.github/actions/init-integ-test
- name: Generate and submit dependencies
uses: ./dependency-submission
with:
build-root-directory: .github/workflow-samples/groovy-dsl
env:
GITHUB_DEPENDENCY_GRAPH_REF: 'refs/tags/v0.0.1' # Use a different ref to avoid updating the real dependency graph for the repository
test-gradle-versions:
strategy:
fail-fast: false
matrix:
gradle: [8.0.2, 7.6.4, 7.1.1, 6.9.4, 6.0.1, 5.6.4, 5.2.1]
include:
- gradle: 5.6.4
build-root-suffix: -gradle-5
- gradle: 5.2.1
build-root-suffix: -gradle-5
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Initialize integ-test
uses: ./.github/actions/init-integ-test
- name: Generate and submit dependencies
uses: ./dependency-submission
with:
gradle-version: ${{ matrix.gradle }}
build-root-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
env:
GITHUB_DEPENDENCY_GRAPH_REF: 'refs/tags/v0.0.1' # Use a different ref to avoid updating the real dependency graph for the repository
test-after-setup-gradle:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Initialize integ-test
uses: ./.github/actions/init-integ-test
- name: Setup Gradle
uses: ./setup-gradle
- name: Generate and submit dependencies
id: dependency-submission
uses: ./dependency-submission
with:
build-root-directory: .github/workflow-samples/groovy-dsl

View File

@ -8,12 +8,8 @@ on:
runner-os:
type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
download-dist:
type: boolean
default: false
env:
DOWNLOAD_DIST: ${{ inputs.download-dist }}
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: action-inputs-${{ inputs.cache-key-prefix }}
jobs:

View File

@ -0,0 +1,53 @@
name: Test develocity injection
on:
workflow_call:
inputs:
cache-key-prefix:
type: string
runner-os:
type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
env:
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: build-scan-publish-${{ inputs.cache-key-prefix }}
jobs:
build-scan-publish:
strategy:
fail-fast: false
matrix:
gradle: [current, 7.6.2, 6.9.4, 5.6.4]
os: ${{fromJSON(inputs.runner-os)}}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Initialize integ-test
uses: ./.github/actions/init-integ-test
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
- name: Setup Gradle
id: setup-gradle
uses: ./setup-gradle
with:
cache-read-only: false # For testing, allow writing cache entries on non-default branches
gradle-version: ${{ matrix.gradle }}
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes"
- name: Run Gradle build
id: gradle
working-directory: .github/workflow-samples/no-ge
run: gradle help
- name: Check Build Scan url
if: ${{ !steps.gradle.outputs.build-scan-url }}
uses: actions/github-script@v7
with:
script: |
core.setFailed('No Build Scan detected')

View File

@ -8,12 +8,8 @@ on:
runner-os:
type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
download-dist:
type: boolean
default: false
env:
DOWNLOAD_DIST: ${{ inputs.download-dist }}
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: integ-test-cache-cleanup-${{ inputs.cache-key-prefix }}
jobs:

View File

@ -8,12 +8,8 @@ on:
runner-os:
type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
download-dist:
type: boolean
default: false
env:
DOWNLOAD_DIST: ${{ inputs.download-dist }}
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: action-inputs-caching-${{ inputs.cache-key-prefix }}
jobs:
@ -104,7 +100,7 @@ jobs:
# Test that build scans are captured when caching is disabled because Gradle User Home already exists
cache-disabled-pre-existing-gradle-home:
runs-on: ubuntu-latest
runs-on: ubuntu-latest # This test only runs on Ubuntu
steps:
- name: Checkout sources
uses: actions/checkout@v4

View File

@ -8,15 +8,11 @@ on:
runner-os:
type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
download-dist:
type: boolean
default: false
permissions:
contents: write
env:
DOWNLOAD_DIST: ${{ inputs.download-dist }}
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: dependency-graph-${{ inputs.cache-key-prefix }}
jobs:
@ -120,7 +116,11 @@ jobs:
fi
config-cache:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: ${{fromJSON(inputs.runner-os)}}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4

View File

@ -8,12 +8,8 @@ on:
runner-os:
type: string
default: '["ubuntu-latest"]'
download-dist:
type: boolean
default: false
env:
DOWNLOAD_DIST: ${{ inputs.download-dist }}
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: dependency-graph-${{ inputs.cache-key-prefix }}
jobs:

View File

@ -8,15 +8,11 @@ on:
runner-os:
type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
download-dist:
type: boolean
default: false
permissions:
contents: write
env:
DOWNLOAD_DIST: ${{ inputs.download-dist }}
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: dependency-graph-${{ inputs.cache-key-prefix }}
jobs:
@ -162,7 +158,11 @@ jobs:
build-root-directory: .github/workflow-samples/groovy-dsl
config-cache:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: ${{fromJSON(inputs.runner-os)}}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
@ -194,4 +194,50 @@ jobs:
echo "Expected no dependency graph files to be generated"
ls -l dependency-graph-reports
exit 1
fi
fi
gradle-versions:
strategy:
fail-fast: false
matrix:
os: ${{fromJSON(inputs.runner-os)}}
gradle: [8.0.2, 7.6.4, 7.1.1, 6.9.4, 6.0.1, 5.6.4, 5.2.1]
include:
- gradle: 5.6.4
build-root-suffix: -gradle-5
- gradle: 5.2.1
build-root-suffix: -gradle-5
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Initialize integ-test
uses: ./.github/actions/init-integ-test
- name: Generate and submit dependencies
uses: ./dependency-submission
with:
gradle-version: ${{ matrix.gradle }}
build-root-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
env:
GITHUB_DEPENDENCY_GRAPH_REF: 'refs/tags/v0.0.1' # Use a different ref to avoid updating the real dependency graph for the repository
after-setup-gradle:
strategy:
fail-fast: false
matrix:
os: ${{fromJSON(inputs.runner-os)}}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Initialize integ-test
uses: ./.github/actions/init-integ-test
- name: Setup Gradle
uses: ./setup-gradle
- name: Generate and submit dependencies
id: dependency-submission
uses: ./dependency-submission
with:
build-root-directory: .github/workflow-samples/groovy-dsl

View File

@ -8,12 +8,8 @@ on:
runner-os:
type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
download-dist:
type: boolean
default: false
env:
DOWNLOAD_DIST: ${{ inputs.download-dist }}
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: detect-java-toolchain-${{ inputs.cache-key-prefix }}
jobs:

View File

@ -8,12 +8,8 @@ on:
runner-os:
type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
download-dist:
type: boolean
default: false
env:
DOWNLOAD_DIST: ${{ inputs.download-dist }}
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: execution-with-caching-${{ inputs.cache-key-prefix }}
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true

View File

@ -8,12 +8,8 @@ on:
runner-os:
type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
download-dist:
type: boolean
default: false
env:
DOWNLOAD_DIST: ${{ inputs.download-dist }}
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: execution-${{ inputs.cache-key-prefix }}
jobs:

View File

@ -8,16 +8,12 @@ on:
runner-os:
type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
download-dist:
type: boolean
default: false
secrets:
DEVELOCITY_ACCESS_KEY:
required: true
env:
DOWNLOAD_DIST: ${{ inputs.download-dist }}
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: provision-gradle-versions-${{ inputs.cache-key-prefix }}
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: inject-develocity-${{ inputs.cache-key-prefix }}
jobs:
inject-develocity:
@ -34,7 +30,7 @@ jobs:
gradle: [current, 7.6.2, 6.9.4, 5.6.4]
os: ${{fromJSON(inputs.runner-os)}}
plugin-version: [3.16.2, 3.17]
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
@ -62,41 +58,3 @@ jobs:
with:
script: |
core.setFailed('No Build Scan detected')
build-scan-publish:
strategy:
fail-fast: false
matrix:
gradle: [current, 7.6.2, 6.9.4, 5.6.4]
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Initialize integ-test
uses: ./.github/actions/init-integ-test
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
- name: Setup Gradle
id: setup-gradle
uses: ./setup-gradle
with:
cache-read-only: false # For testing, allow writing cache entries on non-default branches
gradle-version: ${{ matrix.gradle }}
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes"
- name: Run Gradle build
id: gradle
working-directory: .github/workflow-samples/no-ge
run: gradle help
- name: Check Build Scan url
if: ${{ !steps.gradle.outputs.build-scan-url }}
uses: actions/github-script@v7
with:
script: |
core.setFailed('No Build Scan detected')

View File

@ -8,12 +8,8 @@ on:
runner-os:
type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
download-dist:
type: boolean
default: false
env:
DOWNLOAD_DIST: ${{ inputs.download-dist }}
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: provision-gradle-versions-${{ inputs.cache-key-prefix }}
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true

View File

@ -8,15 +8,11 @@ on:
runner-os:
type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
download-dist:
type: boolean
default: false
secrets:
GRADLE_ENCRYPTION_KEY:
required: true
env:
DOWNLOAD_DIST: ${{ inputs.download-dist }}
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-configuration-cache-${{ inputs.cache-key-prefix }}
jobs:

View File

@ -5,12 +5,8 @@ on:
inputs:
cache-key-prefix:
type: string
download-dist:
type: boolean
default: false
env:
DOWNLOAD_DIST: ${{ inputs.download-dist }}
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-custom-gradle-home-${{ inputs.cache-key-prefix }}
jobs:

View File

@ -5,12 +5,8 @@ on:
inputs:
cache-key-prefix:
type: string
download-dist:
type: boolean
default: false
env:
DOWNLOAD_DIST: ${{ inputs.download-dist }}
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-custom-gradle-home-${{ inputs.cache-key-prefix }}
jobs:

View File

@ -8,12 +8,8 @@ on:
runner-os:
type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
download-dist:
type: boolean
default: false
env:
DOWNLOAD_DIST: ${{ inputs.download-dist }}
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-gradle-home-${{ inputs.cache-key-prefix }}
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-gradle-home

View File

@ -8,12 +8,8 @@ on:
runner-os:
type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
download-dist:
type: boolean
default: false
env:
DOWNLOAD_DIST: ${{ inputs.download-dist }}
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-java-toolchain-${{ inputs.cache-key-prefix }}
jobs:

View File

@ -8,12 +8,8 @@ on:
runner-os:
type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
download-dist:
type: boolean
default: false
env:
DOWNLOAD_DIST: ${{ inputs.download-dist }}
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: sample-gradle-plugin-${{ inputs.cache-key-prefix }}
jobs:

View File

@ -8,12 +8,8 @@ on:
runner-os:
type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
download-dist:
type: boolean
default: false
env:
DOWNLOAD_DIST: ${{ inputs.download-dist }}
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: sample-kotlin-dsl-${{ inputs.cache-key-prefix }}
jobs:

View File

@ -5,17 +5,18 @@
"description": "Execute Gradle Build",
"scripts": {
"postinstall": "patch-package",
"format": "prettier --write 'src/**/*.ts'",
"format-check": "prettier --check 'src/**/*.ts'",
"prettier-write": "prettier --write 'src/**/*.ts'",
"prettier-check": "prettier --check 'src/**/*.ts'",
"lint": "eslint 'src/**/*.ts'",
"compile-dependency-submission-main": "ncc build src/dependency-submission/main.ts --out ../dist/dependency-submission/main --source-map --no-source-map-register",
"compile-dependency-submission-post": "ncc build src/dependency-submission/post.ts --out ../dist/dependency-submission/post --source-map --no-source-map-register",
"compile-setup-gradle-main": "ncc build src/setup-gradle/main.ts --out ../dist/setup-gradle/main --source-map --no-source-map-register",
"compile-setup-gradle-post": "ncc build src/setup-gradle/post.ts --out ../dist/setup-gradle/post --source-map --no-source-map-register",
"compile": "npm-run-all --parallel compile-*",
"check": "npm-run-all --parallel format lint",
"check": "npm-run-all --parallel prettier-check lint",
"format": "npm-run-all --parallel prettier-write lint",
"test": "jest",
"build": "npm run check && npm run compile",
"build": "npm run format && npm run compile",
"all": "npm run build && npm test"
},
"repository": {