-
Notifications
You must be signed in to change notification settings - Fork 121
Homebrew formula #1046
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Homebrew formula #1046
Changes from 151 commits
b60f27c
007e05e
95097c9
edfc8fe
c1b5453
e34711d
6ee36b7
33e9645
7d21ed3
35b4469
bd9f51e
dd0b8c4
07ee05e
29a928d
d1d1c67
b2e034e
86a4c89
79924a4
b7c580c
919a800
9fd8391
d176487
5f5ced5
d372e63
3c5d327
161d41d
52de223
1d3bc21
3b8c950
46e325a
a38350f
272340a
9b8db76
5a48e36
5d7ef61
b8a2940
9a45f65
4e5cc79
1cd2cc3
5d2eb66
e2c249c
4edc60f
55ca2b0
f9d3409
24452d4
26df743
dd0ba7c
3a4ce68
301ea0b
f3643b9
ef4aba5
7dc3c9a
09fe44e
19fe2d9
b1c75bb
1612552
3973747
d4dcaaa
23949ef
0385aa8
00f8295
7f34c7e
abe825a
4bffab5
bd376b4
f4fa72e
b8c2463
06edb9b
9e21f25
5ee24d4
62393d1
69427d9
b9d4148
96fe6d4
5c9bbb7
9163b77
ed9c328
0d472e7
5a7a31a
8de2268
bc7175f
c56cd92
cae22fd
09c8bf2
385061a
692519f
1408aec
5b85475
ef66c9a
d3b1a93
e75b7ff
415ad05
8a75271
d1381c8
3efb9d6
845c68b
a7572e2
2308b9a
3be3e15
1a32884
6b5bd9f
5da2c3a
8215624
3ff41d1
72304d5
43bfb7b
1bb2226
315c4fd
f7e6aea
81e30ff
bb096d7
efb6c53
93f8c3b
2db4c31
59f196b
0aab6ca
66e2093
323e3bf
11a4e98
c3b0c1d
95f2109
ede409c
dcc6031
addcd87
25a39df
9d4e299
e3a7f3c
2b2b749
cf453b9
f5f9abb
b1e3ac5
c73b091
9ade107
6970bce
61adc7e
1e78657
cb29fc5
7c7543f
4041006
346c413
ec24979
3e4ba96
a6d2641
5fecd1b
76ac76e
41706e1
58ba949
f125de6
4b5c016
1a1865f
8a5291e
ecc17fa
156410b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,6 @@ name: Deploy Homebrew Tap | |
|
|
||
| on: | ||
| push: | ||
| branches: [ main, master, homebrew-formula ] | ||
| paths: | ||
| - 'packaging/homebrew/mfc.rb' | ||
| - 'packaging/homebrew/README.md' | ||
|
Comment on lines
3
to
7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
A new tag-specific path was added ( Useful? React with 👍 / 👎. |
||
|
|
@@ -20,6 +19,7 @@ jobs: | |
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| steps: | ||
| - name: Checkout MFC repository | ||
| uses: actions/checkout@v4 | ||
|
|
@@ -38,9 +38,9 @@ jobs: | |
| VERSION="$(echo "${URL}" | sed -E 's/.*v([0-9]+\.[0-9]+\.[0-9]+)\.tar\.gz/\1/')" | ||
| fi | ||
| SHASUM="$(curl -sL "${URL}" | shasum -a 256 | awk '{print $1}')" | ||
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | ||
| echo "url=${URL}" >> $GITHUB_OUTPUT | ||
| echo "sha256=${SHASUM}" >> $GITHUB_OUTPUT | ||
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | ||
| echo "url=${URL}" >> "$GITHUB_OUTPUT" | ||
| echo "sha256=${SHASUM}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Update formula (for tag events) | ||
| if: github.ref_type == 'tag' | ||
|
|
@@ -98,5 +98,4 @@ jobs: | |
| fi | ||
| git -c user.name="github-actions[bot]" -c user.email="github-actions[bot]@users.noreply.github.com" \ | ||
| commit -m "mfc: v${{ steps.meta.outputs.version }}" | ||
| git push origin HEAD:main | ||
|
|
||
| git push origin HEAD:main | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. High-level SuggestionReintroduce the Solution Walkthrough:Before:# .github/workflows/homebrew.yml
jobs:
homebrew-mfc:
runs-on: macos-latest
steps:
- name: Checkout repo
...
- name: Set up Homebrew
...
- name: Install MFC via Homebrew
run: |
brew install mflowcode/mfc/mfc || brew install --build-from-source mflowcode/mfc/mfc
- name: Run MFC test case
...
- name: Basic installation verification
...
After:# .github/workflows/homebrew.yml
jobs:
homebrew-mfc:
runs-on: macos-latest
steps:
- name: Checkout repo
...
- name: Set up Homebrew
...
- name: Validate formula
run: |
brew audit --online packaging/homebrew/mfc.rb
- name: Install MFC via Homebrew
run: |
brew install mflowcode/mfc/mfc || brew install --build-from-source mflowcode/mfc/mfc
- name: Run MFC test case
...
- name: Basic installation verification
...
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,264 +1,65 @@ | ||
| name: Homebrew Formula Test | ||
| name: Homebrew | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| - homebrew-formula | ||
| paths: | ||
| - 'packaging/homebrew/**' | ||
| - '.github/workflows/homebrew.yml' | ||
| pull_request: | ||
| branches: | ||
| - master | ||
| paths: | ||
| - 'packaging/homebrew/**' | ||
| - '.github/workflows/homebrew.yml' | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| # Fast smoke tests that run before expensive operations | ||
| smoke-test: | ||
| name: Quick Formula Validation | ||
| runs-on: ubuntu-latest # Use Linux for speed (Homebrew works on Linux too) | ||
|
|
||
| homebrew-mfc: | ||
| name: Test Homebrew package (macOS) | ||
| runs-on: macos-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| - name: Checkout repo | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Homebrew | ||
| uses: Homebrew/actions/setup-homebrew@master | ||
|
|
||
| - name: Validate formula syntax with brew style | ||
| run: | | ||
| echo "Checking formula syntax..." | ||
| brew style packaging/homebrew/mfc.rb | ||
|
|
||
| - name: Run brew audit (without installation) | ||
| run: | | ||
| echo "Configuring git for brew tap-new..." | ||
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
| git config --global user.name "github-actions[bot]" | ||
|
|
||
| echo "Creating temporary local tap..." | ||
| brew tap-new mflowcode/test | ||
| cp packaging/homebrew/mfc.rb $(brew --repository)/Library/Taps/mflowcode/homebrew-test/Formula/mfc.rb | ||
|
|
||
| echo "Running brew audit (online checks)..." | ||
| brew audit --online --skip-style mflowcode/test/mfc || true | ||
|
|
||
| echo "Cleaning up tap..." | ||
| brew untap mflowcode/test | ||
|
|
||
| - name: Validate Ruby syntax | ||
| run: | | ||
| echo "Checking Ruby syntax..." | ||
| ruby -c packaging/homebrew/mfc.rb | ||
|
|
||
| - name: Check for common formula issues | ||
| run: | | ||
| echo "Checking for common issues..." | ||
|
|
||
| # Check that required fields are present | ||
| grep -q 'desc "' packaging/homebrew/mfc.rb || (echo "❌ Missing desc"; exit 1) | ||
| grep -q 'homepage "' packaging/homebrew/mfc.rb || (echo "❌ Missing homepage"; exit 1) | ||
| grep -q 'url "' packaging/homebrew/mfc.rb || (echo "❌ Missing url"; exit 1) | ||
| grep -q 'sha256 "' packaging/homebrew/mfc.rb || (echo "❌ Missing sha256"; exit 1) | ||
| grep -q 'license "' packaging/homebrew/mfc.rb || (echo "❌ Missing license"; exit 1) | ||
|
|
||
| # Check that install method exists | ||
| grep -q 'def install' packaging/homebrew/mfc.rb || (echo "❌ Missing install method"; exit 1) | ||
|
|
||
| # Check that test block exists | ||
| grep -q 'test do' packaging/homebrew/mfc.rb || (echo "❌ Missing test block"; exit 1) | ||
|
|
||
| echo "✅ All required formula components present" | ||
|
|
||
| - name: Verify URL is reachable | ||
| run: | | ||
| echo "Checking that source URL is reachable..." | ||
| URL=$(grep -E 'url "https://[^"]+' packaging/homebrew/mfc.rb | head -1 | sed 's/.*url "\([^"]*\)".*/\1/') | ||
|
|
||
| if [ -z "$URL" ]; then | ||
| echo "❌ Could not extract URL from formula" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "URL: $URL" | ||
| HTTP_CODE=$(curl -sI -w "%{http_code}" -o /dev/null "$URL") | ||
|
|
||
| if [ "$HTTP_CODE" = "200" ] || [ "$HTTP_CODE" = "302" ]; then | ||
| echo "✅ URL is reachable (HTTP $HTTP_CODE)" | ||
| else | ||
| echo "⚠️ URL returned HTTP $HTTP_CODE (may indicate an issue)" | ||
| # Don't fail here - could be a temporary issue | ||
| fi | ||
|
|
||
| - name: Verify SHA256 checksum | ||
| run: | | ||
| echo "Verifying SHA256 checksum matches URL..." | ||
| URL=$(grep -E 'url "https://[^"]+' packaging/homebrew/mfc.rb | head -1 | sed 's/.*url "\([^"]*\)".*/\1/') | ||
| EXPECTED_SHA=$(grep 'sha256 "' packaging/homebrew/mfc.rb | head -1 | sed 's/.*sha256 "\([^"]*\)".*/\1/') | ||
|
|
||
| if [ -z "$URL" ] || [ -z "$EXPECTED_SHA" ]; then | ||
| echo "❌ Could not extract URL or SHA256 from formula" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Downloading tarball to compute checksum..." | ||
| ACTUAL_SHA=$(curl -sL "$URL" | shasum -a 256 | awk '{print $1}') | ||
|
|
||
| echo "Expected SHA256: $EXPECTED_SHA" | ||
| echo "Actual SHA256: $ACTUAL_SHA" | ||
|
|
||
| if [ "$EXPECTED_SHA" = "$ACTUAL_SHA" ]; then | ||
| echo "✅ SHA256 checksum matches!" | ||
| else | ||
| echo "❌ SHA256 mismatch!" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Full installation test (only runs if smoke tests pass) | ||
| test-formula: | ||
| name: Full Installation Test | ||
| needs: smoke-test # Only run after smoke tests pass | ||
| runs-on: macos-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Homebrew | ||
| run: | | ||
| echo "Homebrew version:" | ||
| brew --version | ||
| echo "Updating Homebrew..." | ||
| brew update | ||
|
|
||
| - name: Install formula dependencies | ||
| run: | | ||
| echo "Installing MFC dependencies..." | ||
| brew install cmake gcc [email protected] boost fftw hdf5 open-mpi openblas | ||
|
|
||
| - name: Install MFC from formula | ||
| run: | | ||
| echo "Creating temporary local tap..." | ||
| brew tap-new mflowcode/test | ||
|
|
||
| echo "Copying formula to tap..." | ||
| cp packaging/homebrew/mfc.rb $(brew --repository)/Library/Taps/mflowcode/homebrew-test/Formula/mfc.rb | ||
|
|
||
| echo "Installing MFC from local tap..." | ||
| # Note: brew may exit with code 1 due to dylib fixup warnings on some Python packages (non-fatal) | ||
| # We verify installation using brew commands rather than parsing log output | ||
| set +e # Don't fail immediately on error | ||
| brew install --build-from-source --verbose mflowcode/test/mfc 2>&1 | tee /tmp/brew-install.log | ||
| brew_exit_code=$? | ||
| set -e | ||
|
|
||
| # Verify installation using brew list (more robust than log parsing) | ||
| if brew list mflowcode/test/mfc &>/dev/null; then | ||
| echo "✅ MFC installed successfully (ignoring dylib relocation warnings)" | ||
| # Optionally verify with brew info | ||
| brew info mflowcode/test/mfc | ||
| exit 0 | ||
| else | ||
| echo "❌ MFC installation failed" | ||
| exit $brew_exit_code | ||
| fi | ||
|
|
||
| - name: Display error logs on failure | ||
| if: failure() | ||
| - name: Install MFC via Homebrew | ||
| run: | | ||
| echo "=== Displaying last 200 lines of brew install log ===" | ||
| if [ -f /tmp/brew-install.log ]; then | ||
| tail -200 /tmp/brew-install.log | ||
| fi | ||
|
|
||
| echo -e "\n=== Displaying Homebrew log files ===" | ||
| if [ -d ~/Library/Logs/Homebrew/mfc/ ]; then | ||
| for logfile in ~/Library/Logs/Homebrew/mfc/*; do | ||
| if [ -f "$logfile" ]; then | ||
| echo -e "\n\n====== $logfile ======" | ||
| cat "$logfile" | ||
| fi | ||
| done | ||
| fi | ||
|
|
||
| echo -e "\n=== Searching for Cantera config.log ===" | ||
| cantera_config_log=$(find /private/tmp -name "config.log" -path "*/mfc--cantera*" 2>/dev/null | head -1) | ||
| if [ -n "$cantera_config_log" ] && [ -f "$cantera_config_log" ]; then | ||
| echo -e "\n\n====== Cantera config.log ======" | ||
| echo "Found at: $cantera_config_log" | ||
| cat "$cantera_config_log" | ||
| # Copy to a known location for artifact upload | ||
| mkdir -p /tmp/cantera-logs | ||
| cp "$cantera_config_log" /tmp/cantera-logs/config.log | ||
| else | ||
| echo "Cantera config.log not found" | ||
| echo "Searching in all /private/tmp directories:" | ||
| find /private/tmp -name "config.log" 2>/dev/null || echo "No config.log files found" | ||
| fi | ||
|
|
||
| - name: Upload Homebrew logs on failure | ||
| if: failure() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: homebrew-logs | ||
| path: | | ||
| /tmp/brew-install.log | ||
| /tmp/cantera-logs/ | ||
| ~/Library/Logs/Homebrew/mfc/ | ||
| if-no-files-found: ignore | ||
|
|
||
| - name: Test MFC installation | ||
| run: | | ||
| echo "=== Testing MFC Installation ===" | ||
|
|
||
| echo "1. Checking binaries exist and are executable..." | ||
| test -f $(brew --prefix)/bin/mfc && test -x $(brew --prefix)/bin/mfc | ||
| test -f $(brew --prefix)/bin/pre_process && test -x $(brew --prefix)/bin/pre_process | ||
| test -f $(brew --prefix)/bin/simulation && test -x $(brew --prefix)/bin/simulation | ||
| test -f $(brew --prefix)/bin/post_process && test -x $(brew --prefix)/bin/post_process | ||
| echo " ✓ All binaries exist and are executable" | ||
|
|
||
| echo "2. Verifying installation structure..." | ||
| test -f $(brew --prefix mfc)/libexec/mfc.sh | ||
| test -d $(brew --prefix mfc)/toolchain | ||
| echo " ✓ Installation structure verified" | ||
|
|
||
| echo "3. Checking Python venv..." | ||
| test -d $(brew --prefix mfc)/libexec/venv | ||
| test -f $(brew --prefix mfc)/libexec/venv/bin/python | ||
| test -f $(brew --prefix mfc)/libexec/venv/bin/pip | ||
| echo " ✓ Python venv exists" | ||
|
|
||
| echo "4. Checking examples..." | ||
| test -d $(brew --prefix mfc)/examples | ||
| test -f $(brew --prefix mfc)/examples/1D_sodshocktube/case.py | ||
| echo " ✓ Examples installed" | ||
|
|
||
| echo "5. Testing mfc wrapper..." | ||
| mfc --help | ||
| echo " ✓ mfc --help succeeded" | ||
|
|
||
| echo "=== All tests passed! ===" | ||
|
|
||
| set -euo pipefail | ||
| # Prefer bottle; fall back to source build if needed | ||
| brew install mflowcode/mfc/mfc || brew install --build-from-source mflowcode/mfc/mfc | ||
|
|
||
| - name: Run MFC test case | ||
| run: | | ||
| set -euo pipefail | ||
| echo "Running a simple test case (1D Sod shock tube)..." | ||
| TESTDIR=$(mktemp -d) | ||
| cp $(brew --prefix mfc)/examples/1D_sodshocktube/case.py "$TESTDIR/" | ||
| cp "$(brew --prefix mfc)/examples/1D_sodshocktube/case.py" "$TESTDIR/" | ||
|
|
||
| echo "Running with $(sysctl -n hw.ncpu) processors..." | ||
| # Use absolute path and shorthand syntax (mfc auto-detects and prepends 'run') | ||
| mfc "$TESTDIR/case.py" -j $(sysctl -n hw.ncpu) | ||
|
|
||
| echo "Test case completed successfully!" | ||
|
|
||
| - name: Uninstall and cleanup | ||
| if: always() | ||
| mfc "$TESTDIR/case.py" -j "$(sysctl -n hw.ncpu)" | ||
|
|
||
| test -d "$TESTDIR/silo_hdf5" | ||
| echo "✅ Test case completed successfully and produced output" | ||
|
|
||
| - name: Basic installation verification | ||
| run: | | ||
| echo "Cleaning up..." | ||
| brew uninstall mfc || true | ||
| brew cleanup | ||
| set -euo pipefail | ||
| echo "1. Checking binaries..." | ||
| test -x "$(brew --prefix mfc)/bin/pre_process" | ||
| test -x "$(brew --prefix mfc)/bin/simulation" | ||
| test -x "$(brew --prefix mfc)/bin/post_process" | ||
| test -x "$(brew --prefix mfc)/bin/mfc" | ||
|
|
||
| echo "2. Checking toolchain..." | ||
| test -d "$(brew --prefix mfc)/toolchain" | ||
|
|
||
| echo "3. Checking Python venv..." | ||
| test -d "$(brew --prefix mfc)/libexec/venv" | ||
| test -x "$(brew --prefix mfc)/libexec/venv/bin/python" | ||
|
|
||
| echo "4. Checking examples..." | ||
| test -d "$(brew --prefix mfc)/examples" | ||
|
|
||
| echo "5. Testing mfc command..." | ||
| mfc --help | ||
|
|
||
| echo "✅ All verification checks passed" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deploy-tap workflow no longer restricts which branches can trigger it—
on.pushnow runs for any branch that happens to modifypackaging/homebrew/**. Because the job always ends by committing and pushing the formula toMFlowCode/homebrew-mfcusing the PAT, any contributor pushing a feature branch (or even a draft PR) will now publish their unreviewed formula straight to the public tap. Previously this workflow ran only after changes landed onmain/master/homebrew-formula, guaranteeing review before publishing. Please reinstate a branch filter (or otherwise guard the job) so that only vetted branches can trigger the tap sync.Useful? React with 👍 / 👎.