Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions .github/workflows/deploy-tap.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
name: Deploy Homebrew Tap

on:
# Test formula on PRs (audit only, don't deploy)
pull_request:
branches: [ master ]
paths:
- 'packaging/homebrew/mfc.rb'
- 'packaging/homebrew/README.md'
# Deploy to tap on push to master
push:
branches: [ main, master, homebrew-formula ]
branches: [ master, homebrew-new ]
paths:
- 'packaging/homebrew/mfc.rb'
- 'packaging/homebrew/README.md'
tags:
- 'v*.*.*'
# Allow manual trigger for testing
workflow_dispatch:

permissions:
contents: read

jobs:
deploy-tap:
name: Sync/bump formula in tap
name: Audit and deploy formula
runs-on: macos-14
permissions:
contents: write
Expand All @@ -41,6 +49,13 @@ jobs:
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "url=${URL}" >> $GITHUB_OUTPUT
echo "sha256=${SHASUM}" >> $GITHUB_OUTPUT
echo "Event: ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
echo "Version: ${VERSION}" >> $GITHUB_STEP_SUMMARY
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "Mode: Audit only (PR)" >> $GITHUB_STEP_SUMMARY
else
echo "Mode: Audit and deploy" >> $GITHUB_STEP_SUMMARY
fi

- name: Update formula (for tag events)
if: github.ref_type == 'tag'
Expand All @@ -61,6 +76,7 @@ jobs:
brew untap mfc/local

- name: Clone or bootstrap tap repository
if: github.event_name != 'pull_request'
env:
TAP_TOKEN: ${{ secrets.TAP_REPO_TOKEN }}
run: |
Expand All @@ -81,12 +97,14 @@ jobs:
fi

- name: Copy formula and README into tap
if: github.event_name != 'pull_request'
run: |
mkdir -p tap-repo/Formula
cp packaging/homebrew/mfc.rb tap-repo/Formula/mfc.rb
cp packaging/homebrew/README.md tap-repo/README.md

- name: Commit & push if changed
if: github.event_name != 'pull_request'
env:
TAP_TOKEN: ${{ secrets.TAP_REPO_TOKEN }}
run: |
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/homebrew.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@ name: Homebrew Formula Test

on:
push:
branches:
- master
- homebrew-formula
paths:
- 'packaging/homebrew/**'
- '.github/workflows/homebrew.yml'
pull_request:
branches:
- master
paths:
- 'packaging/homebrew/**'
- '.github/workflows/homebrew.yml'
Expand Down
27 changes: 19 additions & 8 deletions packaging/homebrew/mfc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class Mfc < Formula
depends_on "openblas"
depends_on "[email protected]"

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

def install
Expand Down Expand Up @@ -248,6 +248,16 @@ def post_install
(libexec/"mfc").chmod 0755
end

# Override to skip relocation checks for Python C extensions in venv
# Python wheels (especially orjson, cantera) have Mach-O headers without enough
# padding for Homebrew's longer paths. This is safe because:
# 1. The venv is self-contained in libexec and uses relative paths
# 2. Python manages its own RPATH for C extensions
# 3. The venv is never relocated after installation
def skip_relocation?(file, _type)
file.to_s.include?("/libexec/venv/")
end

def caveats
<<~EOS
MFC has been installed successfully!
Expand Down Expand Up @@ -289,21 +299,22 @@ def caveats
# Test that mfc wrapper works
system bin/"mfc", "--help"

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

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

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

# Verify output files were created in the test directory
# Verify silo_hdf5 output files were created by post_process
assert_path_exists testpath_case/"silo_hdf5"
assert_predicate testpath_case/"silo_hdf5", :directory?
end
Expand Down
Loading