Skip to content

ci(tests): isolate the syntax check / parallelise the check of formulae #24

ci(tests): isolate the syntax check / parallelise the check of formulae

ci(tests): isolate the syntax check / parallelise the check of formulae #24

Workflow file for this run

name: brew test-bot
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test-bot:
name: Homebrew Test Bot (Syntax)
runs-on: ubuntu-latest
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-cleanup-before
- run: brew test-bot --only-setup
- 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
- 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
- name: Test formula ${{ matrix.formula }}
run: brew test-bot --only-formulae ${{ matrix.formula }}