From 4ca49686240600d58482018953413c89c13565ab Mon Sep 17 00:00:00 2001 From: Daz DeBoer Date: Sun, 5 Jun 2022 21:11:24 -0600 Subject: [PATCH] Add test for action in containerized runner --- .github/workflows/ci-full-check.yml | 5 ++ .github/workflows/ci-quick-check.yml | 7 ++- ...test-restore-containerized-gradle-home.yml | 60 +++++++++++++++++++ .../integ-test-restore-custom-gradle-home.yml | 18 +----- 4 files changed, 74 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/integ-test-restore-containerized-gradle-home.yml diff --git a/.github/workflows/ci-full-check.yml b/.github/workflows/ci-full-check.yml index caf7b93..94d3f70 100644 --- a/.github/workflows/ci-full-check.yml +++ b/.github/workflows/ci-full-check.yml @@ -48,6 +48,11 @@ jobs: with: 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: uses: ./.github/workflows/integ-test-restore-gradle-home.yml with: diff --git a/.github/workflows/ci-quick-check.yml b/.github/workflows/ci-quick-check.yml index 187e5c5..ab52632 100644 --- a/.github/workflows/ci-quick-check.yml +++ b/.github/workflows/ci-quick-check.yml @@ -55,11 +55,16 @@ jobs: runner-os: '["ubuntu-latest"]' 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: needs: build-distribution uses: ./.github/workflows/integ-test-restore-custom-gradle-home.yml with: - runner-os: '["ubuntu-latest"]' download-dist: true restore-gradle-home: diff --git a/.github/workflows/integ-test-restore-containerized-gradle-home.yml b/.github/workflows/integ-test-restore-containerized-gradle-home.yml new file mode 100644 index 0000000..ac856a6 --- /dev/null +++ b/.github/workflows/integ-test-restore-containerized-gradle-home.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/integ-test-restore-custom-gradle-home.yml b/.github/workflows/integ-test-restore-custom-gradle-home.yml index 4a1c795..abc306b 100644 --- a/.github/workflows/integ-test-restore-custom-gradle-home.yml +++ b/.github/workflows/integ-test-restore-custom-gradle-home.yml @@ -5,9 +5,6 @@ on: inputs: cache-key-prefix: type: string - runner-os: - type: string - default: '["ubuntu-latest", "windows-latest", "macos-latest"]' download-dist: type: boolean default: false @@ -19,10 +16,7 @@ env: jobs: seed-build: - strategy: - matrix: - os: ${{fromJSON(inputs.runner-os)}} - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest steps: - name: Set Gradle User Home run: | @@ -43,10 +37,7 @@ jobs: # Test that the gradle-user-home cache will cache dependencies, by running build with --offline dependencies-cache: needs: seed-build - strategy: - matrix: - os: ${{fromJSON(inputs.runner-os)}} - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest steps: - name: Set Gradle User Home run: | @@ -67,10 +58,7 @@ jobs: # Test that the gradle-user-home cache will cache and restore local build-cache build-cache: needs: seed-build - strategy: - matrix: - os: ${{fromJSON(inputs.runner-os)}} - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest steps: - name: Set Gradle User Home run: |