Skip to content

ci: run homebrew compataibility tests every sunday night #3

ci: run homebrew compataibility tests every sunday night

ci: run homebrew compataibility tests every sunday night #3

Workflow file for this run

name: Homebrew Compatibility
on:
schedule:
# Run weekly on Sunday at 9 PM ET (1 AM UTC Monday)
- cron: '0 1 * * 1'
workflow_dispatch:
pull_request:
paths:
- 'zb_io/src/build/shim.rb'
- '.github/workflows/homebrew-compat.yml'
jobs:
test-compatibility:
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Get Homebrew version
id: brew-version
run: |
version=$(brew --version | grep -o 'Homebrew [0-9.]*' | cut -d' ' -f2)
echo "version=$version" >> $GITHUB_OUTPUT
echo "Homebrew version: $version"
- name: Build ZeroBrew
run: cargo build --release
- name: Install ZeroBrew
run: cargo install --path .
- name: Test common formulas
id: test-formulas
run: |
formulas=(
"jq"
"wget"
"tree"
"curl"
"git"
"node"
"python@3.12"
"rust"
"go"
"redis"
"postgresql@16"
"ffmpeg"
"vim"
"emacs"
"gcc"
"llvm"
"qt"
"opencv"
"imagemagick"
"mysql"
)
passed=0
failed=0
failed_list=""
for formula in "${formulas[@]}"; do
echo "Testing $formula..."
if zb info "$formula" > /dev/null 2>&1; then
echo "PASS: $formula"
passed=$((passed + 1))
else
echo "FAIL: $formula"
failed=$((failed + 1))
failed_list="$failed_list\n- $formula"
fi
done
total=$((passed + failed))
echo "passed=$passed" >> $GITHUB_OUTPUT
echo "failed=$failed" >> $GITHUB_OUTPUT
echo "total=$total" >> $GITHUB_OUTPUT
echo "failed_list<<EOF" >> $GITHUB_OUTPUT
echo -e "$failed_list" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "Results: $passed/$total passed"
if [ $failed -gt 0 ]; then
exit 1
fi
- name: Create issue on failure
if: failure() && steps.test-formulas.conclusion == 'failure'
uses: actions/github-script@v7
with:
script: |
const brewVersion = '${{ steps.brew-version.outputs.version }}';
const passed = '${{ steps.test-formulas.outputs.passed }}';
const failed = '${{ steps.test-formulas.outputs.failed }}';
const total = '${{ steps.test-formulas.outputs.total }}';
const failedList = `${{ steps.test-formulas.outputs.failed_list }}`;
const body = `## Homebrew Compatibility Test Failed
**Homebrew Version:** ${brewVersion}
**Results:** ${passed}/${total} formulas passed
### Failed Formulas
${failedList}
The shim may need to be updated to maintain compatibility with the current Homebrew version.
**Action Items:**
- Review failed formulas
- Check for Homebrew DSL changes
- Update shim.rb if necessary
- Update compatibility documentation
**Workflow Run:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}`;
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `Homebrew compatibility issue detected (${brewVersion})`,
body: body,
labels: ['homebrew-compatibility', 'bug']
});
- name: Comment on success
if: success()
run: |
echo "All formulas passed compatibility testing with Homebrew ${{ steps.brew-version.outputs.version }}"
echo "Passed: ${{ steps.test-formulas.outputs.passed }}/${{ steps.test-formulas.outputs.total }}"