Skip to content

Commit

Permalink
ci(tests): isolate the syntax check / parallelise the check of formulae
Browse files Browse the repository at this point in the history
  • Loading branch information
tgragnato committed Sep 7, 2024
1 parent f446efc commit 88bea13
Showing 1 changed file with 52 additions and 7 deletions.
59 changes: 52 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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-formulae:

runs-on: ubuntu-latest
outputs:
formulae: ${{ steps.get-formulae.outputs.formulae }}

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-formulae
run: |
FORMULAE=$(find Formula -name '*.rb' -exec basename {} .rb \;)
FORMULAE_JSON=$(echo "$FORMULAE" | jq -R -s -c 'split(" ")')
echo "formulae=$FORMULAE_JSON" >> $GITHUB_OUTPUT
test-formulae:

name: Homebrew Test Bot (Formulae)
needs: [test-bot, get-formulae]
if: success()
strategy:
matrix:
os: [ macos-12, macos-13, macos-14, ubuntu-latest ]
formula: ${{fromJson(needs.get-formulae.outputs.formulae)}}
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 }}

0 comments on commit 88bea13

Please sign in to comment.