Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling of caching across runs using gradle-build-action #1960

Merged
merged 4 commits into from
Aug 29, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 7 additions & 38 deletions .github/actions/prepare-build-env/action.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,11 @@
name: Prepare build environment (Linux only)
description: Set up Java, Maven, Gradle, etc.
name: Set up build environment
description: Set up Java and Gradle (including caching).
runs:
using: "composite"
steps:
- name: Set up Java 17
run: |
echo "$JAVA_HOME_17_X64/bin" >> $GITHUB_PATH
echo "org.gradle.java.home=${JAVA_HOME_17_X64//\\/\/}" >> gradle.properties
echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV
shell: bash
- name: Check settings
run: |
echo $(which java)
cat gradle.properties
echo $JAVA_HOME
shell: bash
- name: Create hash of Gradle configuration (macOS only)
run: |
echo "gradle-hash"="$(find . -type f \( -name "gradle.properties" -o -name "gradle-wrapper.properties" \) -exec cat {} + | shasum -a 256 | cut -d ' ' -f 1)" >> $GITHUB_ENV
if: ${{ runner.os == 'macOS' }}
shell: bash
- name: Create hash of Gradle configuration (Linux and Windows only)
run: |
echo "gradle-hash"="$(find . -type f \( -name "gradle.properties" -o -name "gradle-wrapper.properties" \) -exec cat {} + | sha256sum | cut -d ' ' -f 1)" >> $GITHUB_ENV
if: ${{ runner.os == 'Windows' || runner.os == 'Linux' }}
shell: bash
- name: Cache
uses: actions/cache@v3
- uses: actions/setup-java@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ env.gradle-hash }}
# restore-keys: |
# ${{ runner.os }}-gradle-
- name: Bring down Gradle daemon (Windows)
uses: webiny/action-post-run@3.0.0
id: post-run-command
with:
run: ./gradlew --stop
if: ${{ runner.os == 'Windows' }}
distribution: temurin
java-version: 17
- name: Gradle Build Action
uses: gradle/gradle-build-action@v2.8.0
Loading