Add test for action in containerized runner

This commit is contained in:
Daz DeBoer 2022-06-05 21:11:24 -06:00
parent fd1882690a
commit 4ca4968624
No known key found for this signature in database
GPG Key ID: DD6B9F0B06683D5D
4 changed files with 74 additions and 16 deletions

View File

@ -48,6 +48,11 @@ jobs:
with: with:
cache-key-prefix: ${{github.run_number}}- cache-key-prefix: ${{github.run_number}}-
restore-containerized-gradle-home:
uses: ./.github/workflows/integ-test-restore-containerized-gradle-home.yml
with:
cache-key-prefix: ${{github.run_number}}-
restore-gradle-home: restore-gradle-home:
uses: ./.github/workflows/integ-test-restore-gradle-home.yml uses: ./.github/workflows/integ-test-restore-gradle-home.yml
with: with:

View File

@ -55,11 +55,16 @@ jobs:
runner-os: '["ubuntu-latest"]' runner-os: '["ubuntu-latest"]'
download-dist: true download-dist: true
restore-containerized-gradle-home:
needs: build-distribution
uses: ./.github/workflows/integ-test-restore-containerized-gradle-home.yml
with:
download-dist: true
restore-custom-gradle-home: restore-custom-gradle-home:
needs: build-distribution needs: build-distribution
uses: ./.github/workflows/integ-test-restore-custom-gradle-home.yml uses: ./.github/workflows/integ-test-restore-custom-gradle-home.yml
with: with:
runner-os: '["ubuntu-latest"]'
download-dist: true download-dist: true
restore-gradle-home: restore-gradle-home:

View File

@ -0,0 +1,60 @@
name: Test restore custom Gradle Home
on:
workflow_call:
inputs:
cache-key-prefix:
type: string
download-dist:
type: boolean
default: false
env:
DOWNLOAD_DIST: ${{ inputs.download-dist }}
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-custom-gradle-home-${{ inputs.cache-key-prefix }}
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
jobs:
seed-build:
runs-on: ubuntu-latest
container: fedora:latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Download distribution if required
uses: ./.github/actions/download-dist
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin
- name: Setup Gradle
uses: ./
with:
cache-read-only: false # For testing, allow writing cache entries on non-default branches
- name: Build using Gradle wrapper
working-directory: .github/workflow-samples/groovy-dsl
run: ./gradlew test
# Test that the gradle-user-home cache will cache dependencies, by running build with --offline
dependencies-cache:
needs: seed-build
runs-on: ubuntu-latest
container: fedora:latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Download distribution if required
uses: ./.github/actions/download-dist
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin
- name: Setup Gradle
uses: ./
with:
cache-read-only: true
- name: Execute Gradle build with --offline
working-directory: .github/workflow-samples/groovy-dsl
run: ./gradlew test --offline

View File

@ -5,9 +5,6 @@ on:
inputs: inputs:
cache-key-prefix: cache-key-prefix:
type: string type: string
runner-os:
type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
download-dist: download-dist:
type: boolean type: boolean
default: false default: false
@ -19,10 +16,7 @@ env:
jobs: jobs:
seed-build: seed-build:
strategy: runs-on: ubuntu-latest
matrix:
os: ${{fromJSON(inputs.runner-os)}}
runs-on: ${{ matrix.os }}
steps: steps:
- name: Set Gradle User Home - name: Set Gradle User Home
run: | run: |
@ -43,10 +37,7 @@ jobs:
# Test that the gradle-user-home cache will cache dependencies, by running build with --offline # Test that the gradle-user-home cache will cache dependencies, by running build with --offline
dependencies-cache: dependencies-cache:
needs: seed-build needs: seed-build
strategy: runs-on: ubuntu-latest
matrix:
os: ${{fromJSON(inputs.runner-os)}}
runs-on: ${{ matrix.os }}
steps: steps:
- name: Set Gradle User Home - name: Set Gradle User Home
run: | run: |
@ -67,10 +58,7 @@ jobs:
# Test that the gradle-user-home cache will cache and restore local build-cache # Test that the gradle-user-home cache will cache and restore local build-cache
build-cache: build-cache:
needs: seed-build needs: seed-build
strategy: runs-on: ubuntu-latest
matrix:
os: ${{fromJSON(inputs.runner-os)}}
runs-on: ${{ matrix.os }}
steps: steps:
- name: Set Gradle User Home - name: Set Gradle User Home
run: | run: |