Wheels for Python 3.12 #904
Workflow file for this run
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: CI | |
on: | |
push: | |
branches: ["master"] | |
tags: | |
- "*" | |
pull_request: | |
branches: ["master"] | |
env: | |
# Should speed up build. See | |
# https://matklad.github.io/2021/09/04/fast-rust-builds.html | |
CARGO_INCREMENTAL: 0 | |
CARGO_NET_RETRY: 10 | |
RUSTUP_MAX_RETRIES: 10 | |
jobs: | |
tests: | |
name: "${{ matrix.os }}: Python ${{ matrix.python-version }}" | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
os: ["ubuntu-20.04", "macos-latest"] | |
runs-on: "${{ matrix.os }}" | |
env: | |
PYTHONFAULTHANDLER: "true" | |
steps: | |
- uses: "actions/checkout@v3" | |
with: | |
# We need tags to get the correct code version: | |
fetch-depth: 0 | |
- uses: "actions/setup-python@v4" | |
with: | |
python-version: "${{ matrix.python-version }}" | |
- uses: "actions-rs/toolchain@v1" | |
with: | |
toolchain: stable | |
- name: "Install rust for arm64" | |
if: startsWith(matrix.os, 'mac') && (matrix.python-version == '3.9') | |
run: | | |
rustup target add x86_64-apple-darwin | |
rustup target add aarch64-apple-darwin | |
- name: "Install gfortran" | |
if: startsWith(matrix.os, 'mac') | |
run: | | |
brew install gcc | |
gfortran --version || sudo ln -s `which gfortran-12` /usr/local/bin/gfortran | |
- uses: Swatinem/rust-cache@v1 | |
with: | |
key: "${{ matrix.os }}-${{ matrix.python-version }}" | |
- name: "Install gfortran" | |
if: contains(matrix.os, 'ubuntu') | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gfortran ninja-build lld | |
- name: "Install dependencies and code" | |
run: | | |
set -euo pipefail | |
make venv | |
. venv/bin/activate | |
python -m sysconfig | |
make | |
pip install -e .[dev] | |
- name: "Run tests" | |
run: | | |
set -euo pipefail | |
. venv/bin/activate | |
make test | |
- name: "Build macOS wheels" | |
if: startsWith(matrix.os, 'mac') && (matrix.python-version == '3.9') | |
uses: pypa/[email protected] | |
env: | |
MACOSX_DEPLOYMENT_TARGET: "11" | |
CIBW_ARCHS_MACOS: "x86_64 arm64" | |
CIBW_SKIP: "cp37-macosx_arm64 cp36* cp37* pp*" | |
CIBW_BEFORE_BUILD: "touch filpreload/src/_filpreload.c" # force rebuild of Python code with new interpreter | |
CIBW_TEST_COMMAND: python -m filprofiler run {project}/benchmarks/pystone.py | |
with: | |
output-dir: dist | |
- name: "Build manylinux wheels" | |
if: startsWith(matrix.os, 'ubuntu') && (matrix.python-version == '3.9') | |
run: | | |
set -euo pipefail | |
. venv/bin/activate | |
make manylinux-wheel | |
# Test wheel | |
deactivate | |
python3.9 -m venv venv2 | |
. venv2/bin/activate | |
pip install -r requirements-dev.txt | |
pip install dist/*-cp38-*manylinux*.whl | |
mv filprofiler filprofiler.disabled | |
make test-python-no-deps | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: "${{ matrix.os }}-${{ matrix.python-version }}-wheel" | |
path: dist/*.whl | |
# - name: Publish distribution 📦 to Test PyPI | |
# if: (startsWith(matrix.os, 'ubuntu') && (matrix.python-version == '3.9')) || startsWith(matrix.os, 'mac') | |
# env: | |
# TWINE_USERNAME: __token__ | |
# TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }} | |
# run: | | |
# set -euo pipefail | |
# . venv/bin/activate | |
# twine check dist/*.whl | |
# twine upload --repository testpypi dist/*.whl | |
- name: Publish distribution 📦 to PyPI | |
if: startsWith(github.event.ref, 'refs/tags') && ((startsWith(matrix.os, 'ubuntu') && (matrix.python-version == '3.9')) || (startsWith(matrix.os, 'mac') && (matrix.python-version == '3.9'))) | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
run: | | |
set -euo pipefail | |
. venv/bin/activate | |
twine check dist/*.whl | |
twine upload --repository pypi dist/*.whl | |
docs: | |
name: "Documentation check and publish" | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: "actions/checkout@v3" | |
- name: "Run mdbook" | |
run: | | |
set -euo pipefail | |
cd docs | |
./build.sh | |
- name: Publish | |
if: startsWith(github.event.ref, 'refs/tags') | |
env: | |
PUBLISH_DOCS_HOOK: ${{ secrets.PUBLISH_DOCS_HOOK }} | |
run: | | |
set -euo pipefail | |
curl -X POST -d '{}' "$PUBLISH_DOCS_HOOK" | |
arm-wheels: | |
name: "Wheels for ARM64" | |
runs-on: "ubuntu-latest" | |
if: startsWith(github.event.ref, 'refs/tags') | |
env: | |
CIBW_ARCHS_LINUX: aarch64 | |
CIBW_BEFORE_ALL_LINUX: "yum install -y lld; curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y" | |
CIBW_BEFORE_BUILD: "touch filpreload/src/_filpreload.c" # force rebuild of Python code with new interpreter | |
CIBW_ENVIRONMENT: 'PATH="$PATH:$HOME/.cargo/bin"' | |
CIBW_SKIP: "cp27-* cp34-* cp35-* cp36-* cp37-* cp38-* pp* *-musllinux*" | |
CIBW_TEST_COMMAND: python -m filprofiler run {project}/benchmarks/pystone.py | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# We need tags to get the correct code version: | |
fetch-depth: 0 | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: arm64 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
with: | |
output-dir: dist | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: "arm64-wheel" | |
path: dist/*.whl | |
- name: Publish distribution 📦 to PyPI | |
if: startsWith(github.event.ref, 'refs/tags') | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
run: | | |
set -euo pipefail | |
pip install twine | |
twine check dist/*.whl | |
twine upload --repository pypi dist/filprofiler*.whl |