Skip to content

Handle building manually in a venv #40

Handle building manually in a venv

Handle building manually in a venv #40

Workflow file for this run

name: Build distribution files
on:
workflow_dispatch:
workflow_call:
pull_request:
push:
branches: [main]
jobs:
sdist:
name: Source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install 'build' package
run: pip install build
- name: Build sdist
run: python -m build --sdist
- name: Test sdist
run: |
SDIST=$(ls dist/*.tar.gz)
pip install $SDIST[test]
pytest
- uses: actions/upload-artifact@v4
with:
name: package-sdist
path: dist/*.tar.gz
wheels:
name: Binary wheels
runs-on: ${{ matrix.os }}
strategy:
matrix:
# macos-13 is x86, 14 is arm64 (https://cibuildwheel.pypa.io/en/stable/setup/#github-actions)
os: [windows-latest, ubuntu-latest, macos-13, macos-14]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install cibuildwheel
run: pip install cibuildwheel==2.17.0
- uses: ilammy/msvc-dev-cmd@v1
if: startsWith(matrix.os, 'windows')
with:
arch: x64
- name: Enable Xcode SDK
if: startsWith(matrix.os, 'macos')
# See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable
# See https://stackoverflow.com/a/65277351 about SDKROOT variable
run: echo "SDKROOT=$(xcrun --sdk macosx --show-sdk-path)" >> "$GITHUB_ENV"
- name: Install custom Python 3.8
if: matrix.os == 'macos-14'
# See https://cibuildwheel.pypa.io/en/stable/faq/#macos-building-cpython-38-wheels-on-arm64
# Default behavior breaks generate-stub.py script because it imports compiled module
run: |
curl -o /tmp/Python38.pkg https://www.python.org/ftp/python/3.8.10/python-3.8.10-macos11.pkg
sudo installer -pkg /tmp/Python38.pkg -target /
sh "/Applications/Python 3.8/Install Certificates.command"
- name: Build wheels
# See https://stackoverflow.com/a/65277351 about SDKROOT if: startsWith(matrix.os, 'ubuntu')
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD_VERBOSITY: 1
- uses: actions/upload-artifact@v4
with:
name: package-wheels-${{matrix.os}}
path: ./wheelhouse/*.whl