Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
whitews committed Oct 8, 2023
2 parents ce23348 + a6286d2 commit 1b7a1e3
Show file tree
Hide file tree
Showing 9 changed files with 160 additions and 74 deletions.
115 changes: 66 additions & 49 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,87 @@
name: Python CI
name: Build wheels

on:
push:
pull_request:
schedule:
- cron: '0 0 * * 0' # weekly
workflow_dispatch:

jobs:
build:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # Allow one of the matrix builds to fail without failing others
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']


# The job
name: Python ${{ matrix.python-version }} / ${{ matrix.os }}

# The steps in the job. Each step either RUNS code, or USES an action

steps:

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup python
uses: actions/setup-python@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Run tests and linting
run: |
pip install pip --upgrade
pip install --no-cache-dir -e .[dev,test,lint]
python -m black KDEpy -l 120 --check
python -m 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 docs
if: matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest'
continue-on-error: true
run: |
sudo apt install pandoc -y
sphinx-build docs/source _build/html -W
python-version: 3.11

# ======================= BUILD WHEELS AND UPLOAD TO PYPI ==================================
- name: Install cibuildwheel
run: |
pip install --upgrade pip
pip install cibuildwheel==2.15.0
- name: Build wheels (non-windows) ${{ matrix.python-version }} on ${{ matrix.os }}
if: github.ref == 'refs/heads/master' && matrix.python-version == '3.10' && matrix.os != 'windows-latest'
- name: Build wheels
env:
CIBW_BUILD: 'cp38-* cp39-* cp310-* cp311-*'
PYPI_PASSWORD: ${{ secrets.pypi_password }}
CIBW_BUILD: 'cp38-* cp39-* cp310-* cp311-* cp312-*'
CIBW_ARCHS_MACOS: x86_64 arm64
run: |
pip install cibuildwheel twine --upgrade;
python -m build --sdist
pip install cibuildwheel --upgrade;
python -m cibuildwheel --output-dir dist;
python -m twine upload dist/* -u tommyod -p "$PYPI_PASSWORD" --skip-existing;
- name: Build wheels (windows) ${{ matrix.python-version }} on ${{ matrix.os }}
if: github.ref == 'refs/heads/master' && matrix.python-version == '3.10' && matrix.os == 'windows-latest'
- name: Store artifacts
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/*.whl

package_source:
name: Package source distribution
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install build
run: python -m pip install build

- name: Run sdist
run: python -m build --sdist

- name: Store artifacts
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: ./dist/*.tar.gz

publish_to_pypi:
needs:
- build_wheels
- package_source
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' # Only publish from the master branch

steps:
- name: Download build files
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/

- name: Upload to PyPI
env:
CIBW_BUILD: 'cp38-* cp39-* cp310-* cp311-*'
PYPI_PASSWORD: ${{ secrets.pypi_password }}
run: |
pip install cibuildwheel twine --upgrade;
python -m cibuildwheel --output-dir dist;
python -m twine upload dist/* -u tommyod -p "${env:PYPI_PASSWORD}" --skip-existing;
pip install twine;
python -m twine upload dist/* -u tommyod -p "$PYPI_PASSWORD" --skip-existing;
28 changes: 28 additions & 0 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build docs

on:
workflow_dispatch:

jobs:
build_docs:
name: Build docs
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install packages
run: |
pip install pip --upgrade
pip install --no-cache-dir -e .[dev]
- name: Build docs
run: |
sudo apt install pandoc -y
sphinx-build docs/source _build/html -W
33 changes: 33 additions & 0 deletions .github/workflows/test_base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build & test

on:
workflow_call:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # Allow one of the matrix builds to fail without failing others
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install
run: |
pip install pip --upgrade
pip install -e .[dev,test,lint]
- name: Run tests and linting
run: |
python -m black KDEpy -l 120 --check
python -m 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
13 changes: 13 additions & 0 deletions .github/workflows/test_develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Build & test (develop)

on:
push:
branches:
- develop
pull_request:
branches:
- develop

jobs:
test:
uses: tommyod/KDEpy/.github/workflows/test_base.yml@develop
13 changes: 13 additions & 0 deletions .github/workflows/test_master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Build & test (master)

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test:
uses: tommyod/KDEpy/.github/workflows/test_base.yml@master
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ KDEpy/cutils_ext/cutils.c
.Python
env/
build/
_build/
html/
develop-eggs/
dist/
downloads/
Expand Down
2 changes: 1 addition & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Deployment

The KDEpy project uses TravisCI and Appveyor to build wheels for Linux, Mac and Windows.
The KDEpy project uses GitHub Actions to build wheels for Linux, Mac and Windows.
Wheels are built using the [cibuildwheel](https://github.com/joerick/cibuildwheel) Python package.
After developing, the following will push a tagged commit -- from there CI will build wheels to distribute to PyPI automatically.

Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "KDEpy"
version = "1.1.7"
version = "1.1.8"
dependencies = [
"numpy>=1.14.2,<2.0",
"scipy>=1.0.1,<2.0",
Expand All @@ -18,15 +18,17 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]

[project.urls]
Repository = "https://github.com/tommyod/KDEpy"

[project.optional-dependencies]
dev = [
"sphinx<7",
"numpydoc>=0.7.0",
"nbsphinx>=0.3.2",
"nbsphinx==0.9.1",
"ipython>=6.4.0",
"build>=0.10.0",
"matplotlib>=2.2.2"
Expand Down
22 changes: 0 additions & 22 deletions travis/build-wheels.sh

This file was deleted.

0 comments on commit 1b7a1e3

Please sign in to comment.