From 94fb91197a38d4d8812e38f29f82f2886ebc460a Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Sun, 18 Aug 2024 20:25:09 +0200 Subject: [PATCH] Add caching to workflows --- .forgejo/workflows/commit.yml | 54 ++++++++++++++++++++++++++++++ .forgejo/workflows/pullrequest.yml | 36 ++++++++++++++++++++ 2 files changed, 90 insertions(+) diff --git a/.forgejo/workflows/commit.yml b/.forgejo/workflows/commit.yml index a238d26..f5ed361 100644 --- a/.forgejo/workflows/commit.yml +++ b/.forgejo/workflows/commit.yml @@ -12,8 +12,26 @@ jobs: steps: - name: Checkout uses: https://code.forgejo.org/actions/checkout@v4 + - name: Restore Gradle cache + uses: actions/cache/restore@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + gradle-${{ runner.os }}- - name: Compile run: ./gradlew --no-daemon jar javadocJar sourceJar + - name: Save Gradle cache + uses: actions/cache/save@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + gradle-${{ runner.os }}- - name: Upload library JARs uses: https://code.forgejo.org/forgejo/upload-artifact@v4 with: @@ -44,8 +62,26 @@ jobs: steps: - name: Checkout uses: https://code.forgejo.org/actions/checkout@v4 + - name: Restore Gradle cache + uses: actions/cache/restore@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + gradle-${{ runner.os }}- - name: Generate javadoc run: ./gradlew --no-daemon javadoc javadocAll + - name: Save Gradle cache + uses: actions/cache/save@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + gradle-${{ runner.os }}- - name: Upload separate javadoc uses: https://code.forgejo.org/forgejo/upload-artifact@v4 with: @@ -67,5 +103,23 @@ jobs: steps: - name: Checkout uses: https://code.forgejo.org/actions/checkout@v4 + - name: Restore Gradle cache + uses: actions/cache/restore@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + gradle-${{ runner.os }}- - name: Run tests run: ./gradlew --no-daemon test + - name: Save Gradle cache + uses: actions/cache/save@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + gradle-${{ runner.os }}- diff --git a/.forgejo/workflows/pullrequest.yml b/.forgejo/workflows/pullrequest.yml index f09118f..d30163a 100644 --- a/.forgejo/workflows/pullrequest.yml +++ b/.forgejo/workflows/pullrequest.yml @@ -11,8 +11,26 @@ jobs: steps: - name: Checkout uses: https://code.forgejo.org/actions/checkout@v4 + - name: Restore Gradle cache + uses: actions/cache/restore@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + gradle-${{ runner.os }}- - name: Generate javadoc run: ./gradlew --no-daemon javadoc + - name: Save Gradle cache + uses: actions/cache/save@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + gradle-${{ runner.os }}- test: runs-on: docker container: @@ -20,5 +38,23 @@ jobs: steps: - name: Checkout uses: https://code.forgejo.org/actions/checkout@v4 + - name: Restore Gradle cache + uses: actions/cache/restore@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + gradle-${{ runner.os }}- - name: Run tests run: ./gradlew --no-daemon test + - name: Save Gradle cache + uses: actions/cache/save@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + gradle-${{ runner.os }}-