minor #3
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
# This workflow triggers when commit message contains "wheel" or when a tag is pushed. | |
# It will build a Python project using CIBW, then upload the wheel and source | |
# distribution to PyPI. | |
name: build-wheels | |
on: | |
push: | |
workflow_call: | |
inputs: | |
wheel: | |
required: false | |
type: string | |
nightly: | |
required: false | |
type: string | |
jobs: | |
build_wheels: | |
name: Wheel on ${{ matrix.os }} for ${{ matrix.python_version }} | |
runs-on: ${{ matrix.os }} | |
if: ${{ startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, 'wheel') || inputs.wheel }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-11] | |
python_version: ["cp39-*", "cp310-*", "cp311-*", "cp312-*"] | |
env: | |
CIBW_BUILD_VERBOSITY: 1 | |
CIBW_BEFORE_ALL_LINUX: > | |
curl https://sh.rustup.rs -sSf | sh -s -- -y && yum install -y openssl-devel zlib-devel | |
CIBW_ARCHS_LINUX: "auto64" | |
CIBW_ENVIRONMENT: 'PATH="$PATH:$HOME/.cargo/bin"' | |
CIBW_SKIP: "pp* *-win32 *-musllinux*" | |
CIBW_BUILD: ${{ matrix.python_version }} | |
CIBW_TEST_REQUIRES: pytest hypothesis | |
CIBW_TEST_COMMAND: "pytest {project}/snapatac2-python/tests" | |
steps: | |
- name: Checkout code | |
uses: nschloe/action-cached-lfs-checkout@v1 | |
- uses: ./.github/actions/setup-rust | |
- if: runner.os != 'Linux' | |
name: Setup env when not using docker | |
run: python -m pip install --upgrade wheel setuptools setuptools-rust | |
# Used to host cibuildwheel | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install cibuildwheel | |
run: python -m pip install cibuildwheel==2.16.2 | |
- name: Build wheels | |
run: python -m cibuildwheel --output-dir wheelhouse snapatac2-python | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
make_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} || inputs.nightly | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
name: Install Python | |
with: | |
python-version: '3.10' | |
- name: Install setuptools and setuptools-rust | |
run: | | |
python -m pip install --upgrade wheel setuptools setuptools-rust | |
- name: Build sdist | |
run: python setup.py sdist | |
working-directory: snapatac2-python | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: snapatac2-python/dist/*.tar.gz | |
publish: | |
needs: [build_wheels, make_sdist] | |
runs-on: ubuntu-latest | |
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) || inputs.nightly | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Delete Release | |
if: inputs.nightly | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
if gh release view nightly > /dev/null 2>&1; then | |
gh release delete nightly -y --cleanup-tag | |
fi | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist | |
- name: Publish to PyPI | |
uses: pypa/[email protected] | |
if: startsWith(github.ref, 'refs/tags') | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_password }} | |
- name: Create nightly release | |
uses: ncipollo/release-action@v1 | |
if: inputs.nightly | |
with: | |
allowUpdates: true | |
tag: nightly | |
name: Nightly Release | |
prerelease: true | |
removeArtifacts: true | |
artifacts: "dist/*.whl,dist/*.tar.gz" |