Skip to content

Commit 9333c68

Browse files
authored
fix homebrew a bit (#1047)
1 parent c701821 commit 9333c68

File tree

3 files changed

+39
-15
lines changed

3 files changed

+39
-15
lines changed

.github/workflows/deploy-tap.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
11
name: Deploy Homebrew Tap
22

33
on:
4+
# Test formula on PRs (audit only, don't deploy)
5+
pull_request:
6+
branches: [ master ]
7+
paths:
8+
- 'packaging/homebrew/mfc.rb'
9+
- 'packaging/homebrew/README.md'
10+
# Deploy to tap on push to master
411
push:
5-
branches: [ main, master, homebrew-formula ]
12+
branches: [ master, homebrew-new ]
613
paths:
714
- 'packaging/homebrew/mfc.rb'
815
- 'packaging/homebrew/README.md'
916
tags:
1017
- 'v*.*.*'
18+
# Allow manual trigger for testing
1119
workflow_dispatch:
1220

1321
permissions:
1422
contents: read
1523

1624
jobs:
1725
deploy-tap:
18-
name: Sync/bump formula in tap
26+
name: Audit and deploy formula
1927
runs-on: macos-14
2028
permissions:
2129
contents: write
@@ -41,6 +49,13 @@ jobs:
4149
echo "version=${VERSION}" >> $GITHUB_OUTPUT
4250
echo "url=${URL}" >> $GITHUB_OUTPUT
4351
echo "sha256=${SHASUM}" >> $GITHUB_OUTPUT
52+
echo "Event: ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
53+
echo "Version: ${VERSION}" >> $GITHUB_STEP_SUMMARY
54+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
55+
echo "Mode: Audit only (PR)" >> $GITHUB_STEP_SUMMARY
56+
else
57+
echo "Mode: Audit and deploy" >> $GITHUB_STEP_SUMMARY
58+
fi
4459
4560
- name: Update formula (for tag events)
4661
if: github.ref_type == 'tag'
@@ -61,6 +76,7 @@ jobs:
6176
brew untap mfc/local
6277
6378
- name: Clone or bootstrap tap repository
79+
if: github.event_name != 'pull_request'
6480
env:
6581
TAP_TOKEN: ${{ secrets.TAP_REPO_TOKEN }}
6682
run: |
@@ -81,12 +97,14 @@ jobs:
8197
fi
8298
8399
- name: Copy formula and README into tap
100+
if: github.event_name != 'pull_request'
84101
run: |
85102
mkdir -p tap-repo/Formula
86103
cp packaging/homebrew/mfc.rb tap-repo/Formula/mfc.rb
87104
cp packaging/homebrew/README.md tap-repo/README.md
88105
89106
- name: Commit & push if changed
107+
if: github.event_name != 'pull_request'
90108
env:
91109
TAP_TOKEN: ${{ secrets.TAP_REPO_TOKEN }}
92110
run: |

.github/workflows/homebrew.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,10 @@ name: Homebrew Formula Test
22

33
on:
44
push:
5-
branches:
6-
- master
7-
- homebrew-formula
85
paths:
96
- 'packaging/homebrew/**'
107
- '.github/workflows/homebrew.yml'
118
pull_request:
12-
branches:
13-
- master
149
paths:
1510
- 'packaging/homebrew/**'
1611
- '.github/workflows/homebrew.yml'

packaging/homebrew/mfc.rb

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ class Mfc < Formula
2121
depends_on "openblas"
2222
depends_on "[email protected]"
2323

24-
# Skip relocation for Python C extensions in the venv
25-
# The venv is self-contained in libexec and doesn't need Homebrew's relocation
24+
# Skip cleanup for Python venv to preserve C extensions as-is
25+
# Python wheels manage their own RPATHs and don't need Homebrew's relocation
2626
skip_clean "libexec/venv"
2727

2828
def install
@@ -248,6 +248,16 @@ def post_install
248248
(libexec/"mfc").chmod 0755
249249
end
250250

251+
# Override to skip relocation checks for Python C extensions in venv
252+
# Python wheels (especially orjson, cantera) have Mach-O headers without enough
253+
# padding for Homebrew's longer paths. This is safe because:
254+
# 1. The venv is self-contained in libexec and uses relative paths
255+
# 2. Python manages its own RPATH for C extensions
256+
# 3. The venv is never relocated after installation
257+
def skip_relocation?(file, _type)
258+
file.to_s.include?("/libexec/venv/")
259+
end
260+
251261
def caveats
252262
<<~EOS
253263
MFC has been installed successfully!
@@ -289,21 +299,22 @@ def caveats
289299
# Test that mfc wrapper works
290300
system bin/"mfc", "--help"
291301

292-
# Test running a simple 1D Sod shock tube case from a separate directory
293-
# This ensures the wrapper script correctly handles relative paths
302+
# Test running a complete 1D Sod shock tube case from a separate directory
303+
# This comprehensive test ensures the entire MFC workflow functions correctly
304+
# and that the wrapper script properly handles relative paths
294305
testpath_case = testpath/"test_run"
295306
testpath_case.mkpath
296307

297308
# Copy case.py from examples to an independent test directory
298309
cp prefix/"examples/1D_sodshocktube/case.py", testpath_case/"case.py"
299310

300-
# Run the case from the test directory (this will execute pre_process and simulation)
301-
# Limit to 1 processor and reduce runtime for testing
311+
# Run all three stages: pre_process, simulation, and post_process
312+
# This runs a full 1D Sod shock tube (1000 timesteps, 399 cells)
302313
cd testpath_case do
303-
system bin/"mfc", "run", "case.py", "-j", "1"
314+
system bin/"mfc", "case.py", "-n", "1"
304315
end
305316

306-
# Verify output files were created in the test directory
317+
# Verify silo_hdf5 output files were created by post_process
307318
assert_path_exists testpath_case/"silo_hdf5"
308319
assert_predicate testpath_case/"silo_hdf5", :directory?
309320
end

0 commit comments

Comments
 (0)