Skip to content

Commit

Permalink
Merge pull request #1960 from lf-lang/windows-cache
Browse files Browse the repository at this point in the history
Handling of caching across runs using `gradle-build-action`
  • Loading branch information
lhstrh authored Aug 29, 2023
2 parents 9a1587b + 2a76fe8 commit eb3a5d3
Showing 1 changed file with 8 additions and 37 deletions.
45 changes: 8 additions & 37 deletions .github/actions/prepare-build-env/action.yml
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

0 comments on commit eb3a5d3

Please sign in to comment.