Skip to content

Commit

Permalink
add new
Browse files Browse the repository at this point in the history
  • Loading branch information
tommyod committed Sep 1, 2024
1 parent 3e133d9 commit 3913bc9
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: CI/CD

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//.}}*
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 }}

0 comments on commit 3913bc9

Please sign in to comment.