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
48 changes: 0 additions & 48 deletions .github/workflows/pip.yaml

This file was deleted.

56 changes: 56 additions & 0 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish to PyPI

on:
push:
tags:
- "v*"
workflow_dispatch:

concurrency:
group: publish-${{ github.ref_name }}
cancel-in-progress: false

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: Install version-check dependencies
if: github.event_name != 'workflow_dispatch'
run: pip install packaging

# Tags are the release trigger, so a stale tag (forgot to bump
# __version__) must fail loudly instead of publishing the wrong
# version. `version` is declared `dynamic` in pyproject.toml, so it is
# read the same way scripts/check_package_versions.py reads it.
- name: Verify tag matches the package version
if: github.event_name != 'workflow_dispatch'
run: |
tag_version="${GITHUB_REF_NAME#v}"
pkg_version=$(python -c "import sys; sys.path.insert(0, 'scripts'); from check_package_versions import local_version; print(local_version())")
if [ "$tag_version" != "$pkg_version" ]; then
echo "Tag version $tag_version does not match CompStats.__version__ $pkg_version" >&2
exit 1
fi

- name: Install build tooling
run: pip install build twine

# CompStats is pure Python: one sdist and one universal wheel, built once.
- name: Build sdist and wheel
run: python -m build

- name: Check package metadata
run: twine check dist/*

# `TWINE` is a repository secret holding a PyPI API token.
- name: Upload to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE }}
run: twine upload dist/*
42 changes: 0 additions & 42 deletions .github/workflows/publish.yml

This file was deleted.

53 changes: 0 additions & 53 deletions .github/workflows/test.yaml

This file was deleted.

81 changes: 81 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: test

on:
push:
branches: [main, develop]
pull_request:

env:
# The suite draws seaborn figures; the runner has no display.
MPLBACKEND: Agg

jobs:
# The whole suite: no test touches the network.
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install package and test dependencies
run: pip install -e ".[test]"
- name: Run tests
run: pytest CompStats

# Coverage is collected once (not per matrix cell) and sent to Coveralls,
# which the README badge reads. `.coveragerc` omits the tests package.
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install package, test and coverage dependencies
run: |
pip install -e ".[test]"
pip install coverage coveralls
- name: Run tests with coverage
run: coverage run -m pytest CompStats
- name: Report
run: coverage report
- name: Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: coveralls --service=github

# Hard gate on the single-step-ahead rule: __version__ may not be behind,
# equal to, or more than one release past what is published on PyPI.
check-package-versions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install checker dependencies
run: pip install packaging
- name: Check package versions against PyPI
run: python scripts/check_package_versions.py

# Sphinx gate: a strict HTML build of the developer reference. Any broken
# cross-reference or other warning fails it. The docstring examples are not
# run (their outputs depend on random bootstrap samples).
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install docs and package dependencies
run: |
pip install -r docs/requirements.txt
pip install -e .
- name: Build the docs strictly
run: python -m sphinx -n -W --keep-going -b html docs/source docs/build/html
75 changes: 75 additions & 0 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Publish website

# One GitHub Pages site, two sources: the Quarto user site (quarto/) at the
# root and the Sphinx developer reference (docs/) under /dev/. Pull requests
# and pushes to develop only build both; pushes to main also deploy them.
#
# The Quarto pages that are notebooks are never executed here: Quarto reads
# their results from the committed quarto/_freeze/ cache. If a notebook was
# changed without refreshing the cache, the render step fails ("Jupyter is
# not available"); the fix is to render locally and commit quarto/_freeze/.
on:
pull_request:
paths:
- "quarto/**"
- "docs/**"
- "CompStats/**"
- "pyproject.toml"
- ".github/workflows/website.yml"
push:
branches: [main, develop]
paths:
- "quarto/**"
- "docs/**"
- "CompStats/**"
- "pyproject.toml"
- ".github/workflows/website.yml"
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: quarto-dev/quarto-actions/setup@v2
with:
# Keep equal to the version used to produce quarto/_freeze/.
version: 1.10.20

- run: quarto render quarto

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

- name: Install docs and package dependencies
run: |
pip install -r docs/requirements.txt
# Not --no-deps: conf.py imports CompStats, and autodoc imports its
# dependencies with it.
pip install -e .

- name: Build the developer docs strictly into the site
run: python -m sphinx -n -W --keep-going -b html docs/source quarto/_site/dev

- uses: actions/upload-pages-artifact@v3
with:
path: quarto/_site

deploy:
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
concurrency:
group: website
cancel-in-progress: true
steps:
- id: deployment
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ htmlcov/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
Expand All @@ -70,6 +69,7 @@ instance/

# Sphinx documentation
docs/_build/
docs/build/

# PyBuilder
.pybuilder/
Expand Down
12 changes: 0 additions & 12 deletions .readthedocs.yaml

This file was deleted.

Loading
Loading