diff --git a/.github/workflows/deploy-tap.yml b/.github/workflows/deploy-tap.yml index 2075d26e6..769cce98a 100644 --- a/.github/workflows/deploy-tap.yml +++ b/.github/workflows/deploy-tap.yml @@ -1,13 +1,21 @@ 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: @@ -15,7 +23,7 @@ permissions: jobs: deploy-tap: - name: Sync/bump formula in tap + name: Audit and deploy formula runs-on: macos-14 permissions: contents: write @@ -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' @@ -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: | @@ -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: | diff --git a/.github/workflows/homebrew.yml b/.github/workflows/homebrew.yml index 8a8d0e979..d7eced295 100644 --- a/.github/workflows/homebrew.yml +++ b/.github/workflows/homebrew.yml @@ -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' diff --git a/packaging/homebrew/mfc.rb b/packaging/homebrew/mfc.rb index 6d28f3fc8..7bacf9737 100644 --- a/packaging/homebrew/mfc.rb +++ b/packaging/homebrew/mfc.rb @@ -21,8 +21,8 @@ class Mfc < Formula depends_on "openblas" depends_on "python@3.12" - # 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 @@ -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! @@ -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