mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-12-27 01:02:11 -05:00
Merge pull request #294 from gradle/dd/dpe
Various improvements to CI workflows - Compose all integ-test workflow executions into a single calling workflow - Added a 'quick-check' workflow that provides faster feedback on branches other than main - Only runs on ubuntu-latest - Reuses cache entries from previous runs - Builds distribution outputs so that these don't need to be committed during everyday development - Added a workflow for purging old workflow executions Together with the fix for #293, these changes fix #291
This commit is contained in:
commit
c37c1fb693
28 changed files with 715 additions and 366 deletions
16
.github/actions/build-dist/action.yml
vendored
Normal file
16
.github/actions/build-dist/action.yml
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
name: 'Build and upload distribution'
|
||||||
|
# Builds the action distribution an uploads as an artifact for later download
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Build distribution
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
npm install
|
||||||
|
npm run all
|
||||||
|
- name: Upload distribution
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: dist/
|
||||||
|
|
12
.github/actions/download-dist/action.yml
vendored
Normal file
12
.github/actions/download-dist/action.yml
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
name: 'Download dist'
|
||||||
|
# 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.
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Download dist
|
||||||
|
if: ${{ env.DOWNLOAD_DIST == 'true' }}
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: dist/
|
|
@ -9,7 +9,7 @@
|
||||||
# the `language` matrix defined below to confirm you have the correct set of
|
# the `language` matrix defined below to confirm you have the correct set of
|
||||||
# supported CodeQL languages.
|
# supported CodeQL languages.
|
||||||
#
|
#
|
||||||
name: "CodeQL"
|
name: codeql
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
66
.github/workflows/ci-full-check.yml
vendored
Normal file
66
.github/workflows/ci-full-check.yml
vendored
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
name: full-check
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- assigned
|
||||||
|
- review_requested
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
action-inputs:
|
||||||
|
uses: ./.github/workflows/integ-test-action-inputs.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
caching-config:
|
||||||
|
uses: ./.github/workflows/integ-test-action-inputs-caching.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
execution-with-caching:
|
||||||
|
uses: ./.github/workflows/integ-test-execution-with-caching.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
execution:
|
||||||
|
uses: ./.github/workflows/integ-test-execution.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
gradle-versions:
|
||||||
|
uses: ./.github/workflows/integ-test-gradle-versions.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
restore-configuration-cache:
|
||||||
|
uses: ./.github/workflows/integ-test-restore-configuration-cache.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
restore-custom-gradle-home:
|
||||||
|
uses: ./.github/workflows/integ-test-restore-custom-gradle-home.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
restore-gradle-home:
|
||||||
|
uses: ./.github/workflows/integ-test-restore-gradle-home.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
restore-java-toolchain:
|
||||||
|
uses: ./.github/workflows/integ-test-restore-java-toolchain.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
sample-kotlin-dsl:
|
||||||
|
uses: ./.github/workflows/integ-test-sample-kotlin-dsl.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
||||||
|
|
||||||
|
sample-gradle-plugin:
|
||||||
|
uses: ./.github/workflows/integ-test-sample-gradle-plugin.yml
|
||||||
|
with:
|
||||||
|
cache-key-prefix: ${{github.run_number}}-
|
91
.github/workflows/ci-quick-check.yml
vendored
Normal file
91
.github/workflows/ci-quick-check.yml
vendored
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
name: quick-check
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches-ignore: main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-distribution:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Build and upload distribution
|
||||||
|
uses: ./.github/actions/build-dist
|
||||||
|
|
||||||
|
action-inputs:
|
||||||
|
needs: build-distribution
|
||||||
|
uses: ./.github/workflows/integ-test-action-inputs.yml
|
||||||
|
with:
|
||||||
|
runner-os: '["ubuntu-latest"]'
|
||||||
|
download-dist: true
|
||||||
|
|
||||||
|
caching-config:
|
||||||
|
needs: build-distribution
|
||||||
|
uses: ./.github/workflows/integ-test-action-inputs-caching.yml
|
||||||
|
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
|
||||||
|
|
||||||
|
gradle-versions:
|
||||||
|
needs: build-distribution
|
||||||
|
uses: ./.github/workflows/integ-test-gradle-versions.yml
|
||||||
|
with:
|
||||||
|
runner-os: '["ubuntu-latest"]'
|
||||||
|
download-dist: true
|
||||||
|
|
||||||
|
# restore-configuration-cache:
|
||||||
|
# needs: build-distribution
|
||||||
|
# uses: ./.github/workflows/integ-test-restore-configuration-cache.yml
|
||||||
|
# with:
|
||||||
|
# runner-os: '["ubuntu-latest"]'
|
||||||
|
# download-dist: true
|
||||||
|
|
||||||
|
restore-custom-gradle-home:
|
||||||
|
needs: build-distribution
|
||||||
|
uses: ./.github/workflows/integ-test-restore-custom-gradle-home.yml
|
||||||
|
with:
|
||||||
|
runner-os: '["ubuntu-latest"]'
|
||||||
|
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
|
|
@ -1,9 +1,13 @@
|
||||||
name: Verify generated outputs
|
name: verify-outputs
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [assigned, review_requested]
|
types:
|
||||||
|
- assigned
|
||||||
|
- review_requested
|
||||||
push:
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
|
@ -3,9 +3,6 @@ name: Execute failure cases
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
failing-build:
|
failing-build:
|
|
@ -1,30 +1,33 @@
|
||||||
name: Test caching configuration
|
name: Test action inputs that control caching
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
workflow_call:
|
||||||
types: [assigned, review_requested]
|
inputs:
|
||||||
push:
|
cache-key-prefix:
|
||||||
paths:
|
type: string
|
||||||
- '.github/**'
|
runner-os:
|
||||||
- 'dist/**'
|
type: string
|
||||||
workflow_dispatch:
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
download-dist:
|
||||||
concurrency:
|
type: boolean
|
||||||
group: ${{ github.workflow }}
|
default: false
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-
|
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: action-inputs-caching-${{ inputs.cache-key-prefix }}
|
||||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
seed-build:
|
seed-build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
@ -44,11 +47,13 @@ jobs:
|
||||||
needs: seed-build
|
needs: seed-build
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
@ -67,11 +72,13 @@ jobs:
|
||||||
cache-disabled:
|
cache-disabled:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
@ -93,6 +100,8 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Create dummy Gradle User Home
|
- name: Create dummy Gradle User Home
|
||||||
run: mkdir -p ~/.gradle/caches
|
run: mkdir -p ~/.gradle/caches
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
|
@ -111,14 +120,16 @@ jobs:
|
||||||
# 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:
|
seed-build-write-only:
|
||||||
env:
|
env:
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-write-only-
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{ inputs.cache-key-prefix }}-write-only-
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
@ -129,15 +140,17 @@ jobs:
|
||||||
|
|
||||||
verify-write-only-build:
|
verify-write-only-build:
|
||||||
env:
|
env:
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-write-only-
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{ inputs.cache-key-prefix }}-write-only-
|
||||||
needs: seed-build-write-only
|
needs: seed-build-write-only
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
41
.github/workflows/integ-test-action-inputs.yml
vendored
Normal file
41
.github/workflows/integ-test-action-inputs.yml
vendored
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
name: Test different action inputs
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
cache-key-prefix:
|
||||||
|
type: string
|
||||||
|
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 }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
action-inputs:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Invoke with multi-line arguments
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
arguments: |
|
||||||
|
--configuration-cache
|
||||||
|
--build-cache
|
||||||
|
-DsystemProperty=FOO
|
||||||
|
-PgradleProperty=BAR
|
||||||
|
test
|
||||||
|
jar
|
55
.github/workflows/integ-test-execution-with-caching.yml
vendored
Normal file
55
.github/workflows/integ-test-execution-with-caching.yml
vendored
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
name: Test save/restore Gradle Home with direct execution
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
cache-key-prefix:
|
||||||
|
type: string
|
||||||
|
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
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
seed-build:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Execute Gradle build
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
arguments: test
|
||||||
|
|
||||||
|
# Test that the gradle-user-home is restored
|
||||||
|
verify-build:
|
||||||
|
needs: seed-build
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
|
- name: Execute Gradle build
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: true
|
||||||
|
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
arguments: test --offline -DverifyCachedBuild=true
|
||||||
|
|
|
@ -1,19 +1,21 @@
|
||||||
name: Test Gradle execution
|
name: Test Gradle execution
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
workflow_call:
|
||||||
types: [assigned, review_requested]
|
inputs:
|
||||||
push:
|
cache-key-prefix:
|
||||||
paths:
|
type: string
|
||||||
- '.github/**'
|
runner-os:
|
||||||
- 'dist/**'
|
type: string
|
||||||
workflow_dispatch:
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
download-dist:
|
||||||
concurrency:
|
type: boolean
|
||||||
group: ${{ github.workflow }}
|
default: false
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-
|
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: execution-${{ inputs.cache-key-prefix }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Tests for executing with different Gradle versions.
|
# Tests for executing with different Gradle versions.
|
||||||
|
@ -21,7 +23,7 @@ jobs:
|
||||||
gradle-execution:
|
gradle-execution:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
include:
|
include:
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
script-suffix: '.bat'
|
script-suffix: '.bat'
|
||||||
|
@ -29,6 +31,8 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Test use defined Gradle version
|
- name: Test use defined Gradle version
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
@ -52,7 +56,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
gradle: [7.3, 6.9, 5.6.4, 4.10.3]
|
gradle: [7.3, 6.9, 5.6.4, 4.10.3]
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
include:
|
include:
|
||||||
- gradle: 5.6.4
|
- gradle: 5.6.4
|
||||||
build-root-suffix: -gradle-5
|
build-root-suffix: -gradle-5
|
||||||
|
@ -62,6 +66,8 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Run Gradle build
|
- name: Run Gradle build
|
||||||
uses: ./
|
uses: ./
|
||||||
id: gradle
|
id: gradle
|
|
@ -1,19 +1,21 @@
|
||||||
name: Test provision different Gradle versions
|
name: Test provision different Gradle versions
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
workflow_call:
|
||||||
types: [assigned, review_requested]
|
inputs:
|
||||||
push:
|
cache-key-prefix:
|
||||||
paths:
|
type: string
|
||||||
- '.github/**'
|
runner-os:
|
||||||
- 'dist/**'
|
type: string
|
||||||
workflow_dispatch:
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
download-dist:
|
||||||
concurrency:
|
type: boolean
|
||||||
group: ${{ github.workflow }}
|
default: false
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-
|
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: gradle-versions-${{ inputs.cache-key-prefix }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Tests for executing with different Gradle versions.
|
# Tests for executing with different Gradle versions.
|
||||||
|
@ -21,7 +23,7 @@ jobs:
|
||||||
provision-gradle:
|
provision-gradle:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
include:
|
include:
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
script-suffix: '.bat'
|
script-suffix: '.bat'
|
||||||
|
@ -29,6 +31,8 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle with v6.9
|
- name: Setup Gradle with v6.9
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
@ -55,7 +59,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
gradle: [7.3, 6.9, 5.6.4, 4.10.3]
|
gradle: [7.3, 6.9, 5.6.4, 4.10.3]
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
include:
|
include:
|
||||||
- gradle: 5.6.4
|
- gradle: 5.6.4
|
||||||
build-root-suffix: -gradle-5
|
build-root-suffix: -gradle-5
|
||||||
|
@ -65,6 +69,8 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
|
@ -1,50 +1,54 @@
|
||||||
name: Test save/restore configuration-cache state
|
name: Test save/restore configuration-cache state
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
workflow_call:
|
||||||
types: [assigned, review_requested]
|
inputs:
|
||||||
push:
|
cache-key-prefix:
|
||||||
paths:
|
type: string
|
||||||
- '.github/**'
|
runner-os:
|
||||||
- 'dist/**'
|
type: string
|
||||||
workflow_dispatch:
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
download-dist:
|
||||||
concurrency:
|
type: boolean
|
||||||
group: ${{ github.workflow }}
|
default: false
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-configuration-cache-${{ inputs.cache-key-prefix }}
|
||||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Run initial Gradle builds to push initial cache entries
|
|
||||||
# These builds should start fresh without cache hits, due to the seed injected into the cache key above.
|
|
||||||
seed-build-groovy:
|
seed-build-groovy:
|
||||||
env:
|
env:
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-groovy-
|
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: build-groovy
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
- name: Groovy build with configuration-cache enabled
|
- name: Groovy build with configuration-cache enabled
|
||||||
working-directory: .github/workflow-samples/groovy-dsl
|
working-directory: .github/workflow-samples/groovy-dsl
|
||||||
run: ./gradlew test --configuration-cache
|
run: ./gradlew test --configuration-cache
|
||||||
|
|
||||||
configuration-cache-groovy:
|
verify-build-groovy:
|
||||||
env:
|
env:
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-groovy-
|
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: build-groovy
|
||||||
needs: seed-build-groovy
|
needs: seed-build-groovy
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
@ -61,17 +65,19 @@ jobs:
|
||||||
core.setFailed('Configuration cache was not used - task was configured unexpectedly')
|
core.setFailed('Configuration cache was not used - task was configured unexpectedly')
|
||||||
|
|
||||||
# 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
|
||||||
no-extracted-cache-entries-restored:
|
gradle-user-home-not-fully-restored:
|
||||||
env:
|
env:
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-groovy-
|
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: build-groovy
|
||||||
needs: seed-build-groovy
|
needs: seed-build-groovy
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle with no extracted cache entries restored
|
- name: Setup Gradle with no extracted cache entries restored
|
||||||
uses: ./
|
uses: ./
|
||||||
env:
|
env:
|
||||||
|
@ -84,14 +90,16 @@ jobs:
|
||||||
|
|
||||||
seed-build-kotlin:
|
seed-build-kotlin:
|
||||||
env:
|
env:
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-kotlin-
|
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: build-kotlin
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
- name: Execute 'help' with configuration-cache enabled
|
- name: Execute 'help' with configuration-cache enabled
|
||||||
|
@ -100,33 +108,37 @@ jobs:
|
||||||
|
|
||||||
modify-build-kotlin:
|
modify-build-kotlin:
|
||||||
env:
|
env:
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-kotlin-
|
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: build-kotlin
|
||||||
needs: seed-build-kotlin
|
needs: seed-build-kotlin
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
- name: Execute 'test' with configuration-cache enabled
|
- name: Execute 'test' with configuration-cache enabled
|
||||||
working-directory: .github/workflow-samples/kotlin-dsl
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
run: ./gradlew test --configuration-cache
|
run: ./gradlew test --configuration-cache
|
||||||
|
|
||||||
# Test restore configuration-cache from the third build invocation
|
# Test restore configuration-cache from the third build invocation
|
||||||
configuration-cache-kotlin:
|
verify-build-kotlin:
|
||||||
env:
|
env:
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-kotlin-
|
GRADLE_BUILD_ACTION_CACHE_KEY_JOB: build-kotlin
|
||||||
needs: modify-build-kotlin
|
needs: modify-build-kotlin
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
|
@ -1,32 +1,33 @@
|
||||||
name: Test caching with a custom GRADLE_USER_HOME
|
name: Test caching with a custom GRADLE_USER_HOME
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
workflow_call:
|
||||||
types: [assigned, review_requested]
|
inputs:
|
||||||
push:
|
cache-key-prefix:
|
||||||
paths:
|
type: string
|
||||||
- '.github/**'
|
runner-os:
|
||||||
- 'dist/**'
|
type: string
|
||||||
workflow_dispatch:
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
download-dist:
|
||||||
concurrency:
|
type: boolean
|
||||||
group: ${{ github.workflow }}
|
default: false
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-
|
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||||
GRADLE_USER_HOME: ${{github.workspace}}/custom/gradle/home
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-custom-gradle-home-${{ inputs.cache-key-prefix }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Run initial Gradle builds to push initial cache entries
|
|
||||||
# These builds should start fresh without cache hits, due to the seed injected into the cache key above.
|
|
||||||
seed-build:
|
seed-build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
- name: Build using Gradle wrapper
|
- name: Build using Gradle wrapper
|
||||||
|
@ -38,11 +39,13 @@ jobs:
|
||||||
needs: seed-build
|
needs: seed-build
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
@ -56,11 +59,13 @@ jobs:
|
||||||
needs: seed-build
|
needs: seed-build
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
|
@ -1,29 +1,34 @@
|
||||||
name: Test save/restore Gradle Home directory
|
name: Test save/restore Gradle Home directory
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
workflow_call:
|
||||||
types: [assigned, review_requested]
|
inputs:
|
||||||
push:
|
cache-key-prefix:
|
||||||
paths:
|
type: string
|
||||||
- '.github/**'
|
runner-os:
|
||||||
- 'dist/**'
|
type: string
|
||||||
workflow_dispatch:
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
download-dist:
|
||||||
concurrency:
|
type: boolean
|
||||||
group: ${{ github.workflow }}
|
default: false
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-
|
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
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
seed-build:
|
seed-build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
- name: Build using Gradle wrapper
|
- name: Build using Gradle wrapper
|
||||||
|
@ -35,11 +40,13 @@ jobs:
|
||||||
needs: seed-build
|
needs: seed-build
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
@ -53,11 +60,13 @@ jobs:
|
||||||
needs: seed-build
|
needs: seed-build
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
@ -71,11 +80,13 @@ jobs:
|
||||||
needs: seed-build
|
needs: seed-build
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle with no extracted cache entries restored
|
- name: Setup Gradle with no extracted cache entries restored
|
||||||
uses: ./
|
uses: ./
|
||||||
env:
|
env:
|
|
@ -1,29 +1,33 @@
|
||||||
name: Test save/restore java toolchains
|
name: Test save/restore java toolchains
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
workflow_call:
|
||||||
types: [assigned, review_requested]
|
inputs:
|
||||||
push:
|
cache-key-prefix:
|
||||||
paths:
|
type: string
|
||||||
- '.github/**'
|
runner-os:
|
||||||
- 'dist/**'
|
type: string
|
||||||
workflow_dispatch:
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
download-dist:
|
||||||
concurrency:
|
type: boolean
|
||||||
group: ${{ github.workflow }}
|
default: false
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-
|
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-java-toolchain-${{ inputs.cache-key-prefix }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
seed-build:
|
seed-build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
- name: Build using Gradle wrapper
|
- name: Build using Gradle wrapper
|
||||||
|
@ -35,11 +39,13 @@ jobs:
|
||||||
needs: seed-build
|
needs: seed-build
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
|
@ -1,30 +1,33 @@
|
||||||
name: Test caching with Gradle Plugin project using TestKit
|
name: Test caching with Gradle Plugin project using TestKit
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
workflow_call:
|
||||||
types: [assigned, review_requested]
|
inputs:
|
||||||
push:
|
cache-key-prefix:
|
||||||
paths:
|
type: string
|
||||||
- '.github/**'
|
runner-os:
|
||||||
- 'dist/**'
|
type: string
|
||||||
workflow_dispatch:
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
download-dist:
|
||||||
concurrency:
|
type: boolean
|
||||||
group: ${{ github.workflow }}
|
default: false
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-
|
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: sample-gradle-plugin-${{ inputs.cache-key-prefix }}
|
||||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
seed-build:
|
seed-build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
- name: Build gradle-plugin project
|
- name: Build gradle-plugin project
|
||||||
|
@ -35,13 +38,17 @@ jobs:
|
||||||
needs: seed-build
|
needs: seed-build
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: true
|
||||||
- name: Build gradle-plugin project
|
- name: Build gradle-plugin project
|
||||||
working-directory: .github/workflow-samples/gradle-plugin
|
working-directory: .github/workflow-samples/gradle-plugin
|
||||||
run: ./gradlew build --offline
|
run: ./gradlew build --offline
|
|
@ -1,30 +1,33 @@
|
||||||
name: Test caching with Kotlin DSL
|
name: Test caching with Kotlin DSL
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
workflow_call:
|
||||||
types: [assigned, review_requested]
|
inputs:
|
||||||
push:
|
cache-key-prefix:
|
||||||
paths:
|
type: string
|
||||||
- '.github/**'
|
runner-os:
|
||||||
- 'dist/**'
|
type: string
|
||||||
workflow_dispatch:
|
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
|
||||||
|
download-dist:
|
||||||
concurrency:
|
type: boolean
|
||||||
group: ${{ github.workflow }}
|
default: false
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-
|
DOWNLOAD_DIST: ${{ inputs.download-dist }}
|
||||||
|
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: sample-kotlin-dsl-${{ inputs.cache-key-prefix }}
|
||||||
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
seed-build:
|
seed-build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
- name: Build kotlin-dsl project
|
- name: Build kotlin-dsl project
|
||||||
|
@ -35,13 +38,17 @@ jobs:
|
||||||
needs: seed-build
|
needs: seed-build
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: ${{fromJSON(inputs.runner-os)}}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Download distribution if required
|
||||||
|
uses: ./.github/actions/download-dist
|
||||||
- name: Setup Gradle
|
- name: Setup Gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
|
with:
|
||||||
|
cache-read-only: true
|
||||||
- name: Build kotlin-dsl project
|
- name: Build kotlin-dsl project
|
||||||
working-directory: .github/workflow-samples/kotlin-dsl
|
working-directory: .github/workflow-samples/kotlin-dsl
|
||||||
run: ./gradlew build --offline
|
run: ./gradlew build --offline
|
37
.github/workflows/integTest-action-inputs.yml
vendored
37
.github/workflows/integTest-action-inputs.yml
vendored
|
@ -1,37 +0,0 @@
|
||||||
name: Test different action inputs
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [assigned, review_requested]
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- '.github/**'
|
|
||||||
- 'dist/**'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}
|
|
||||||
|
|
||||||
env:
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
action-inputs:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Invoke with multi-line arguments
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
|
||||||
arguments: |
|
|
||||||
--configuration-cache
|
|
||||||
--build-cache
|
|
||||||
-DsystemProperty=FOO
|
|
||||||
-PgradleProperty=BAR
|
|
||||||
test
|
|
||||||
jar
|
|
|
@ -1,49 +0,0 @@
|
||||||
name: Test save/restore Gradle state with direct execution
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [assigned, review_requested]
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- '.github/**'
|
|
||||||
- 'dist/**'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}
|
|
||||||
|
|
||||||
env:
|
|
||||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
seed-build:
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Execute Gradle build
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
|
||||||
arguments: test
|
|
||||||
|
|
||||||
# Test that the gradle-user-home is restored
|
|
||||||
verify-build:
|
|
||||||
needs: seed-build
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout sources
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Execute Gradle build
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
cache-read-only: true
|
|
||||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
|
||||||
arguments: test --offline -DverifyCachedBuild=true
|
|
||||||
|
|
28
.github/workflows/purge-old-workflow-runs.yml
vendored
Normal file
28
.github/workflows/purge-old-workflow-runs.yml
vendored
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
name: Purgee old workflow runs
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
days:
|
||||||
|
description: 'Purge runs older than days'
|
||||||
|
required: true
|
||||||
|
default: 30
|
||||||
|
minimum_runs:
|
||||||
|
description: 'The minimum runs to keep for each workflow.'
|
||||||
|
required: true
|
||||||
|
default: 6
|
||||||
|
delete_workflow_pattern:
|
||||||
|
description: 'The name of the workflow. if not set then it will target all workflows.'
|
||||||
|
required: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
del_runs:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Purge workflow runs
|
||||||
|
uses: Mattraks/delete-workflow-runs@v2
|
||||||
|
with:
|
||||||
|
token: ${{ github.token }}
|
||||||
|
repository: ${{ github.repository }}
|
||||||
|
retain_days: ${{ github.event.inputs.days }}
|
||||||
|
keep_minimum_runs: ${{ github.event.inputs.minimum_runs }}
|
||||||
|
delete_workflow_pattern: ${{ github.event.inputs.delete_workflow_pattern }}
|
74
dist/main/index.js
vendored
74
dist/main/index.js
vendored
|
@ -64846,36 +64846,15 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.GradleStateCache = exports.PROJECT_ROOTS_FILE = exports.META_FILE_DIR = void 0;
|
exports.GradleStateCache = exports.PROJECT_ROOTS_FILE = exports.META_FILE_DIR = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const exec = __importStar(__nccwpck_require__(1514));
|
const exec = __importStar(__nccwpck_require__(1514));
|
||||||
const github = __importStar(__nccwpck_require__(5438));
|
|
||||||
const path_1 = __importDefault(__nccwpck_require__(1017));
|
const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||||
const cache_utils_1 = __nccwpck_require__(1678);
|
const cache_utils_1 = __nccwpck_require__(1678);
|
||||||
const cache_extract_entries_1 = __nccwpck_require__(6161);
|
const cache_extract_entries_1 = __nccwpck_require__(6161);
|
||||||
const CACHE_PROTOCOL_VERSION = 'v6-';
|
|
||||||
const RESTORED_CACHE_KEY_KEY = 'restored-cache-key';
|
const RESTORED_CACHE_KEY_KEY = 'restored-cache-key';
|
||||||
exports.META_FILE_DIR = '.gradle-build-action';
|
exports.META_FILE_DIR = '.gradle-build-action';
|
||||||
exports.PROJECT_ROOTS_FILE = 'project-roots.txt';
|
exports.PROJECT_ROOTS_FILE = 'project-roots.txt';
|
||||||
const INCLUDE_PATHS_PARAMETER = 'gradle-home-cache-includes';
|
const INCLUDE_PATHS_PARAMETER = 'gradle-home-cache-includes';
|
||||||
const EXCLUDE_PATHS_PARAMETER = 'gradle-home-cache-excludes';
|
const EXCLUDE_PATHS_PARAMETER = 'gradle-home-cache-excludes';
|
||||||
const STRICT_CACHE_MATCH_PARAMETER = 'gradle-home-cache-strict-match';
|
|
||||||
class CacheKey {
|
|
||||||
constructor(key, restoreKeys) {
|
|
||||||
this.key = key;
|
|
||||||
this.restoreKeys = restoreKeys;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function generateCacheKey(cacheName) {
|
|
||||||
const cacheKeyBase = `${(0, cache_utils_1.getCacheKeyPrefix)()}${CACHE_PROTOCOL_VERSION}${cacheName}`;
|
|
||||||
const runnerOs = process.env['RUNNER_OS'] || '';
|
|
||||||
const cacheKeyForOs = `${cacheKeyBase}|${runnerOs}`;
|
|
||||||
const cacheKeyForJob = `${cacheKeyForOs}|${github.context.job}`;
|
|
||||||
const cacheKeyForJobContext = `${cacheKeyForJob}[${(0, cache_utils_1.determineJobContext)()}]`;
|
|
||||||
const cacheKey = `${cacheKeyForJobContext}-${github.context.sha}`;
|
|
||||||
if (core.getBooleanInput(STRICT_CACHE_MATCH_PARAMETER)) {
|
|
||||||
return new CacheKey(cacheKey, [cacheKeyForJobContext]);
|
|
||||||
}
|
|
||||||
return new CacheKey(cacheKey, [cacheKeyForJobContext, cacheKeyForJob, cacheKeyForOs]);
|
|
||||||
}
|
|
||||||
class GradleStateCache {
|
class GradleStateCache {
|
||||||
constructor(gradleUserHome) {
|
constructor(gradleUserHome) {
|
||||||
this.gradleUserHome = gradleUserHome;
|
this.gradleUserHome = gradleUserHome;
|
||||||
|
@ -64900,7 +64879,7 @@ class GradleStateCache {
|
||||||
restore(listener) {
|
restore(listener) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const entryListener = listener.entry(this.cacheDescription);
|
const entryListener = listener.entry(this.cacheDescription);
|
||||||
const cacheKey = generateCacheKey(this.cacheName);
|
const cacheKey = (0, cache_utils_1.generateCacheKey)(this.cacheName);
|
||||||
(0, cache_utils_1.cacheDebug)(`Requesting ${this.cacheDescription} with
|
(0, cache_utils_1.cacheDebug)(`Requesting ${this.cacheDescription} with
|
||||||
key:${cacheKey.key}
|
key:${cacheKey.key}
|
||||||
restoreKeys:[${cacheKey.restoreKeys}]`);
|
restoreKeys:[${cacheKey.restoreKeys}]`);
|
||||||
|
@ -64929,7 +64908,7 @@ class GradleStateCache {
|
||||||
}
|
}
|
||||||
save(listener) {
|
save(listener) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const cacheKey = generateCacheKey(this.cacheName).key;
|
const cacheKey = (0, cache_utils_1.generateCacheKey)(this.cacheName).key;
|
||||||
const restoredCacheKey = core.getState(RESTORED_CACHE_KEY_KEY);
|
const restoredCacheKey = core.getState(RESTORED_CACHE_KEY_KEY);
|
||||||
if (restoredCacheKey && cacheKey === restoredCacheKey) {
|
if (restoredCacheKey && cacheKey === restoredCacheKey) {
|
||||||
core.info(`Cache hit occurred on the cache key ${cacheKey}, not saving cache.`);
|
core.info(`Cache hit occurred on the cache key ${cacheKey}, not saving cache.`);
|
||||||
|
@ -65546,18 +65525,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.tryDelete = exports.handleCacheFailure = exports.cacheDebug = exports.saveCache = exports.restoreCache = exports.hashStrings = exports.hashFileNames = exports.determineJobContext = exports.getCacheKeyPrefix = exports.isCacheDebuggingEnabled = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
|
exports.tryDelete = exports.handleCacheFailure = exports.cacheDebug = exports.saveCache = exports.restoreCache = exports.hashStrings = exports.hashFileNames = exports.getCacheKeyPrefix = exports.generateCacheKey = exports.CacheKey = exports.isCacheDebuggingEnabled = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const cache = __importStar(__nccwpck_require__(7799));
|
const cache = __importStar(__nccwpck_require__(7799));
|
||||||
|
const github = __importStar(__nccwpck_require__(5438));
|
||||||
const crypto = __importStar(__nccwpck_require__(6113));
|
const crypto = __importStar(__nccwpck_require__(6113));
|
||||||
const path = __importStar(__nccwpck_require__(1017));
|
const path = __importStar(__nccwpck_require__(1017));
|
||||||
const fs = __importStar(__nccwpck_require__(7147));
|
const fs = __importStar(__nccwpck_require__(7147));
|
||||||
|
const CACHE_PROTOCOL_VERSION = 'v6-';
|
||||||
const JOB_CONTEXT_PARAMETER = 'workflow-job-context';
|
const JOB_CONTEXT_PARAMETER = 'workflow-job-context';
|
||||||
const CACHE_DISABLED_PARAMETER = 'cache-disabled';
|
const CACHE_DISABLED_PARAMETER = 'cache-disabled';
|
||||||
const CACHE_READONLY_PARAMETER = 'cache-read-only';
|
const CACHE_READONLY_PARAMETER = 'cache-read-only';
|
||||||
const CACHE_WRITEONLY_PARAMETER = 'cache-write-only';
|
const CACHE_WRITEONLY_PARAMETER = 'cache-write-only';
|
||||||
|
const STRICT_CACHE_MATCH_PARAMETER = 'gradle-home-cache-strict-match';
|
||||||
const CACHE_DEBUG_VAR = 'GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED';
|
const CACHE_DEBUG_VAR = 'GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED';
|
||||||
const CACHE_PREFIX_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX';
|
const CACHE_KEY_PREFIX_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX';
|
||||||
|
const CACHE_KEY_OS_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_ENVIRONMENT';
|
||||||
|
const CACHE_KEY_JOB_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB';
|
||||||
|
const CACHE_KEY_JOB_INSTANCE_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB_INSTANCE';
|
||||||
|
const CACHE_KEY_JOB_EXECUTION_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION';
|
||||||
function isCacheDisabled() {
|
function isCacheDisabled() {
|
||||||
return core.getBooleanInput(CACHE_DISABLED_PARAMETER);
|
return core.getBooleanInput(CACHE_DISABLED_PARAMETER);
|
||||||
}
|
}
|
||||||
|
@ -65574,15 +65560,47 @@ function isCacheDebuggingEnabled() {
|
||||||
return process.env[CACHE_DEBUG_VAR] ? true : false;
|
return process.env[CACHE_DEBUG_VAR] ? true : false;
|
||||||
}
|
}
|
||||||
exports.isCacheDebuggingEnabled = isCacheDebuggingEnabled;
|
exports.isCacheDebuggingEnabled = isCacheDebuggingEnabled;
|
||||||
|
class CacheKey {
|
||||||
|
constructor(key, restoreKeys) {
|
||||||
|
this.key = key;
|
||||||
|
this.restoreKeys = restoreKeys;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.CacheKey = CacheKey;
|
||||||
|
function generateCacheKey(cacheName) {
|
||||||
|
const cacheKeyBase = `${getCacheKeyPrefix()}${CACHE_PROTOCOL_VERSION}${cacheName}`;
|
||||||
|
const cacheKeyForEnvironment = `${cacheKeyBase}|${getCacheKeyEnvironment()}`;
|
||||||
|
const cacheKeyForJob = `${cacheKeyForEnvironment}|${getCacheKeyJob()}`;
|
||||||
|
const cacheKeyForJobContext = `${cacheKeyForJob}[${getCacheKeyJobInstance()}]`;
|
||||||
|
const cacheKey = `${cacheKeyForJobContext}-${getCacheKeyJobExecution()}`;
|
||||||
|
if (core.getBooleanInput(STRICT_CACHE_MATCH_PARAMETER)) {
|
||||||
|
return new CacheKey(cacheKey, [cacheKeyForJobContext]);
|
||||||
|
}
|
||||||
|
return new CacheKey(cacheKey, [cacheKeyForJobContext, cacheKeyForJob, cacheKeyForEnvironment]);
|
||||||
|
}
|
||||||
|
exports.generateCacheKey = generateCacheKey;
|
||||||
function getCacheKeyPrefix() {
|
function getCacheKeyPrefix() {
|
||||||
return process.env[CACHE_PREFIX_VAR] || '';
|
return process.env[CACHE_KEY_PREFIX_VAR] || '';
|
||||||
}
|
}
|
||||||
exports.getCacheKeyPrefix = getCacheKeyPrefix;
|
exports.getCacheKeyPrefix = getCacheKeyPrefix;
|
||||||
function determineJobContext() {
|
function getCacheKeyEnvironment() {
|
||||||
|
const runnerOs = process.env['RUNNER_OS'] || '';
|
||||||
|
return process.env[CACHE_KEY_OS_VAR] || runnerOs;
|
||||||
|
}
|
||||||
|
function getCacheKeyJob() {
|
||||||
|
return process.env[CACHE_KEY_JOB_VAR] || github.context.job;
|
||||||
|
}
|
||||||
|
function getCacheKeyJobInstance() {
|
||||||
|
const override = process.env[CACHE_KEY_JOB_INSTANCE_VAR];
|
||||||
|
if (override) {
|
||||||
|
return override;
|
||||||
|
}
|
||||||
const workflowJobContext = core.getInput(JOB_CONTEXT_PARAMETER);
|
const workflowJobContext = core.getInput(JOB_CONTEXT_PARAMETER);
|
||||||
return hashStrings([workflowJobContext]);
|
return hashStrings([workflowJobContext]);
|
||||||
}
|
}
|
||||||
exports.determineJobContext = determineJobContext;
|
function getCacheKeyJobExecution() {
|
||||||
|
return process.env[CACHE_KEY_JOB_EXECUTION_VAR] || github.context.sha;
|
||||||
|
}
|
||||||
function hashFileNames(fileNames) {
|
function hashFileNames(fileNames) {
|
||||||
return hashStrings(fileNames.map(x => x.replace(new RegExp(`\\${path.sep}`, 'g'), '/')));
|
return hashStrings(fileNames.map(x => x.replace(new RegExp(`\\${path.sep}`, 'g'), '/')));
|
||||||
}
|
}
|
||||||
|
|
2
dist/main/index.js.map
vendored
2
dist/main/index.js.map
vendored
File diff suppressed because one or more lines are too long
74
dist/post/index.js
vendored
74
dist/post/index.js
vendored
|
@ -63897,36 +63897,15 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.GradleStateCache = exports.PROJECT_ROOTS_FILE = exports.META_FILE_DIR = void 0;
|
exports.GradleStateCache = exports.PROJECT_ROOTS_FILE = exports.META_FILE_DIR = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const exec = __importStar(__nccwpck_require__(1514));
|
const exec = __importStar(__nccwpck_require__(1514));
|
||||||
const github = __importStar(__nccwpck_require__(5438));
|
|
||||||
const path_1 = __importDefault(__nccwpck_require__(1017));
|
const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||||
const cache_utils_1 = __nccwpck_require__(1678);
|
const cache_utils_1 = __nccwpck_require__(1678);
|
||||||
const cache_extract_entries_1 = __nccwpck_require__(6161);
|
const cache_extract_entries_1 = __nccwpck_require__(6161);
|
||||||
const CACHE_PROTOCOL_VERSION = 'v6-';
|
|
||||||
const RESTORED_CACHE_KEY_KEY = 'restored-cache-key';
|
const RESTORED_CACHE_KEY_KEY = 'restored-cache-key';
|
||||||
exports.META_FILE_DIR = '.gradle-build-action';
|
exports.META_FILE_DIR = '.gradle-build-action';
|
||||||
exports.PROJECT_ROOTS_FILE = 'project-roots.txt';
|
exports.PROJECT_ROOTS_FILE = 'project-roots.txt';
|
||||||
const INCLUDE_PATHS_PARAMETER = 'gradle-home-cache-includes';
|
const INCLUDE_PATHS_PARAMETER = 'gradle-home-cache-includes';
|
||||||
const EXCLUDE_PATHS_PARAMETER = 'gradle-home-cache-excludes';
|
const EXCLUDE_PATHS_PARAMETER = 'gradle-home-cache-excludes';
|
||||||
const STRICT_CACHE_MATCH_PARAMETER = 'gradle-home-cache-strict-match';
|
|
||||||
class CacheKey {
|
|
||||||
constructor(key, restoreKeys) {
|
|
||||||
this.key = key;
|
|
||||||
this.restoreKeys = restoreKeys;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function generateCacheKey(cacheName) {
|
|
||||||
const cacheKeyBase = `${(0, cache_utils_1.getCacheKeyPrefix)()}${CACHE_PROTOCOL_VERSION}${cacheName}`;
|
|
||||||
const runnerOs = process.env['RUNNER_OS'] || '';
|
|
||||||
const cacheKeyForOs = `${cacheKeyBase}|${runnerOs}`;
|
|
||||||
const cacheKeyForJob = `${cacheKeyForOs}|${github.context.job}`;
|
|
||||||
const cacheKeyForJobContext = `${cacheKeyForJob}[${(0, cache_utils_1.determineJobContext)()}]`;
|
|
||||||
const cacheKey = `${cacheKeyForJobContext}-${github.context.sha}`;
|
|
||||||
if (core.getBooleanInput(STRICT_CACHE_MATCH_PARAMETER)) {
|
|
||||||
return new CacheKey(cacheKey, [cacheKeyForJobContext]);
|
|
||||||
}
|
|
||||||
return new CacheKey(cacheKey, [cacheKeyForJobContext, cacheKeyForJob, cacheKeyForOs]);
|
|
||||||
}
|
|
||||||
class GradleStateCache {
|
class GradleStateCache {
|
||||||
constructor(gradleUserHome) {
|
constructor(gradleUserHome) {
|
||||||
this.gradleUserHome = gradleUserHome;
|
this.gradleUserHome = gradleUserHome;
|
||||||
|
@ -63951,7 +63930,7 @@ class GradleStateCache {
|
||||||
restore(listener) {
|
restore(listener) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const entryListener = listener.entry(this.cacheDescription);
|
const entryListener = listener.entry(this.cacheDescription);
|
||||||
const cacheKey = generateCacheKey(this.cacheName);
|
const cacheKey = (0, cache_utils_1.generateCacheKey)(this.cacheName);
|
||||||
(0, cache_utils_1.cacheDebug)(`Requesting ${this.cacheDescription} with
|
(0, cache_utils_1.cacheDebug)(`Requesting ${this.cacheDescription} with
|
||||||
key:${cacheKey.key}
|
key:${cacheKey.key}
|
||||||
restoreKeys:[${cacheKey.restoreKeys}]`);
|
restoreKeys:[${cacheKey.restoreKeys}]`);
|
||||||
|
@ -63980,7 +63959,7 @@ class GradleStateCache {
|
||||||
}
|
}
|
||||||
save(listener) {
|
save(listener) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const cacheKey = generateCacheKey(this.cacheName).key;
|
const cacheKey = (0, cache_utils_1.generateCacheKey)(this.cacheName).key;
|
||||||
const restoredCacheKey = core.getState(RESTORED_CACHE_KEY_KEY);
|
const restoredCacheKey = core.getState(RESTORED_CACHE_KEY_KEY);
|
||||||
if (restoredCacheKey && cacheKey === restoredCacheKey) {
|
if (restoredCacheKey && cacheKey === restoredCacheKey) {
|
||||||
core.info(`Cache hit occurred on the cache key ${cacheKey}, not saving cache.`);
|
core.info(`Cache hit occurred on the cache key ${cacheKey}, not saving cache.`);
|
||||||
|
@ -64597,18 +64576,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.tryDelete = exports.handleCacheFailure = exports.cacheDebug = exports.saveCache = exports.restoreCache = exports.hashStrings = exports.hashFileNames = exports.determineJobContext = exports.getCacheKeyPrefix = exports.isCacheDebuggingEnabled = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
|
exports.tryDelete = exports.handleCacheFailure = exports.cacheDebug = exports.saveCache = exports.restoreCache = exports.hashStrings = exports.hashFileNames = exports.getCacheKeyPrefix = exports.generateCacheKey = exports.CacheKey = exports.isCacheDebuggingEnabled = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const cache = __importStar(__nccwpck_require__(7799));
|
const cache = __importStar(__nccwpck_require__(7799));
|
||||||
|
const github = __importStar(__nccwpck_require__(5438));
|
||||||
const crypto = __importStar(__nccwpck_require__(6113));
|
const crypto = __importStar(__nccwpck_require__(6113));
|
||||||
const path = __importStar(__nccwpck_require__(1017));
|
const path = __importStar(__nccwpck_require__(1017));
|
||||||
const fs = __importStar(__nccwpck_require__(7147));
|
const fs = __importStar(__nccwpck_require__(7147));
|
||||||
|
const CACHE_PROTOCOL_VERSION = 'v6-';
|
||||||
const JOB_CONTEXT_PARAMETER = 'workflow-job-context';
|
const JOB_CONTEXT_PARAMETER = 'workflow-job-context';
|
||||||
const CACHE_DISABLED_PARAMETER = 'cache-disabled';
|
const CACHE_DISABLED_PARAMETER = 'cache-disabled';
|
||||||
const CACHE_READONLY_PARAMETER = 'cache-read-only';
|
const CACHE_READONLY_PARAMETER = 'cache-read-only';
|
||||||
const CACHE_WRITEONLY_PARAMETER = 'cache-write-only';
|
const CACHE_WRITEONLY_PARAMETER = 'cache-write-only';
|
||||||
|
const STRICT_CACHE_MATCH_PARAMETER = 'gradle-home-cache-strict-match';
|
||||||
const CACHE_DEBUG_VAR = 'GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED';
|
const CACHE_DEBUG_VAR = 'GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED';
|
||||||
const CACHE_PREFIX_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX';
|
const CACHE_KEY_PREFIX_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX';
|
||||||
|
const CACHE_KEY_OS_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_ENVIRONMENT';
|
||||||
|
const CACHE_KEY_JOB_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB';
|
||||||
|
const CACHE_KEY_JOB_INSTANCE_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB_INSTANCE';
|
||||||
|
const CACHE_KEY_JOB_EXECUTION_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION';
|
||||||
function isCacheDisabled() {
|
function isCacheDisabled() {
|
||||||
return core.getBooleanInput(CACHE_DISABLED_PARAMETER);
|
return core.getBooleanInput(CACHE_DISABLED_PARAMETER);
|
||||||
}
|
}
|
||||||
|
@ -64625,15 +64611,47 @@ function isCacheDebuggingEnabled() {
|
||||||
return process.env[CACHE_DEBUG_VAR] ? true : false;
|
return process.env[CACHE_DEBUG_VAR] ? true : false;
|
||||||
}
|
}
|
||||||
exports.isCacheDebuggingEnabled = isCacheDebuggingEnabled;
|
exports.isCacheDebuggingEnabled = isCacheDebuggingEnabled;
|
||||||
|
class CacheKey {
|
||||||
|
constructor(key, restoreKeys) {
|
||||||
|
this.key = key;
|
||||||
|
this.restoreKeys = restoreKeys;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.CacheKey = CacheKey;
|
||||||
|
function generateCacheKey(cacheName) {
|
||||||
|
const cacheKeyBase = `${getCacheKeyPrefix()}${CACHE_PROTOCOL_VERSION}${cacheName}`;
|
||||||
|
const cacheKeyForEnvironment = `${cacheKeyBase}|${getCacheKeyEnvironment()}`;
|
||||||
|
const cacheKeyForJob = `${cacheKeyForEnvironment}|${getCacheKeyJob()}`;
|
||||||
|
const cacheKeyForJobContext = `${cacheKeyForJob}[${getCacheKeyJobInstance()}]`;
|
||||||
|
const cacheKey = `${cacheKeyForJobContext}-${getCacheKeyJobExecution()}`;
|
||||||
|
if (core.getBooleanInput(STRICT_CACHE_MATCH_PARAMETER)) {
|
||||||
|
return new CacheKey(cacheKey, [cacheKeyForJobContext]);
|
||||||
|
}
|
||||||
|
return new CacheKey(cacheKey, [cacheKeyForJobContext, cacheKeyForJob, cacheKeyForEnvironment]);
|
||||||
|
}
|
||||||
|
exports.generateCacheKey = generateCacheKey;
|
||||||
function getCacheKeyPrefix() {
|
function getCacheKeyPrefix() {
|
||||||
return process.env[CACHE_PREFIX_VAR] || '';
|
return process.env[CACHE_KEY_PREFIX_VAR] || '';
|
||||||
}
|
}
|
||||||
exports.getCacheKeyPrefix = getCacheKeyPrefix;
|
exports.getCacheKeyPrefix = getCacheKeyPrefix;
|
||||||
function determineJobContext() {
|
function getCacheKeyEnvironment() {
|
||||||
|
const runnerOs = process.env['RUNNER_OS'] || '';
|
||||||
|
return process.env[CACHE_KEY_OS_VAR] || runnerOs;
|
||||||
|
}
|
||||||
|
function getCacheKeyJob() {
|
||||||
|
return process.env[CACHE_KEY_JOB_VAR] || github.context.job;
|
||||||
|
}
|
||||||
|
function getCacheKeyJobInstance() {
|
||||||
|
const override = process.env[CACHE_KEY_JOB_INSTANCE_VAR];
|
||||||
|
if (override) {
|
||||||
|
return override;
|
||||||
|
}
|
||||||
const workflowJobContext = core.getInput(JOB_CONTEXT_PARAMETER);
|
const workflowJobContext = core.getInput(JOB_CONTEXT_PARAMETER);
|
||||||
return hashStrings([workflowJobContext]);
|
return hashStrings([workflowJobContext]);
|
||||||
}
|
}
|
||||||
exports.determineJobContext = determineJobContext;
|
function getCacheKeyJobExecution() {
|
||||||
|
return process.env[CACHE_KEY_JOB_EXECUTION_VAR] || github.context.sha;
|
||||||
|
}
|
||||||
function hashFileNames(fileNames) {
|
function hashFileNames(fileNames) {
|
||||||
return hashStrings(fileNames.map(x => x.replace(new RegExp(`\\${path.sep}`, 'g'), '/')));
|
return hashStrings(fileNames.map(x => x.replace(new RegExp(`\\${path.sep}`, 'g'), '/')));
|
||||||
}
|
}
|
||||||
|
|
2
dist/post/index.js.map
vendored
2
dist/post/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
@ -1,83 +1,17 @@
|
||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import * as exec from '@actions/exec'
|
import * as exec from '@actions/exec'
|
||||||
import * as github from '@actions/github'
|
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import {CacheListener} from './cache-reporting'
|
import {CacheListener} from './cache-reporting'
|
||||||
import {
|
import {saveCache, restoreCache, cacheDebug, isCacheDebuggingEnabled, tryDelete, generateCacheKey} from './cache-utils'
|
||||||
getCacheKeyPrefix,
|
|
||||||
determineJobContext,
|
|
||||||
saveCache,
|
|
||||||
restoreCache,
|
|
||||||
cacheDebug,
|
|
||||||
isCacheDebuggingEnabled,
|
|
||||||
tryDelete
|
|
||||||
} from './cache-utils'
|
|
||||||
import {ConfigurationCacheEntryExtractor, GradleHomeEntryExtractor} from './cache-extract-entries'
|
import {ConfigurationCacheEntryExtractor, GradleHomeEntryExtractor} from './cache-extract-entries'
|
||||||
|
|
||||||
const CACHE_PROTOCOL_VERSION = 'v6-'
|
|
||||||
const RESTORED_CACHE_KEY_KEY = 'restored-cache-key'
|
const RESTORED_CACHE_KEY_KEY = 'restored-cache-key'
|
||||||
|
|
||||||
export const META_FILE_DIR = '.gradle-build-action'
|
export const META_FILE_DIR = '.gradle-build-action'
|
||||||
export const PROJECT_ROOTS_FILE = 'project-roots.txt'
|
export const PROJECT_ROOTS_FILE = 'project-roots.txt'
|
||||||
const INCLUDE_PATHS_PARAMETER = 'gradle-home-cache-includes'
|
const INCLUDE_PATHS_PARAMETER = 'gradle-home-cache-includes'
|
||||||
const EXCLUDE_PATHS_PARAMETER = 'gradle-home-cache-excludes'
|
const EXCLUDE_PATHS_PARAMETER = 'gradle-home-cache-excludes'
|
||||||
const STRICT_CACHE_MATCH_PARAMETER = 'gradle-home-cache-strict-match'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a key used to restore a cache entry.
|
|
||||||
* The Github Actions cache will first try for an exact match on the key.
|
|
||||||
* If that fails, it will try for a prefix match on any of the restoreKeys.
|
|
||||||
*/
|
|
||||||
class CacheKey {
|
|
||||||
key: string
|
|
||||||
restoreKeys: string[]
|
|
||||||
|
|
||||||
constructor(key: string, restoreKeys: string[]) {
|
|
||||||
this.key = key
|
|
||||||
this.restoreKeys = restoreKeys
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates a cache key specific to the current job execution.
|
|
||||||
* The key is constructed from the following inputs:
|
|
||||||
* - A user-defined prefix (optional)
|
|
||||||
* - The cache protocol version
|
|
||||||
* - The name of the cache
|
|
||||||
* - The runner operating system
|
|
||||||
* - The name of the Job being executed
|
|
||||||
* - The matrix values for the Job being executed (job context)
|
|
||||||
* - The SHA of the commit being executed
|
|
||||||
*
|
|
||||||
* Caches are restored by trying to match the these key prefixes in order:
|
|
||||||
* - The full key with SHA
|
|
||||||
* - A previous key for this Job + matrix
|
|
||||||
* - Any previous key for this Job (any matrix)
|
|
||||||
* - Any previous key for this cache on the current OS
|
|
||||||
*/
|
|
||||||
function generateCacheKey(cacheName: string): CacheKey {
|
|
||||||
const cacheKeyBase = `${getCacheKeyPrefix()}${CACHE_PROTOCOL_VERSION}${cacheName}`
|
|
||||||
|
|
||||||
// At the most general level, share caches for all executions on the same OS
|
|
||||||
const runnerOs = process.env['RUNNER_OS'] || ''
|
|
||||||
const cacheKeyForOs = `${cacheKeyBase}|${runnerOs}`
|
|
||||||
|
|
||||||
// Prefer caches that run this job
|
|
||||||
const cacheKeyForJob = `${cacheKeyForOs}|${github.context.job}`
|
|
||||||
|
|
||||||
// Prefer (even more) jobs that run this job with the same context (matrix)
|
|
||||||
const cacheKeyForJobContext = `${cacheKeyForJob}[${determineJobContext()}]`
|
|
||||||
|
|
||||||
// Exact match on Git SHA
|
|
||||||
const cacheKey = `${cacheKeyForJobContext}-${github.context.sha}`
|
|
||||||
|
|
||||||
if (core.getBooleanInput(STRICT_CACHE_MATCH_PARAMETER)) {
|
|
||||||
return new CacheKey(cacheKey, [cacheKeyForJobContext])
|
|
||||||
}
|
|
||||||
|
|
||||||
return new CacheKey(cacheKey, [cacheKeyForJobContext, cacheKeyForJob, cacheKeyForOs])
|
|
||||||
}
|
|
||||||
|
|
||||||
export class GradleStateCache {
|
export class GradleStateCache {
|
||||||
private cacheName: string
|
private cacheName: string
|
||||||
|
|
|
@ -1,17 +1,26 @@
|
||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import * as cache from '@actions/cache'
|
import * as cache from '@actions/cache'
|
||||||
|
import * as github from '@actions/github'
|
||||||
import * as crypto from 'crypto'
|
import * as crypto from 'crypto'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
|
|
||||||
import {CacheEntryListener} from './cache-reporting'
|
import {CacheEntryListener} from './cache-reporting'
|
||||||
|
|
||||||
|
const CACHE_PROTOCOL_VERSION = 'v6-'
|
||||||
|
|
||||||
const JOB_CONTEXT_PARAMETER = 'workflow-job-context'
|
const JOB_CONTEXT_PARAMETER = 'workflow-job-context'
|
||||||
const CACHE_DISABLED_PARAMETER = 'cache-disabled'
|
const CACHE_DISABLED_PARAMETER = 'cache-disabled'
|
||||||
const CACHE_READONLY_PARAMETER = 'cache-read-only'
|
const CACHE_READONLY_PARAMETER = 'cache-read-only'
|
||||||
const CACHE_WRITEONLY_PARAMETER = 'cache-write-only'
|
const CACHE_WRITEONLY_PARAMETER = 'cache-write-only'
|
||||||
|
const STRICT_CACHE_MATCH_PARAMETER = 'gradle-home-cache-strict-match'
|
||||||
const CACHE_DEBUG_VAR = 'GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED'
|
const CACHE_DEBUG_VAR = 'GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED'
|
||||||
const CACHE_PREFIX_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX'
|
|
||||||
|
const CACHE_KEY_PREFIX_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX'
|
||||||
|
const CACHE_KEY_OS_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_ENVIRONMENT'
|
||||||
|
const CACHE_KEY_JOB_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB'
|
||||||
|
const CACHE_KEY_JOB_INSTANCE_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB_INSTANCE'
|
||||||
|
const CACHE_KEY_JOB_EXECUTION_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION'
|
||||||
|
|
||||||
export function isCacheDisabled(): boolean {
|
export function isCacheDisabled(): boolean {
|
||||||
return core.getBooleanInput(CACHE_DISABLED_PARAMETER)
|
return core.getBooleanInput(CACHE_DISABLED_PARAMETER)
|
||||||
|
@ -29,18 +38,91 @@ export function isCacheDebuggingEnabled(): boolean {
|
||||||
return process.env[CACHE_DEBUG_VAR] ? true : false
|
return process.env[CACHE_DEBUG_VAR] ? true : false
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCacheKeyPrefix(): string {
|
/**
|
||||||
// Prefix can be used to force change all cache keys (defaults to cache protocol version)
|
* Represents a key used to restore a cache entry.
|
||||||
return process.env[CACHE_PREFIX_VAR] || ''
|
* The Github Actions cache will first try for an exact match on the key.
|
||||||
|
* If that fails, it will try for a prefix match on any of the restoreKeys.
|
||||||
|
*/
|
||||||
|
export class CacheKey {
|
||||||
|
key: string
|
||||||
|
restoreKeys: string[]
|
||||||
|
|
||||||
|
constructor(key: string, restoreKeys: string[]) {
|
||||||
|
this.key = key
|
||||||
|
this.restoreKeys = restoreKeys
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function determineJobContext(): string {
|
/**
|
||||||
|
* Generates a cache key specific to the current job execution.
|
||||||
|
* The key is constructed from the following inputs (with some user overrides):
|
||||||
|
* - The cache protocol version
|
||||||
|
* - The name of the cache
|
||||||
|
* - The runner operating system
|
||||||
|
* - The name of the Job being executed
|
||||||
|
* - The matrix values for the Job being executed (job context)
|
||||||
|
* - The SHA of the commit being executed
|
||||||
|
*
|
||||||
|
* Caches are restored by trying to match the these key prefixes in order:
|
||||||
|
* - The full key with SHA
|
||||||
|
* - A previous key for this Job + matrix
|
||||||
|
* - Any previous key for this Job (any matrix)
|
||||||
|
* - Any previous key for this cache on the current OS
|
||||||
|
*/
|
||||||
|
export function generateCacheKey(cacheName: string): CacheKey {
|
||||||
|
const cacheKeyBase = `${getCacheKeyPrefix()}${CACHE_PROTOCOL_VERSION}${cacheName}`
|
||||||
|
|
||||||
|
// At the most general level, share caches for all executions on the same OS
|
||||||
|
const cacheKeyForEnvironment = `${cacheKeyBase}|${getCacheKeyEnvironment()}`
|
||||||
|
|
||||||
|
// Prefer caches that run this job
|
||||||
|
const cacheKeyForJob = `${cacheKeyForEnvironment}|${getCacheKeyJob()}`
|
||||||
|
|
||||||
|
// Prefer (even more) jobs that run this job with the same context (matrix)
|
||||||
|
const cacheKeyForJobContext = `${cacheKeyForJob}[${getCacheKeyJobInstance()}]`
|
||||||
|
|
||||||
|
// Exact match on Git SHA
|
||||||
|
const cacheKey = `${cacheKeyForJobContext}-${getCacheKeyJobExecution()}`
|
||||||
|
|
||||||
|
if (core.getBooleanInput(STRICT_CACHE_MATCH_PARAMETER)) {
|
||||||
|
return new CacheKey(cacheKey, [cacheKeyForJobContext])
|
||||||
|
}
|
||||||
|
|
||||||
|
return new CacheKey(cacheKey, [cacheKeyForJobContext, cacheKeyForJob, cacheKeyForEnvironment])
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getCacheKeyPrefix(): string {
|
||||||
|
// Prefix can be used to force change all cache keys (defaults to cache protocol version)
|
||||||
|
return process.env[CACHE_KEY_PREFIX_VAR] || ''
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCacheKeyEnvironment(): string {
|
||||||
|
const runnerOs = process.env['RUNNER_OS'] || ''
|
||||||
|
return process.env[CACHE_KEY_OS_VAR] || runnerOs
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCacheKeyJob(): string {
|
||||||
|
// Prefix can be used to force change all cache keys (defaults to cache protocol version)
|
||||||
|
return process.env[CACHE_KEY_JOB_VAR] || github.context.job
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCacheKeyJobInstance(): string {
|
||||||
|
const override = process.env[CACHE_KEY_JOB_INSTANCE_VAR]
|
||||||
|
if (override) {
|
||||||
|
return override
|
||||||
|
}
|
||||||
|
|
||||||
// By default, we hash the full `matrix` data for the run, to uniquely identify this job invocation
|
// By default, we hash the full `matrix` data for the run, to uniquely identify this job invocation
|
||||||
// The only way we can obtain the `matrix` data is via the `workflow-job-context` parameter in action.yml.
|
// The only way we can obtain the `matrix` data is via the `workflow-job-context` parameter in action.yml.
|
||||||
const workflowJobContext = core.getInput(JOB_CONTEXT_PARAMETER)
|
const workflowJobContext = core.getInput(JOB_CONTEXT_PARAMETER)
|
||||||
return hashStrings([workflowJobContext])
|
return hashStrings([workflowJobContext])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCacheKeyJobExecution(): string {
|
||||||
|
// Used to associate a cache key with a particular execution (default is bound to the git commit sha)
|
||||||
|
return process.env[CACHE_KEY_JOB_EXECUTION_VAR] || github.context.sha
|
||||||
|
}
|
||||||
|
|
||||||
export function hashFileNames(fileNames: string[]): string {
|
export function hashFileNames(fileNames: string[]): string {
|
||||||
return hashStrings(fileNames.map(x => x.replace(new RegExp(`\\${path.sep}`, 'g'), '/')))
|
return hashStrings(fileNames.map(x => x.replace(new RegExp(`\\${path.sep}`, 'g'), '/')))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue