From f8da24f36701f82be1f17bf0c27b2352782e5bd3 Mon Sep 17 00:00:00 2001 From: sayomaki Date: Sun, 8 Oct 2023 04:17:28 +0800 Subject: [PATCH] workflows: update TestBot actions (#17) * workflows: migrate to restore@v3 and add macOS info to cache * workflows: update order of cleanup execution and remove bundler install * workflows: explicitly enable updating test-bot * workflows: deprecate ::set-output command --- .github/workflows/build-bottles.yml | 4 ++-- .github/workflows/tests.yml | 31 ++++++++++++++++++++--------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-bottles.yml b/.github/workflows/build-bottles.yml index 497bee3..91f4411 100644 --- a/.github/workflows/build-bottles.yml +++ b/.github/workflows/build-bottles.yml @@ -114,10 +114,10 @@ jobs: cd bottles count=$(ls *.json | wc -l | xargs echo -n) echo "$count bottles" - echo "::set-output name=count::$count" + echo "count=$count" >> $GITHUB_OUTPUT failures=$(ls failed/*.json | wc -l | xargs echo -n) echo "$failures failed bottles" - echo "::set-output name=failures::$failures" + echo "failures=$failures" >> $GITHUB_OUTPUT - name: Upload failed bottles if: always() && steps.bottles.outputs.failures > 0 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b02ec36..40fe25a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,20 +16,33 @@ jobs: - name: Set up Homebrew id: set-up-homebrew uses: Homebrew/actions/setup-homebrew@master + with: + core: true + cask: false + test-bot: true + + - run: brew test-bot --only-cleanup-before + + - name: Set up RubyGems cache + shell: bash + run: | + cache_key_prefix="${{ runner.os }}" + if [[ "${{ runner.os }}" = macOS ]] + then + macos_full_version="$(sw_vers -productVersion)" + macos_version="${macos_full_version%%.*}" + arch="$(uname -m)" + cache_key_prefix="${macos_version}-${arch}" + fi + echo "cache_key_prefix=${cache_key_prefix}" >> "$GITHUB_ENV" - name: Cache Homebrew Bundler RubyGems id: cache - uses: actions/cache@v1 + uses: actions/cache/restore@v3 with: path: ${{ steps.set-up-homebrew.outputs.gems-path }} - key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} - restore-keys: ${{ runner.os }}-rubygems- - - - name: Install Homebrew Bundler RubyGems - if: steps.cache.outputs.cache-hit != 'true' - run: brew install-bundler-gems - - - run: brew test-bot --only-cleanup-before + key: ${{ env.cache_key_prefix }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} + restore-keys: ${{ env.cache_key_prefix }}-rubygems- - run: brew test-bot --only-setup