kotlin-bip39/.github/actions/setup/action.yml

71 lines
2.8 KiB
YAML

name: 'Setup Java and Dependency Cache'
description: "Configures the build environment and caches Gradle, dependencies, and build outputs."
runs:
using: "composite"
steps:
- name: Set Env
shell: bash
run: |
echo "home=${HOME}" >> "$GITHUB_ENV"
- name: Set up Java
uses: actions/setup-java@860f60056505705214d223b91ed7a30f173f6142
with:
distribution: 'temurin'
java-version: 17
- name: Disable Gradle Daemon
shell: bash
run: |
mkdir ~/.gradle
echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties
- name: Gradle Wrapper Cache
id: gradle-wrapper-cache
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles(format('{0}{1}', github.workspace, '/gradle/wrapper/gradle-wrapper.properties')) }}
- name: Gradle Dependency Cache
id: gradle-dependency-cache
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d
with:
path: ~/.gradle/caches/modules-2
key: ${{ runner.os }}-gradle-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/gradle.properties'), format('{0}{1}', github.workspace, '/gradle/libs.versions.toml')) }}
restore-keys: |
${{ runner.os }}-gradle-deps-
- name: Kotlin Dependency Cache
id: kotlin-dependency-cache
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d
with:
path: |
~/.konan
key: ${{ runner.os }}-kotlin-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/gradle.properties')) }}
# The build cache is doing two things:
# 1. Relying on the most recent main branch build to provide a partial cache for both main branch and PR builds.
# 2. Relying on the sha for an exact match so that the prime_cache job is re-used by all dependent jobs in a single workflow run
- name: Gradle Build Cache
id: gradle-build-cache
uses: actions/cache@c3f1317a9e7b1ef106c153ac8c0f00fed3ddbc0d
with:
path: |
~/.gradle/caches/build-cache-1
~/.gradle/caches/transforms-3
.gradle/configuration-cache
key: ${{ runner.os }}-gradle-build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-gradle-build-
- name: Download Gradle
if: steps.gradle-wrapper-cache.outputs.cache-hit != 'true'
shell: bash
run: |
./gradlew --version
- name: Download Gradle Dependencies
if: steps.gradle-dependency-cache.outputs.cache-hit != 'true'
shell: bash
run: |
./gradlew dependencies :bip39-lib:dependencies
- name: Compile
if: steps.gradle-build-cache.outputs.cache-hit != 'true'
shell: bash
run: |
./gradlew assemble testClasses