From acc77da7027ab2930ff51100e4085120b409dd30 Mon Sep 17 00:00:00 2001 From: Daz DeBoer Date: Sun, 29 May 2022 13:47:45 -0600 Subject: [PATCH] Build distribution when running quick-check workflow The action requires the generated distribution to committed to the 'dist' directory. During regular development this step causes a number of problems: - It's easy to forget to add/commit these generated files. - It's very difficult/impossible to merge/rebase commits that involve generated files - These file add unnecessary bulk to the git history With this change, the quick-check workflow will first build the distribution and then use the generated output for testing. Building and committing these files will only be required when merging into the 'main' branch. --- .github/actions/build-dist/action.yml | 16 ++++++ .github/actions/download-dist/action.yml | 12 +++++ .github/workflows/ci-full-check.yml | 11 ---- .github/workflows/ci-quick-check.yml | 52 +++++++++++++++++++ .../integ-test-action-inputs-caching.yml | 18 ++++++- .../workflows/integ-test-action-inputs.yml | 8 ++- .../integ-test-execution-with-caching.yml | 10 +++- .github/workflows/integ-test-execution.yml | 10 +++- .../workflows/integ-test-gradle-versions.yml | 10 +++- ...integ-test-restore-configuration-cache.yml | 18 ++++++- .../integ-test-restore-custom-gradle-home.yml | 12 ++++- .../integ-test-restore-gradle-home.yml | 14 ++++- .../integ-test-restore-java-toolchain.yml | 10 +++- .../integ-test-sample-gradle-plugin.yml | 10 +++- .../integ-test-sample-kotlin-dsl.yml | 10 +++- 15 files changed, 199 insertions(+), 22 deletions(-) create mode 100644 .github/actions/build-dist/action.yml create mode 100644 .github/actions/download-dist/action.yml diff --git a/.github/actions/build-dist/action.yml b/.github/actions/build-dist/action.yml new file mode 100644 index 0000000..05051a1 --- /dev/null +++ b/.github/actions/build-dist/action.yml @@ -0,0 +1,16 @@ +name: 'Build and upload distribution' +# Builds the action distribution an uploads as an artifact for later download +runs: + using: "composite" + steps: + - name: Build distribution + shell: bash + run: | + npm install + npm run all + - name: Upload distribution + uses: actions/upload-artifact@v2 + with: + name: dist + path: dist/ + diff --git a/.github/actions/download-dist/action.yml b/.github/actions/download-dist/action.yml new file mode 100644 index 0000000..2364edd --- /dev/null +++ b/.github/actions/download-dist/action.yml @@ -0,0 +1,12 @@ +name: 'Download dist' +# Downloads a 'dist' directory artifact that was uploaded in an earlier step +# We control this with an environment variable to allow for easier global configuration. +runs: + using: "composite" + steps: + - name: Download dist + if: ${{ env.DOWNLOAD_DIST == 'true' }} + uses: actions/download-artifact@v2 + with: + name: dist + path: dist/ diff --git a/.github/workflows/ci-full-check.yml b/.github/workflows/ci-full-check.yml index 4fdd24c..f6e6791 100644 --- a/.github/workflows/ci-full-check.yml +++ b/.github/workflows/ci-full-check.yml @@ -11,64 +11,53 @@ jobs: uses: ./.github/workflows/integ-test-action-inputs.yml with: cache-key-prefix: ${{github.run_number}}- - runner-os: '["ubuntu-latest", "windows-latest", "macos-latest"]' caching-config: uses: ./.github/workflows/integ-test-action-inputs-caching.yml with: cache-key-prefix: ${{github.run_number}}- - runner-os: '["ubuntu-latest", "windows-latest", "macos-latest"]' execution-with-caching: uses: ./.github/workflows/integ-test-execution-with-caching.yml with: cache-key-prefix: ${{github.run_number}}- - runner-os: '["ubuntu-latest", "windows-latest", "macos-latest"]' execution: uses: ./.github/workflows/integ-test-execution.yml with: cache-key-prefix: ${{github.run_number}}- - runner-os: '["ubuntu-latest", "windows-latest", "macos-latest"]' gradle-versions: uses: ./.github/workflows/integ-test-gradle-versions.yml with: cache-key-prefix: ${{github.run_number}}- - runner-os: '["ubuntu-latest", "windows-latest", "macos-latest"]' restore-configuration-cache: uses: ./.github/workflows/integ-test-restore-configuration-cache.yml with: cache-key-prefix: ${{github.run_number}}- - runner-os: '["ubuntu-latest", "windows-latest", "macos-latest"]' restore-custom-gradle-home: uses: ./.github/workflows/integ-test-restore-custom-gradle-home.yml with: cache-key-prefix: ${{github.run_number}}- - runner-os: '["ubuntu-latest", "windows-latest", "macos-latest"]' restore-gradle-home: uses: ./.github/workflows/integ-test-restore-gradle-home.yml with: cache-key-prefix: ${{github.run_number}}- - runner-os: '["ubuntu-latest", "windows-latest", "macos-latest"]' restore-java-toolchain: uses: ./.github/workflows/integ-test-restore-java-toolchain.yml with: cache-key-prefix: ${{github.run_number}}- - runner-os: '["ubuntu-latest", "windows-latest", "macos-latest"]' sample-kotlin-dsl: uses: ./.github/workflows/integ-test-sample-kotlin-dsl.yml with: cache-key-prefix: ${{github.run_number}}- - runner-os: '["ubuntu-latest", "windows-latest", "macos-latest"]' sample-gradle-plugin: uses: ./.github/workflows/integ-test-sample-gradle-plugin.yml with: cache-key-prefix: ${{github.run_number}}- - runner-os: '["ubuntu-latest", "windows-latest", "macos-latest"]' diff --git a/.github/workflows/ci-quick-check.yml b/.github/workflows/ci-quick-check.yml index 5562c06..dcdcc27 100644 --- a/.github/workflows/ci-quick-check.yml +++ b/.github/workflows/ci-quick-check.yml @@ -6,35 +6,87 @@ on: push: jobs: + build-distribution: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + - name: Build and upload distribution + uses: ./.github/actions/build-dist + action-inputs: + needs: build-distribution uses: ./.github/workflows/integ-test-action-inputs.yml + with: + runner-os: '["ubuntu-latest"]' + download-dist: true caching-config: + needs: build-distribution uses: ./.github/workflows/integ-test-action-inputs-caching.yml + with: + runner-os: '["ubuntu-latest"]' + download-dist: true execution-with-caching: + needs: build-distribution uses: ./.github/workflows/integ-test-execution-with-caching.yml + with: + runner-os: '["ubuntu-latest"]' + download-dist: true execution: + needs: build-distribution uses: ./.github/workflows/integ-test-execution.yml + with: + runner-os: '["ubuntu-latest"]' + download-dist: true gradle-versions: + needs: build-distribution uses: ./.github/workflows/integ-test-gradle-versions.yml + with: + runner-os: '["ubuntu-latest"]' + download-dist: true restore-configuration-cache: + needs: build-distribution uses: ./.github/workflows/integ-test-restore-configuration-cache.yml + with: + runner-os: '["ubuntu-latest"]' + 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: + needs: build-distribution uses: ./.github/workflows/integ-test-restore-gradle-home.yml + with: + runner-os: '["ubuntu-latest"]' + download-dist: true restore-java-toolchain: + needs: build-distribution uses: ./.github/workflows/integ-test-restore-java-toolchain.yml + with: + runner-os: '["ubuntu-latest"]' + download-dist: true sample-kotlin-dsl: + needs: build-distribution uses: ./.github/workflows/integ-test-sample-kotlin-dsl.yml + with: + runner-os: '["ubuntu-latest"]' + download-dist: true sample-gradle-plugin: + needs: build-distribution uses: ./.github/workflows/integ-test-sample-gradle-plugin.yml + with: + runner-os: '["ubuntu-latest"]' + download-dist: true diff --git a/.github/workflows/integ-test-action-inputs-caching.yml b/.github/workflows/integ-test-action-inputs-caching.yml index 09e92c0..07d13a9 100644 --- a/.github/workflows/integ-test-action-inputs-caching.yml +++ b/.github/workflows/integ-test-action-inputs-caching.yml @@ -7,9 +7,13 @@ on: type: string runner-os: type: string - default: '["ubuntu-latest"]' + default: '["ubuntu-latest", "windows-latest", "macos-latest"]' + download-dist: + type: boolean + default: false env: + DOWNLOAD_DIST: ${{ inputs.download-dist }} GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: action-inputs-caching-${{ inputs.cache-key-prefix }} GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true @@ -22,6 +26,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle uses: ./ with: @@ -46,6 +52,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle uses: ./ with: @@ -69,6 +77,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle uses: ./ with: @@ -90,6 +100,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Create dummy Gradle User Home run: mkdir -p ~/.gradle/caches - name: Setup Gradle @@ -116,6 +128,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle uses: ./ with: @@ -135,6 +149,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle uses: ./ with: diff --git a/.github/workflows/integ-test-action-inputs.yml b/.github/workflows/integ-test-action-inputs.yml index 6a7a957..ba245af 100644 --- a/.github/workflows/integ-test-action-inputs.yml +++ b/.github/workflows/integ-test-action-inputs.yml @@ -7,9 +7,13 @@ on: type: string runner-os: type: string - default: '["ubuntu-latest"]' + default: '["ubuntu-latest", "windows-latest", "macos-latest"]' + download-dist: + type: boolean + default: false env: + DOWNLOAD_DIST: ${{ inputs.download-dist }} GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: action-inputs-${{ inputs.cache-key-prefix }} GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true @@ -22,6 +26,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Invoke with multi-line arguments uses: ./ with: diff --git a/.github/workflows/integ-test-execution-with-caching.yml b/.github/workflows/integ-test-execution-with-caching.yml index 22738e0..fcfd527 100644 --- a/.github/workflows/integ-test-execution-with-caching.yml +++ b/.github/workflows/integ-test-execution-with-caching.yml @@ -7,9 +7,13 @@ on: type: string runner-os: type: string - default: '["ubuntu-latest"]' + default: '["ubuntu-latest", "windows-latest", "macos-latest"]' + download-dist: + type: boolean + default: false env: + DOWNLOAD_DIST: ${{ inputs.download-dist }} GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: execution-with-caching-${{ inputs.cache-key-prefix }} GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true @@ -22,6 +26,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Execute Gradle build uses: ./ with: @@ -38,6 +44,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Execute Gradle build uses: ./ with: diff --git a/.github/workflows/integ-test-execution.yml b/.github/workflows/integ-test-execution.yml index d03ffb8..b82ed43 100644 --- a/.github/workflows/integ-test-execution.yml +++ b/.github/workflows/integ-test-execution.yml @@ -7,9 +7,13 @@ on: type: string runner-os: type: string - default: '["ubuntu-latest"]' + default: '["ubuntu-latest", "windows-latest", "macos-latest"]' + download-dist: + type: boolean + default: false env: + DOWNLOAD_DIST: ${{ inputs.download-dist }} GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: execution-${{ inputs.cache-key-prefix }} GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true @@ -27,6 +31,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Test use defined Gradle version uses: ./ with: @@ -60,6 +66,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Run Gradle build uses: ./ id: gradle diff --git a/.github/workflows/integ-test-gradle-versions.yml b/.github/workflows/integ-test-gradle-versions.yml index d04dfe8..af6a091 100644 --- a/.github/workflows/integ-test-gradle-versions.yml +++ b/.github/workflows/integ-test-gradle-versions.yml @@ -7,9 +7,13 @@ on: type: string runner-os: type: string - default: '["ubuntu-latest"]' + default: '["ubuntu-latest", "windows-latest", "macos-latest"]' + download-dist: + type: boolean + default: false env: + DOWNLOAD_DIST: ${{ inputs.download-dist }} GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: gradle-versions-${{ inputs.cache-key-prefix }} GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true @@ -27,6 +31,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle with v6.9 uses: ./ with: @@ -63,6 +69,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle uses: ./ with: diff --git a/.github/workflows/integ-test-restore-configuration-cache.yml b/.github/workflows/integ-test-restore-configuration-cache.yml index b966c18..4666c65 100644 --- a/.github/workflows/integ-test-restore-configuration-cache.yml +++ b/.github/workflows/integ-test-restore-configuration-cache.yml @@ -7,9 +7,13 @@ on: type: string runner-os: type: string - default: '["ubuntu-latest"]' + default: '["ubuntu-latest", "windows-latest", "macos-latest"]' + download-dist: + type: boolean + default: false env: + DOWNLOAD_DIST: ${{ inputs.download-dist }} GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-configuration-cache-${{ inputs.cache-key-prefix }} GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true @@ -24,6 +28,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle uses: ./ - name: Groovy build with configuration-cache enabled @@ -41,6 +47,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle uses: ./ with: @@ -68,6 +76,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle with no extracted cache entries restored uses: ./ env: @@ -88,6 +98,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle uses: ./ - name: Execute 'help' with configuration-cache enabled @@ -105,6 +117,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle uses: ./ - name: Execute 'test' with configuration-cache enabled @@ -123,6 +137,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle uses: ./ with: diff --git a/.github/workflows/integ-test-restore-custom-gradle-home.yml b/.github/workflows/integ-test-restore-custom-gradle-home.yml index 06dcdc5..66e645e 100644 --- a/.github/workflows/integ-test-restore-custom-gradle-home.yml +++ b/.github/workflows/integ-test-restore-custom-gradle-home.yml @@ -7,9 +7,13 @@ on: type: string runner-os: type: string - default: '["ubuntu-latest"]' + default: '["ubuntu-latest", "windows-latest", "macos-latest"]' + 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 @@ -22,6 +26,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle uses: ./ - name: Build using Gradle wrapper @@ -38,6 +44,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle uses: ./ with: @@ -56,6 +64,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle uses: ./ with: diff --git a/.github/workflows/integ-test-restore-gradle-home.yml b/.github/workflows/integ-test-restore-gradle-home.yml index 6801ed6..dd01a6d 100644 --- a/.github/workflows/integ-test-restore-gradle-home.yml +++ b/.github/workflows/integ-test-restore-gradle-home.yml @@ -7,9 +7,13 @@ on: type: string runner-os: type: string - default: '["ubuntu-latest"]' + default: '["ubuntu-latest", "windows-latest", "macos-latest"]' + download-dist: + type: boolean + default: false env: + DOWNLOAD_DIST: ${{ inputs.download-dist }} GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-gradle-home-${{ inputs.cache-key-prefix }} GRADLE_BUILD_ACTION_CACHE_KEY_JOB: restore-gradle-home GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true @@ -23,6 +27,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle uses: ./ - name: Build using Gradle wrapper @@ -39,6 +45,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle uses: ./ with: @@ -57,6 +65,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle uses: ./ with: @@ -75,6 +85,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle with no extracted cache entries restored uses: ./ env: diff --git a/.github/workflows/integ-test-restore-java-toolchain.yml b/.github/workflows/integ-test-restore-java-toolchain.yml index 28c209c..e2ad69d 100644 --- a/.github/workflows/integ-test-restore-java-toolchain.yml +++ b/.github/workflows/integ-test-restore-java-toolchain.yml @@ -7,9 +7,13 @@ on: type: string runner-os: type: string - default: '["ubuntu-latest"]' + default: '["ubuntu-latest", "windows-latest", "macos-latest"]' + download-dist: + type: boolean + default: false env: + DOWNLOAD_DIST: ${{ inputs.download-dist }} GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: restore-java-toolchain-${{ inputs.cache-key-prefix }} GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true @@ -22,6 +26,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle uses: ./ - name: Build using Gradle wrapper @@ -38,6 +44,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle uses: ./ with: diff --git a/.github/workflows/integ-test-sample-gradle-plugin.yml b/.github/workflows/integ-test-sample-gradle-plugin.yml index d19f459..b365ac0 100644 --- a/.github/workflows/integ-test-sample-gradle-plugin.yml +++ b/.github/workflows/integ-test-sample-gradle-plugin.yml @@ -7,9 +7,13 @@ on: type: string runner-os: type: string - default: '["ubuntu-latest"]' + default: '["ubuntu-latest", "windows-latest", "macos-latest"]' + download-dist: + type: boolean + default: false env: + DOWNLOAD_DIST: ${{ inputs.download-dist }} GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: sample-gradle-plugin-${{ inputs.cache-key-prefix }} GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true @@ -22,6 +26,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle uses: ./ - name: Build gradle-plugin project @@ -37,6 +43,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle uses: ./ with: diff --git a/.github/workflows/integ-test-sample-kotlin-dsl.yml b/.github/workflows/integ-test-sample-kotlin-dsl.yml index 3fab646..c3963c8 100644 --- a/.github/workflows/integ-test-sample-kotlin-dsl.yml +++ b/.github/workflows/integ-test-sample-kotlin-dsl.yml @@ -7,9 +7,13 @@ on: type: string runner-os: type: string - default: '["ubuntu-latest"]' + default: '["ubuntu-latest", "windows-latest", "macos-latest"]' + download-dist: + type: boolean + default: false env: + DOWNLOAD_DIST: ${{ inputs.download-dist }} GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: sample-kotlin-dsl-${{ inputs.cache-key-prefix }} GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true @@ -22,6 +26,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle uses: ./ - name: Build kotlin-dsl project @@ -37,6 +43,8 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Download distribution if required + uses: ./.github/actions/download-dist - name: Setup Gradle uses: ./ with: