wip #112
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: Build Package | |
on: [push, pull_request] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: ['ubuntu-latest', 'macos-11', 'macos-14'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install pipx (if required) | |
if: matrix.os == 'macos-14' | |
run: python3 -m pip install pipx | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.16.4 | |
env: | |
CIBW_BEFORE_BUILD_LINUX: yum install -y wget && ./build-drafter.sh linux | |
CIBW_BEFORE_BUILD_MACOS: port install python27 && ./build-drafter.sh mac | |
CIBW_BUILD: "cp38-manylinux_x86_64 cp38-macosx_x86_64 cp38-macosx_arm64" | |
CIBW_BUILD_VERBOSITY: 3 | |
with: | |
package-dir: . | |
output-dir: dist | |
config-file: "pyproject.toml" | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- run: pip install --upgrade pip | |
# Poetry automatically assumes the most specific tag | |
# but we don't actually need specific builds | |
# for each python version (3.8, 3.9, etc). | |
# We build one wheel then re-tag it as py3-none. | |
- name: Fix wheel tags (linux) | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
pip install wheel>=0.40.0 | |
wheel tags --python-tag py3 --abi-tag none dist/*linux*.whl --remove | |
- name: Fix wheel tags (mac) | |
if: startsWith(matrix.os, 'macos') | |
run: | | |
pip install wheel>=0.40.0 | |
wheel tags --python-tag py3 --abi-tag none dist/*-macosx*.whl --remove | |
# build sdist, only on linux | |
- name: Install dependencies | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | |
pip install poetry | |
make install | |
- name: Build sdist | |
if: startsWith(matrix.os, 'ubuntu') | |
run: poetry build --format sdist | |
- run: ls dist | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: ./dist/* | |
name: artifact-${{ matrix.os }} | |
publish: | |
needs: build | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
permissions: | |
contents: none | |
id-token: write # required for trusted publishing | |
environment: publish | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: artifact | |
pattern: artifact-* | |
merge-multiple: true | |
- run: ls artifact | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages-dir: artifact/ | |
print-hash: true |