Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 82 additions & 30 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,100 @@ name: Python package

on: [push]

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
lint:
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
python-version: ["3.11"]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash -l {0}
timeout-minutes: 15

steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
miniconda-version: "latest"
mamba-version: "*"
environment-file: conda/dev.yaml
channels: conda-forge,nodefaults
activate-environment: pyreaddbc
use-mamba: true
miniforge-variant: Mambaforge

python-version: "3.13"

- name: Install dependencies
run: |
# poetry config experimental.new-installer false
poetry config virtualenvs.create false
poetry build
poetry install
pip install -e .
pip install flake8

- name: Lint with flake8
run: |
# 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

test:
name: test ${{ matrix.os }} py${{ matrix.python-version }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: ${{ matrix.os }}
timeout-minutes: 30

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
pip install -e .
pip install pytest pandas

- name: Test with pytest
run: |
poetry run pytest -vv -k "ZIKABR21 or STPI2206 or sids" tests/
python -m pytest -vv -k "ZIKABR21 or STPI2206 or sids" tests/

coverage:
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: Install dependencies
run: |
pip install -e .
pip install pytest pytest-cov pandas

- name: Run tests with coverage
run: |
python -m pytest -vv -k "ZIKABR21 or STPI2206 or sids" --cov=pyreaddbc --cov-report=xml --cov-report=term tests/

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.xml
fail_ci_if_error: false

build_wheels:
name: Build wheel on ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- uses: pypa/cibuildwheel@v2.21
env:
CIBW_BUILD_VERBOSITY: 2

- name: Upload wheels as artifacts
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl
69 changes: 69 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: publish

on:
push:
tags:
- '*'

jobs:
build_wheels:
name: Build wheel on ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-13, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- uses: pypa/cibuildwheel@v2.21
env:
CIBW_BUILD_VERBOSITY: 2
CIBW_ARCHS_LINUX: x86_64 aarch64

- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- run: python -m pip install build && python -m build --sdist

- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz

publish:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- name: Download all wheels
uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: dist/

- name: Download source distribution
uses: actions/download-artifact@v4
with:
name: sdist
path: dist/

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPIPYREADDBCTOKEN }}
packages_dir: dist/
14 changes: 5 additions & 9 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: conda-incubator/setup-miniconda@v2
- uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
mamba-version: "*"
miniforge-version: latest
environment-file: conda/dev.yaml
channels: conda-forge,nodefaults
activate-environment: pyreaddbc
use-mamba: true
miniforge-variant: Mambaforge
auto-update-conda: true
conda-solver: libmamba

- uses: actions/setup-node@v3
with:
Expand All @@ -42,7 +41,4 @@ jobs:
if: ${{ github.event_name == 'workflow_dispatch' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPIPYREADDBCTOKEN }}
run: |
poetry config pypi-token.pypi ${PYPI_TOKEN}
make release
run: make release
3 changes: 1 addition & 2 deletions .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@
[
"@semantic-release/exec",
{
"prepareCmd": "poetry build",
"publishCmd": "poetry publish --build"
"prepareCmd": "python -m pip install build && python -m build --sdist"
}
],
[
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include pyreaddbc/c-src/blast.h
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ install:
test:
$(PYTEST) -vv -k "ZIKABR21 or STPI2206 or sids" tests/

.PHONY: coverage
coverage:
$(PYTEST) -vv -k "ZIKABR21 or STPI2206 or sids" --cov=pyreaddbc --cov-report=term --cov-report=xml tests/


.PHONY: clean-build
clean-build: ## Remove build artifacts
Expand Down
51 changes: 0 additions & 51 deletions build.py

This file was deleted.

1 change: 0 additions & 1 deletion conda/dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ channels:
- conda-forge
- nodefaults
dependencies:
- cffi
- gcc
- pip
- poetry
Loading
Loading