From 147951f39de8f93eba6c7b0b7e6e5c9d2bce32e7 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Tue, 22 Jun 2021 14:13:22 +0200 Subject: ci: Optimize Gradle build performance in Github Actions This change updates the Github Actions Gradle workflows in order to improve the runtime performance of these workflows. We have now enabled build caching as well as parallel builds to speed up the build process. Moreover, we now cache the Gradle wrapper. --- .github/workflows/build.yml | 17 +++++++++++++---- .github/workflows/release.yml | 17 +++++++++++++---- 2 files changed, 26 insertions(+), 8 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 28e5846b..257ad2e3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,16 +26,25 @@ jobs: java-version: ${{ matrix.java }} - name: Grant execute permission for gradlew run: chmod +x gradlew - - uses: actions/cache@v1 + - uses: actions/cache@v2 with: - path: ~/.gradle/caches - key: ${{ runner.os }}-${{ matrix.java }}-gradle-${{ hashFiles('**/*.gradle*') }} + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-${{ matrix.java }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} restore-keys: | ${{ runner.os }}-${{ matrix.java }}-gradle- - name: Build with Gradle - run: ./gradlew assemble + run: ./gradlew classes - name: Check with Gradle run: ./gradlew check codeCoverageReport + - name: Cleanup Gradle Daemons + run: ./gradlew --stop + - name: Cleanup Gradle Cache + run: | + rm -f ~/.gradle/caches/modules-2/modules-2.lock + rm -f ~/.gradle/caches/modules-2/gc.properties + shell: bash - name: Publish report if: always() uses: mikepenz/action-junit-report@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f76cdd09..c525eb97 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ 15 ] + java: [ 16 ] steps: - name: Checkout repository uses: actions/checkout@v2 @@ -22,10 +22,12 @@ jobs: java-version: ${{ matrix.java }} - name: Grant execute permission for gradlew run: chmod +x gradlew - - uses: actions/cache@v1 + - uses: actions/cache@v2 with: - path: ~/.gradle/caches - key: ${{ runner.os }}-${{ matrix.java }}-gradle-${{ hashFiles('**/*.gradle*') }} + path:| + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-${{ matrix.java }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} restore-keys: | ${{ runner.os }}-${{ matrix.java }}-gradle- - name: Build with Gradle @@ -46,3 +48,10 @@ jobs: files: build/distributions/* env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Cleanup Gradle Daemons + run: ./gradlew --stop + - name: Cleanup Gradle Cache + run: | + rm -f ~/.gradle/caches/modules-2/modules-2.lock + rm -f ~/.gradle/caches/modules-2/gc.properties + shell: bash -- cgit v1.2.3