diff --git a/.github/workflows/cmd.yml b/.github/workflows/cmd.yml index ed30e74..07349f9 100644 --- a/.github/workflows/cmd.yml +++ b/.github/workflows/cmd.yml @@ -99,6 +99,17 @@ jobs: id: coursier-cache uses: coursier/cache-action@v6 + # Inspired by https://github.com/actions/setup-java/blob/45058d7f99afcd22834b58fde7cbfb7075eb48a2/src/cache.ts#L30-L44 + - name: Gradle Cache + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'gradle/*.versions.toml') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Custom Cache uses: actions/cache@v3 if: ${{ inputs.cache-key != '' && inputs.cache-path != '' }} diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml new file mode 100644 index 0000000..28f8b5b --- /dev/null +++ b/.github/workflows/gradle-wrapper-validation.yml @@ -0,0 +1,24 @@ +name: Gradle Wrapper Validation + +on: + workflow_call: + inputs: + ref: + type: string + required: false + default: '' + +jobs: + cmd: + name: Gradle Wrapper Validation + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves + fetch-depth: 0 + ref: ${{ inputs.ref }} + + - name: Gradle Wrapper Validation + uses: gradle/wrapper-validation-action@v1 diff --git a/README.md b/README.md index f597b98..166462f 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ This repository contains a few configurations of GitHub features. For example a * [Universal CMD task](#universal-cmd-task) * [Publishing to Sonatype](#publishing-to-sonatype) * [Validate Binary Compatibility](#validate-binary-compatibility) +* [Validate Gradle Wrapper](#validate-gradle-wrapper) * [Mark Pull Request as Ready To Merge](#mark-pull-request-as-ready-to-merge) * [Generate documentation with Antora](#generate-documentation-with-antora) @@ -126,6 +127,29 @@ This workflow is used for validate binary compatibility the current version. uses: playframework/.github/.github/workflows/binary-check.yml@v3 ``` +### Validate Gradle Wrapper + +This workflow is used to validate the checksums of [Gradle Wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html) JAR files present in the source tree and fails if unknown Gradle Wrapper JAR files are found. + +**Path**: [`.github/workflows/gradle-wrapper-validation.yml`](.github/workflows/gradle-wrapper-validation.yml) + +**Image**: [Ubuntu 20.04](https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2004-Readme.md) + +**Uses actions**: +* [Gradle/Wrapper Validation Action](https://github.com/gradle/wrapper-validation-action) + +**Parameters**: + +| Parameter | Since | Required | Default | Description | +|------------------------|-------|--------------------|---------|---------------------------------| +| ref | 3.3.0 | :heavy_minus_sign: | '' | Branch, tag or SHA for checkout | + +**How to use**: + +```yaml +uses: playframework/.github/.github/workflows/gradle-wrapper-validation.yml@v3 +``` + ### Mark Pull Request as Ready To Merge This workflow is used for mark pull request as ready to merge and **should be last** in the workflows chain.