From adb0804712f0ea32899089f8c6cb10e7ac6b0aff Mon Sep 17 00:00:00 2001 From: Marvin W Date: Fri, 20 Dec 2024 11:56:18 +0100 Subject: [PATCH] Update GitHub Actions - Wrapper validation is done as part of setup-gradle, no need to do it ourselves, see https://github.com/gradle/actions/blob/main/docs/setup-gradle.md#gradle-wrapper-validation - Enable storing configuration cache accross builds - Submit dependencies from gradle to GitHub - Cache build outputs as well to reduce build time --- .github/workflows/build.yml | 15 ++++++++-- .github/workflows/dependency-submission.yml | 31 +++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/dependency-submission.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 963c9923a6..9c4349708d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,10 +22,13 @@ jobs: with: distribution: "temurin" java-version: "17" - - name: "Gradle Wrapper validation" - uses: gradle/actions/wrapper-validation@v4 - name: "Setup Gradle" uses: gradle/actions/setup-gradle@v4 + with: + cache-encryption-key: ${{ secrets.GradleEncryptionKey }} + build-scan-publish: true + build-scan-terms-of-use-url: "https://gradle.com/help/legal-terms-of-use" + build-scan-terms-of-use-agree: "yes" - name: "Setup matchers" run: | # Setting up matchers... @@ -43,6 +46,14 @@ jobs: echo "Matcher configured: ${NAME:?}" fi done + - name: "Cache Gradle build output" + uses: actions/cache@v4 + with: + path: | + **/build + key: gradle-build-v1-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + gradle-build-v1- - name: "Inspect Gradle tasks" run: "./gradlew tasks" - name: "Execute Gradle assemble" diff --git a/.github/workflows/dependency-submission.yml b/.github/workflows/dependency-submission.yml new file mode 100644 index 0000000000..e914528a88 --- /dev/null +++ b/.github/workflows/dependency-submission.yml @@ -0,0 +1,31 @@ +name: Dependency Submission +permissions: + contents: write +on: + push: + branches: [ 'master' ] + +jobs: + dependency-submission: + runs-on: ubuntu-latest + env: + GRADLE_MICROG_VERSION_WITHOUT_GIT: 1 + + steps: + - name: "Checkout sources" + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: "Setup Java" + uses: actions/setup-java@v4 + with: + distribution: "temurin" + java-version: "17" + - name: "Generate and submit gradle dependency graph" + uses: gradle/actions/dependency-submission@v4 + with: + cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} + dependency-graph-continue-on-failure: true + build-scan-publish: true + build-scan-terms-of-use-url: "https://gradle.com/help/legal-terms-of-use" + build-scan-terms-of-use-agree: "yes"