Skip to content

Build Python Wheels #893

Build Python Wheels

Build Python Wheels #893

Workflow file for this run

name: Build Python Wheels
on:
push:
pull_request:
schedule:
- cron: "0 6 * * *" # Daily 6AM UTC build
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- name: Install native dependencies (Ubuntu)
run: sudo apt-get update && sudo apt-get install -y libgpgme-dev
if: "matrix.os == 'ubuntu-latest'"
- name: set up rust
if: matrix.os != 'ubuntu'
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- name: Install native dependencies (MacOS)
run: brew install swig gpgme
if: "matrix.os == 'macos-latest'"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel cibuildwheel
- name: Install gpg on supported platforms
run: pip install -U gpg
if: "matrix.os != 'windows-latest'"
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
if: "matrix.os == 'ubuntu-latest'"
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_ARCHS_LINUX: x86_64
# ARM builds fail at the moment:
# CIBW_ARCHS_LINUX: x86_64 aarch64
CIBW_ARCHS_MACOS: x86_64 arm64 universal2
CIBW_SKIP: '*-win32'
CIBW_ENVIRONMENT: 'PATH="$HOME/.cargo/bin:$PATH"'
CIBW_BEFORE_BUILD: >
pip install -U setuptools-rust &&
rustup default nightly &&
rustup target add all &&
rustup show
CIBW_BEFORE_BUILD_LINUX: >
pip install -U setuptools-rust &&
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=nightly --profile=minimal -y &&
rustup target add all &&
rustup show
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
publish:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/brz-')
steps:
- uses: actions/setup-python@v3
- name: Install twine
run: |
python -m pip install --upgrade pip
pip install twine
- name: Download wheels
uses: actions/download-artifact@v2
- name: Publish wheels
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload artifact/*.whl