Skip to content

Update pythonpackage.yml #36

Update pythonpackage.yml

Update pythonpackage.yml #36

Workflow file for this run

name: Python package
on: [push]
jobs:
build:
name: Test and build on Python ${{ matrix.python_version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Enable Developer Command Prompt
if: matrix.os == 'windows-latest'
uses: ilammy/msvc-dev-cmd@v1.7.0
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pip install deap pytest
pytest
- name: Build wheel
run: |
pip install pep517 wheel
python -m pep517.build --source --binary --out-dir dist/ .
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
build-n-publish:
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Download wheels
uses: actions/download-artifact@v4.1.7
with:
name: dist
- name: Correct to manylinux
run: |
sudo apt-get update
sudo apt-get install -y patchelf
pip install auditwheel
for whl in dist/hvwfg-*-linux_x86_64.whl; do
auditwheel repair "$whl" -w dist/
done
rm dist/hvwfg-*-linux_x86_64.whl
- name: Publish distribution 📦 to PyPI
if: startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_password }}