Skip to content

Commit 90df696

Browse files
committed
ci: Add Homebrew formula testing workflow
Added GitHub Actions workflow to test Homebrew formula on macOS: **Triggers:** - Push to master or homebrew-formula branches - PRs to master - Changes to packaging/homebrew/ or workflow file - Manual workflow dispatch **Test Steps:** 1. Set up Homebrew and update 2. Install all MFC dependencies 3. Validate formula syntax (audit + style check) 4. Install MFC from local formula (build from source) 5. Run Homebrew's built-in formula tests 6. Test MFC commands: - mfc wrapper (--help) - All three binaries (-h flags) - Case file parsing (mfc count) 7. Verify installation structure 8. Clean up **Benefits:** - Ensures formula works on macOS - Catches syntax errors early - Validates installation structure - Tests actual functionality - Runs on every formula change **Runner:** macos-latest (GitHub-hosted)
1 parent 34ef2bd commit 90df696

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

.github/workflows/homebrew.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Homebrew Formula Test
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- homebrew-formula
8+
paths:
9+
- 'packaging/homebrew/**'
10+
- '.github/workflows/homebrew.yml'
11+
pull_request:
12+
branches:
13+
- master
14+
paths:
15+
- 'packaging/homebrew/**'
16+
- '.github/workflows/homebrew.yml'
17+
workflow_dispatch:
18+
19+
jobs:
20+
test-formula:
21+
name: Test Homebrew Formula
22+
runs-on: macos-latest
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Set up Homebrew
29+
run: |
30+
echo "Homebrew version:"
31+
brew --version
32+
echo "Updating Homebrew..."
33+
brew update
34+
35+
- name: Install formula dependencies
36+
run: |
37+
echo "Installing MFC dependencies..."
38+
brew install cmake gcc [email protected] boost fftw hdf5 open-mpi openblas
39+
40+
- name: Validate formula syntax
41+
run: |
42+
echo "Checking formula syntax..."
43+
brew audit --strict --online packaging/homebrew/mfc.rb || true
44+
brew style packaging/homebrew/mfc.rb
45+
46+
- name: Install MFC from formula
47+
run: |
48+
echo "Installing MFC from local formula..."
49+
brew install --build-from-source --verbose packaging/homebrew/mfc.rb
50+
51+
- name: Run formula tests
52+
run: |
53+
echo "Running Homebrew formula tests..."
54+
brew test mfc
55+
56+
- name: Test MFC commands
57+
run: |
58+
echo "Testing MFC wrapper..."
59+
mfc --help
60+
61+
echo "Testing binaries..."
62+
pre_process -h
63+
simulation -h
64+
post_process -h
65+
66+
echo "Testing case file parsing..."
67+
mfc count $(brew --prefix)/share/mfc/examples/1D_sodshocktube/case.py
68+
69+
- name: Verify installation structure
70+
run: |
71+
echo "Checking installed files..."
72+
ls -la $(brew --prefix)/bin/mfc
73+
ls -la $(brew --prefix)/bin/pre_process
74+
ls -la $(brew --prefix)/bin/simulation
75+
ls -la $(brew --prefix)/bin/post_process
76+
ls -la $(brew --prefix)/libexec/mfc.sh
77+
ls -la $(brew --prefix)/Cellar/mfc/*/toolchain/
78+
79+
echo "Installation verified successfully!"
80+
81+
- name: Uninstall and cleanup
82+
if: always()
83+
run: |
84+
echo "Cleaning up..."
85+
brew uninstall mfc || true
86+
brew cleanup
87+

0 commit comments

Comments
 (0)