-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1960 from lf-lang/windows-cache
Handling of caching across runs using `gradle-build-action`
- Loading branch information
Showing
1 changed file
with
8 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,13 @@ | ||
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 | ||
distribution: temurin | ||
java-version: 17 | ||
- name: Gradle Build Action | ||
uses: gradle/gradle-build-action@v2.8.0 | ||
with: | ||
run: ./gradlew --stop | ||
if: ${{ runner.os == 'Windows' }} | ||
cache-read-only: false |