feat/tests #31
This file contains 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: | |
workflow_dispatch: | |
pull_request: | |
push: | |
tags: | |
- 'v*.*.*' | |
branches: | |
- master | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
triplet: [ | |
{os: macos-13, arch: amd64}, | |
{os: macos-14, arch: arm64}, | |
] | |
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: Clean | |
run: | | |
brew uninstall --force --ignore-dependencies node | |
brew cleanup -s node | |
brew cleanup --prune-prefix | |
brew uninstall --force --ignore-dependencies [email protected] | |
brew cleanup -s [email protected] | |
brew cleanup --prune-prefix | |
brew uninstall --force --ignore-dependencies [email protected] | |
brew cleanup -s [email protected] | |
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/idle3 | |
sudo rm -rf /usr/local/bin/idle3.11 | |
sudo rm -rf /usr/local/bin/idle3.12 | |
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/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.11-config | |
sudo rm -rf /usr/local/bin/python3.12-config | |
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 | |
- name: Test | |
run: ./test.sh | |
# Upload build artifact | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: metacall-tarball-${{ matrix.triplet.arch }} | |
path: release/* | |
test: | |
needs: build | |
strategy: | |
fail-fast: false | |
matrix: | |
triplet: [ | |
{os: macos-13, arch: amd64}, | |
{os: macos-14, arch: arm64}, | |
] | |
runs-on: ${{ matrix.triplet.os }} | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Uninstall brew completely | |
run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" | |
- name: Download the artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: metacall-tarball-${{ matrix.triplet.arch }} | |
# Install from package | |
- name: Install MetaCall package | |
run: sudo installer -pkg "metacall-tarball-macos-${{ matrix.triplet.arch }}.pkg" -target / | |
# TODO: Test the tgz file | |
# Test the package in a clean environment | |
- name: Test | |
run: ./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 }}.pkg | |
metacall-tarball-macos-${{ matrix.triplet.arch }}.tgz |