Skip to content

Build

Build #34

Workflow file for this run

name: Build
env:
# WARNING: If you update this also update it in the pyproject.toml
BINARYEN_VERSION: 118
# WARNING: If you update this also update it in the pyproject.toml
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
release:
types:
- published
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# macos-13 is an intel runner, macos-14 is apple silicon
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
steps:
- uses: actions/checkout@v4
- name: Install macOS Dependencies
if: runner.os == 'macOS'
run: 'brew install ninja'
- name: Install Windows Dependencies
if: runner.os == 'Windows'
run: 'choco install wget -y'
- name: Restore cached libbinaryen
if: runner.os != 'Linux'
id: cache-libbinaryen-restore
uses: actions/cache/restore@v4
with:
path: ./binaryen/libbinaryen
key: ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-v${{env.BINARYEN_VERSION}}-libbinaryen
- name: Build wheels
uses: pypa/cibuildwheel@v2.20.0
- name: Cache libbinaryen
id: cache-libbinaryen-save
uses: actions/cache/save@v4
if: ${{steps.cache-libbinaryen-restore.outputs.cache-hit != 'true' && runner.os != 'Linux'}}
with:
path: ./binaryen/libbinaryen
key: ${{steps.cache-libbinaryen-restore.outputs.cache-primary-key}}
- uses: actions/upload-artifact@v4
with:
name: binaryen-py-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Link Binaryen
run: bash ./scripts/build_libbinaryen.sh
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: binaryen-py-sdist
path: dist/*.tar.gz
create_release:
name: Create Release
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: binaryen-py-*
path: dist
merge-multiple: true
- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
files: dist/*