Simplify GH actions #417
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/CD flow | ||
on: | ||
push: | ||
branches: [master, develop] | ||
pull_request: | ||
branches: [master, develop] | ||
workflow_dispatch: | ||
jobs: | ||
test_and_build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
pip install --upgrade pip | ||
pip install -e .[dev,test,lint] | ||
pip install cibuildwheel==2.15.0 | ||
- name: Run tests and linting | ||
run: | | ||
black KDEpy -l 120 --check | ||
flake8 --show-source --ignore=F811,W293,W391,W292,W291,W504,W503,E231 --max-line-length=120 --exclude="*examples.py,testing.py,*kde.py" KDEpy | ||
pytest KDEpy --doctest-modules --capture=sys | ||
- name: Build wheels | ||
env: | ||
CIBW_BUILD: cp${{ matrix.python-version//.}}* | ||
Check failure on line 40 in .github/workflows/build.yml GitHub Actions / CI/CD flowInvalid workflow file
|
||
CIBW_ARCHS_MACOS: x86_64 arm64 | ||
CIBW_SKIP: pp* *-musllinux_* *-manylinux_i686 | ||
run: | | ||
python -m cibuildwheel --output-dir dist | ||
- name: Store artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: python-package-distributions | ||
path: dist/*.whl | ||
build_docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
- name: Install dependencies | ||
run: | | ||
pip install --upgrade pip | ||
pip install -e .[dev] | ||
sudo apt install pandoc -y | ||
- name: Build docs | ||
run: sphinx-build docs/source _build/html -W | ||
publish: | ||
needs: [test_and_build, build_docs] | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@e53eb8b103ffcb59469888563dc324e3c8ba6f06 | ||
with: | ||
skip-existing: true | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} |