From e5e4a98196cdb9fbc50341e9432ddd74ad540c3f Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Sun, 28 Apr 2024 01:05:24 +0800 Subject: [PATCH 1/2] pre-build: download only needed bottles We currently download all previously built bottles, but that results in unnecessary downloads. Let's make the glob for downloading bottles more specific. --- pre-build/action.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pre-build/action.yml b/pre-build/action.yml index 8de677d6..78759217 100644 --- a/pre-build/action.yml +++ b/pre-build/action.yml @@ -28,6 +28,7 @@ runs: shell: /bin/bash -euo pipefail {0} - name: Set up RubyGems cache + id: setup-cache shell: /bin/bash -euo pipefail {0} run: | cache_key_prefix="${{ runner.os }}" @@ -39,6 +40,8 @@ runs: cache_key_prefix="${macos_version}-${arch}" fi echo "cache_key_prefix=${cache_key_prefix}" >> "$GITHUB_ENV" + echo "macos_version=${macos_version}" >> "$GITHUB_OUTPUT" + echo "arch=${arch}" >> "$GITHUB_OUTPUT" - name: Cache Homebrew Bundler RubyGems id: cache @@ -58,17 +61,29 @@ runs: shell: /bin/bash -euo pipefail {0} - name: Set up bottles directory + id: setup-bottles run: | rm -rvf "${BOTTLES_DIR:?}" mkdir "${BOTTLES_DIR:?}" + + if [[ "${{ runner.os }}" = Linux ]]; then + bottle_specifier="{ubuntu,linux}" + else + bottle_specifier="$MACOS_VERSION" + [[ "$ARCH" = arm64 ]] && bottle_specifier="${bottle_specifier}-${ARCH}" + fi + + echo "bottle_specifier=$bottle_specifier" >> "$GITHUB_OUTPUT" shell: /bin/bash -euo pipefail {0} env: BOTTLES_DIR: ${{ inputs.bottles-directory }} + MACOS_VERSION: ${{ steps.setup-cache.macos_version }} + ARCH: ${{ steps.setup_cache.arch }} - name: Download bottles from GitHub Actions if: fromJson(inputs.download-bottles) uses: actions/download-artifact@v4 with: - pattern: bottles_* + pattern: bottles_${{ steps.setup-bottles.bottle_specifier }}* path: ${{ inputs.bottles-directory }} merge-multiple: true From a5bf95411ab541cf4c8eacd82d62076c389782e8 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Sun, 28 Apr 2024 01:07:15 +0800 Subject: [PATCH 2/2] pre-build: fix typo --- pre-build/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pre-build/action.yml b/pre-build/action.yml index 78759217..b109804d 100644 --- a/pre-build/action.yml +++ b/pre-build/action.yml @@ -78,7 +78,7 @@ runs: env: BOTTLES_DIR: ${{ inputs.bottles-directory }} MACOS_VERSION: ${{ steps.setup-cache.macos_version }} - ARCH: ${{ steps.setup_cache.arch }} + ARCH: ${{ steps.setup-cache.arch }} - name: Download bottles from GitHub Actions if: fromJson(inputs.download-bottles)