Build and publish to PyPI #50
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: Build and publish to PyPI | |
on: | |
release: | |
types: [created] | |
jobs: | |
build-sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
lfs: 'true' | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools oldest-supported-numpy cython flake8 | |
- name: Check for syntax errors | |
run: | | |
flake8 ./ms2pip ./fasta2speclib --count --select=E9,F63,F7,F82 --show-source --statistics | |
- name: Build sdist | |
run: python setup.py sdist | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: dist | |
path: dist/*.tar.gz | |
build-wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
lfs: 'true' | |
- uses: actions/setup-python@v2 | |
name: Install Python | |
with: | |
python-version: '3.10' | |
- name: Check for syntax errors | |
run: | | |
python -m pip install flake8 | |
flake8 ./ms2pip ./fasta2speclib --count --select=E9,F63,F7,F82 --show-source --statistics | |
- name: Install cibuildwheel | |
run: python -m pip install cibuildwheel==2.3.1 | |
- name: Build wheels | |
run: python -m cibuildwheel --output-dir dist | |
env: | |
# No XGBoost wheels for 32bit Windows | |
CIBW_BUILD: "cp3*-manylinux_x86_64 cp3*-win_amd64 cp3*-macosx_x86_64" | |
CIBW_SKIP: "cp36-* cp39-macosx_x86_64" # EOL & build issue #216 | |
CIBW_BEFORE_ALL_MACOS: "brew install libomp" | |
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014" | |
CIBW_TEST_REQUIRES: "pytest" | |
CIBW_TEST_COMMAND: "pytest {project}/tests" | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: dist | |
path: dist/ms2pip-*.whl | |
publish-to-pypi: | |
needs: [build-sdist, build-wheels] | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/ms2pip | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v2 | |
with: | |
name: dist | |
path: dist | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |