Add debug mode. #102
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: MetaCall Distributable MacOS Release | |
| on: | |
| pull_request: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| # TODO: Implement support to automatically update the version of | |
| # metacall/core when there is a tag on that repo that triggers this one | |
| inputs: | |
| ref: | |
| description: "Version of metacall/core that triggered this workflow" | |
| required: false | |
| default: "" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| name: Build MetaCall Formula | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| triplet: [ | |
| {os: macos-15-intel, arch: amd64}, | |
| {os: macos-15, arch: arm64} | |
| ] | |
| build: [ | |
| { mode: debug, suffix: "-dbg" }, | |
| { mode: release, suffix: "" } | |
| ] | |
| runs-on: ${{ matrix.triplet.os }} | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # Clean up previous dependencies in order to avoid conflicts with brew | |
| - name: Uninstall brew completely | |
| run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" | |
| - name: Install brew | |
| run: | | |
| /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
| brew uninstall --force --ignore-dependencies cmake | |
| brew cleanup -s cmake | |
| brew cleanup --prune-prefix | |
| brew uninstall --force --ignore-dependencies node | |
| brew cleanup -s node | |
| brew cleanup --prune-prefix | |
| brew uninstall --force --ignore-dependencies python@3.11 | |
| brew cleanup -s python@3.11 | |
| brew cleanup --prune-prefix | |
| brew uninstall --force --ignore-dependencies python@3.12 | |
| brew cleanup -s python@3.12 | |
| brew cleanup --prune-prefix | |
| brew uninstall --force --ignore-dependencies python@3.13 | |
| brew cleanup -s python@3.13 | |
| brew cleanup --prune-prefix | |
| sudo rm -rf /System/Library/Frameworks/Python.framework/ | |
| brew cleanup --prune-prefix | |
| sudo rm -rf /usr/local/bin/2to3 | |
| sudo rm -rf /usr/local/bin/2to3-3.11 | |
| sudo rm -rf /usr/local/bin/2to3-3.12 | |
| sudo rm -rf /usr/local/bin/2to3-3.13 | |
| sudo rm -rf /usr/local/bin/idle3 | |
| sudo rm -rf /usr/local/bin/idle3.11 | |
| sudo rm -rf /usr/local/bin/idle3.12 | |
| sudo rm -rf /usr/local/bin/idle3.13 | |
| sudo rm -rf /usr/local/bin/pydoc3 | |
| sudo rm -rf /usr/local/bin/pydoc3.11 | |
| sudo rm -rf /usr/local/bin/pydoc3.12 | |
| sudo rm -rf /usr/local/bin/pydoc3.13 | |
| sudo rm -rf /usr/local/bin/python3 | |
| sudo rm -rf /usr/local/bin/python3-config | |
| sudo rm -rf /usr/local/bin/python3.11 | |
| sudo rm -rf /usr/local/bin/python3.12 | |
| sudo rm -rf /usr/local/bin/python3.13 | |
| sudo rm -rf /usr/local/bin/python3.11-config | |
| sudo rm -rf /usr/local/bin/python3.12-config | |
| sudo rm -rf /usr/local/bin/python3.13-config | |
| sudo rm -rf /usr/local/bin/pip3.11 | |
| sudo rm -rf /usr/local/bin/pip3.12 | |
| sudo rm -rf /usr/local/bin/pip3.13 | |
| brew uninstall --force --ignore-dependencies ruby | |
| brew cleanup -s ruby | |
| brew cleanup --prune-prefix | |
| sudo rm -rf $(brew --repo homebrew/core) | |
| # Build Homebrew recipe | |
| - name: Build | |
| run: ./build.sh ${{ matrix.build.mode }} | |
| - name: Test | |
| run: ./test.sh | |
| # Upload build artifact | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: metacall-tarball-${{ matrix.triplet.arch }}${{ matrix.build.suffix }} | |
| path: release/* | |
| test: | |
| name: Test | |
| needs: build | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| extension: ["tar.gz", "pkg"] | |
| triplet: [ | |
| {os: macos-15-intel, arch: amd64, install: "/usr/local"}, | |
| {os: macos-15, arch: arm64, install: "/opt/homebrew"} | |
| ] | |
| build: [ | |
| { mode: debug, suffix: "-dbg" }, | |
| { mode: release, suffix: "" } | |
| ] | |
| runs-on: ${{ matrix.triplet.os }} | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # Clean up previous dependencies in order to avoid conflicts with brew | |
| - name: Uninstall brew completely | |
| run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" | |
| - name: Install brew | |
| run: | | |
| /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
| brew uninstall --force --ignore-dependencies cmake | |
| brew cleanup -s cmake | |
| brew cleanup --prune-prefix | |
| brew uninstall --force --ignore-dependencies node | |
| brew cleanup -s node | |
| brew cleanup --prune-prefix | |
| brew uninstall --force --ignore-dependencies python@3.11 | |
| brew cleanup -s python@3.11 | |
| brew cleanup --prune-prefix | |
| brew uninstall --force --ignore-dependencies python@3.12 | |
| brew cleanup -s python@3.12 | |
| brew cleanup --prune-prefix | |
| brew uninstall --force --ignore-dependencies python@3.13 | |
| brew cleanup -s python@3.13 | |
| brew cleanup --prune-prefix | |
| sudo rm -rf /System/Library/Frameworks/Python.framework/ | |
| brew cleanup --prune-prefix | |
| sudo rm -rf /usr/local/bin/2to3 | |
| sudo rm -rf /usr/local/bin/2to3-3.11 | |
| sudo rm -rf /usr/local/bin/2to3-3.12 | |
| sudo rm -rf /usr/local/bin/2to3-3.13 | |
| sudo rm -rf /usr/local/bin/idle3 | |
| sudo rm -rf /usr/local/bin/idle3.11 | |
| sudo rm -rf /usr/local/bin/idle3.12 | |
| sudo rm -rf /usr/local/bin/idle3.13 | |
| sudo rm -rf /usr/local/bin/pydoc3 | |
| sudo rm -rf /usr/local/bin/pydoc3.11 | |
| sudo rm -rf /usr/local/bin/pydoc3.12 | |
| sudo rm -rf /usr/local/bin/pydoc3.13 | |
| sudo rm -rf /usr/local/bin/python3 | |
| sudo rm -rf /usr/local/bin/python3-config | |
| sudo rm -rf /usr/local/bin/python3.11 | |
| sudo rm -rf /usr/local/bin/python3.12 | |
| sudo rm -rf /usr/local/bin/python3.13 | |
| sudo rm -rf /usr/local/bin/python3.11-config | |
| sudo rm -rf /usr/local/bin/python3.12-config | |
| sudo rm -rf /usr/local/bin/python3.13-config | |
| sudo rm -rf /usr/local/bin/pip3.11 | |
| sudo rm -rf /usr/local/bin/pip3.12 | |
| sudo rm -rf /usr/local/bin/pip3.13 | |
| brew uninstall --force --ignore-dependencies ruby | |
| brew cleanup -s ruby | |
| brew cleanup --prune-prefix | |
| sudo rm -rf $(brew --repo homebrew/core) | |
| - name: Download the artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: metacall-tarball-${{ matrix.triplet.arch }}${{ matrix.build.suffix }} | |
| - name: Install MetaCall from package | |
| if: ${{ matrix.extension == 'pkg' }} | |
| run: sudo installer -pkg "metacall-tarball-macos-${{ matrix.triplet.arch }}${{ matrix.build.suffix }}.pkg" -target / | |
| - name: Install MetaCall from tarball | |
| if: ${{ matrix.extension == 'tar.gz' }} | |
| run: | | |
| mkdir distributable | |
| tar -xvzf metacall-tarball-macos-${{ matrix.triplet.arch }}${{ matrix.build.suffix }}.tar.gz -C `pwd`/distributable | |
| sudo cp -R `pwd`/distributable${{ matrix.triplet.install }}/ ${{ matrix.triplet.install }}/ | |
| rm -rf `pwd`/distributable | |
| # Test the package in a clean environment | |
| - name: Test | |
| run: | | |
| export PATH="${{ matrix.triplet.install }}/bin:$PATH" | |
| ./test.sh | |
| # Release package | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| fail_on_unmatched_files: true | |
| files: | | |
| metacall-tarball-macos-${{ matrix.triplet.arch }}${{ matrix.build.suffix }}.${{ matrix.extension }} | |
| install-test: | |
| name: Trigger Install Test Workflow | |
| needs: test | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - uses: convictional/trigger-workflow-and-wait@v1.6.1 | |
| with: | |
| owner: metacall | |
| repo: install | |
| github_token: ${{ secrets.G_PERSONAL_ACCESS_TOKEN }} | |
| workflow_file_name: test-macos.yml | |
| wait_workflow: true | |
| ref: master |