Update GitHub Actions workflow for bottle builds #38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Bottle | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'Formula/**' | |
| - '.github/workflows/bottle.yml' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| test-bot: | |
| strategy: | |
| matrix: | |
| os: [macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Set up Homebrew | |
| uses: Homebrew/actions/setup-homebrew@master | |
| - name: Checkout tap | |
| uses: actions/checkout@v4 | |
| - name: Set variables | |
| id: set_vars | |
| run: | | |
| echo "root_url=https://github.com/${{ github.repository }}/releases/download/bottles" >> $GITHUB_OUTPUT | |
| - name: Build bottles with test-bot | |
| env: | |
| HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| brew test-bot --only-formulae --skip-dependents --skip-online-checks --root-url="${{ steps.set_vars.outputs.root_url }}" mfc | |
| - name: Upload bottles as artifact | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bottles-${{ matrix.os }} | |
| path: '*.bottle.*' | |
| if-no-files-found: ignore | |
| - name: Cleanup | |
| if: always() | |
| continue-on-error: true | |
| run: | | |
| brew uninstall --force mfc || true | |
| test-run-case: | |
| needs: test-bot | |
| runs-on: macos-14 | |
| steps: | |
| - name: Set up Homebrew | |
| uses: Homebrew/actions/setup-homebrew@master | |
| - name: Checkout tap | |
| uses: actions/checkout@v4 | |
| - name: Install MFC from bottle | |
| run: | | |
| # Wait a moment for bottle to be available | |
| sleep 5 | |
| # Install the formula (will use bottle if available) | |
| brew install mflowcode/mfc/mfc || brew install --build-from-source mflowcode/mfc/mfc | |
| - name: Run Sod shock tube test case | |
| run: | | |
| mkdir -p ~/test_mfc_case | |
| cd ~/test_mfc_case | |
| cp $(brew --prefix mfc)/examples/1D_sodshocktube/case.py . | |
| mfc run case.py -j 1 | |
| - name: Verify output | |
| run: | | |
| test -d ~/test_mfc_case/silo_hdf5 | |
| echo "✅ Test case ran successfully and produced output" | |
| - name: Cleanup | |
| if: always() | |
| run: | | |
| brew uninstall --force mfc || true | |
| rm -rf ~/test_mfc_case | |
| verify-install: | |
| needs: test-run-case | |
| runs-on: macos-14 | |
| steps: | |
| - name: Set up Homebrew | |
| uses: Homebrew/actions/setup-homebrew@master | |
| - name: Checkout tap | |
| uses: actions/checkout@v4 | |
| - name: Install MFC | |
| run: | | |
| brew install mflowcode/mfc/mfc || brew install --build-from-source mflowcode/mfc/mfc | |
| - name: Verify installation | |
| run: | | |
| 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" | |
| - name: Cleanup | |
| if: always() | |
| run: | | |
| brew uninstall --force mfc || true | |