From 99c6d715e91515f53e55edec030bf46ef007c314 Mon Sep 17 00:00:00 2001 From: Tommaso Gragnato Date: Sat, 7 Sep 2024 13:49:54 +0200 Subject: [PATCH] ci(tests): isolate the syntax check / parallelise the check of formulae --- .github/workflows/tests.yml | 59 ++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 10613f9..0db1528 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,10 +10,9 @@ on: jobs: test-bot: - strategy: - matrix: - os: [ macos-12, macos-13, macos-14, ubuntu-latest ] - runs-on: ${{ matrix.os }} + + name: Homebrew Test Bot (Syntax) + runs-on: ubuntu-latest steps: @@ -37,8 +36,54 @@ jobs: - run: brew test-bot --only-setup - - run: brew test-bot --only-tap-syntax + - name: Test syntax of all formulae + run: brew test-bot --only-tap-syntax + + get-formulas: + + runs-on: ubuntu-latest + outputs: + formulas: ${{ steps.get-formulas.outputs.formulas }} + + steps: + - name: Check out repository + uses: actions/checkout@v4 - - run: brew test-bot --only-formulae --root-url=https://ghcr.io/v2/tgragnato/tap amule + - name: Get list of all formulae + id: get-formulas + run: | + FORMULAS=$(ls Formula | sed 's/\.rb$//') + FORMULAS_JSON=$(echo $FORMULAS | jq -R -s -c 'split(" ")') + echo "::set-output name=formulas::$FORMULAS_JSON" + + test-formulae: + + name: Homebrew Test Bot (Formulae) + needs: [test-bot, get-formulas] + if: success() + strategy: + matrix: + os: [ macos-12, macos-13, macos-14, ubuntu-latest ] + formula: ${{fromJson(needs.get-formulas.outputs.formulas)}} + runs-on: ${{ matrix.os }} + + steps: + + - name: Set up Homebrew + id: set-up-homebrew + uses: Homebrew/actions/setup-homebrew@master + + - name: Cache Homebrew Bundler RubyGems + id: cache + uses: actions/cache@v4 + 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-formulae --root-url=https://ghcr.io/v2/tgragnato/tap magnetico + - name: Test formula ${{ matrix.formula }} + run: brew test-bot --only-formulae ${{ matrix.formula }}