Skip to content

Merge pull request #899 from Homebrew/formula_detect_cask #1535

Merge pull request #899 from Homebrew/formula_detect_cask

Merge pull request #899 from Homebrew/formula_detect_cask #1535

Workflow file for this run

name: CI
on:
push:
branches: master
pull_request:
jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-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@v1
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
- run: brew test-bot --only-tap-syntax
- name: Set up Ruby
if: matrix.os == 'ubuntu-latest'
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.6"
bundler-cache: true
- name: Install Homebrew/homebrew-test-bot RubyGems
if: matrix.os == 'macOS-latest'
run: bundle install --jobs 4 --retry 3
- name: Run Homebrew/homebrew-test-bot RSpec tests
run: bundle exec rspec
- name: Build Docker image and start container
if: matrix.os == 'ubuntu-latest'
run: |
docker build -t brew .
docker create \
-e GITHUB_ACTIONS -e GITHUB_BASE_REF -e GITHUB_OUTPUT -e GITHUB_REF -e GITHUB_REPOSITORY -e GITHUB_SHA \
-v "$GITHUB_OUTPUT:$GITHUB_OUTPUT" \
--name=brewtestbot brew sleep infinity
docker start brewtestbot
docker exec brewtestbot \
sudo setfacl -Rm "d:u:linuxbrew:rwX,u:linuxbrew:rwX" "$RUNNER_TEMP"
- run: brew test-bot --only-formulae-detect --test-default-formula
id: formulae-detect
- name: Run brew test-bot --only-formulae --junit --only-json-tab --skip-dependents --testing-formulae=${{ steps.formulae-detect.outputs.testing_formulae }}
id: brew-test-bot-formulae
run: |
if [ "$RUNNER_OS" = "Linux" ]; then
docker exec brewtestbot \
brew test-bot --only-formulae --junit --only-json-tab --skip-dependents --testing-formulae=${{ steps.formulae-detect.outputs.testing_formulae }}
else
brew test-bot --only-formulae --junit --only-json-tab --skip-dependents --testing-formulae=${{ steps.formulae-detect.outputs.testing_formulae }}
fi
- name: Run brew test-bot --only-formulae-dependents --junit --skipped-or-failed-formulae=${{ steps.brew-test-bot-formulae.outputs.skipped_or_failed_formulae }}
run: |
if [ "$RUNNER_OS" = "Linux" ]; then
docker exec brewtestbot \
brew test-bot --only-formulae-dependents --junit \
--testing-formulae=${{ steps.formulae-detect.outputs.testing_formulae }} \
--skipped-or-failed-formulae=${{ steps.brew-test-bot-formulae.outputs.skipped_or_failed_formulae }}
else
brew test-bot --only-formulae-dependents --junit \
--testing-formulae=${{ steps.formulae-detect.outputs.testing_formulae }} \
--skipped-or-failed-formulae=${{ steps.brew-test-bot-formulae.outputs.skipped_or_failed_formulae }}
fi
- name: Output brew test-bot failures
if: matrix.os == 'macOS-latest'
run: |
cat steps_output.txt
rm steps_output.txt
- name: Output brew bottle output
if: matrix.os == 'macOS-latest'
run: |
cat bottle_output.txt
rm bottle_output.txt
- name: Run brew test-bot --only-cleanup-after
run: |
if [ "$RUNNER_OS" = "Linux" ]; then
docker exec brewtestbot \
brew test-bot --only-cleanup-after
else
brew test-bot --only-cleanup-after
fi
- name: Run brew test-bot --only-setup --dry-run
run: |
if [ "$RUNNER_OS" = "Linux" ]; then
docker exec brewtestbot \
brew test-bot --only-setup --dry-run
else
brew test-bot --only-setup --dry-run
fi
- name: Run brew test-bot testbottest --only-formulae --dry-run
run: |
if [ "$RUNNER_OS" = "Linux" ]; then
docker exec brewtestbot \
brew test-bot testbottest --only-formulae --dry-run
else
brew test-bot testbottest --only-formulae --dry-run
fi
- name: Cleanup Docker container
if: matrix.os == 'ubuntu-latest'
run: |
docker stop brewtestbot
docker rm brewtestbot