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
96 changes: 33 additions & 63 deletions .github/workflows/cd-build.yml
Original file line number Diff line number Diff line change
@@ -1,87 +1,57 @@
# Build the Sphinx API documentation.
#
# pull_request → build only, as a check (no deploy)
# push: develop/main → build + deploy to GitHub Pages
name: CD

on:
push:
branches:
- master
- develop
- main
pull_request:
branches:
- develop
- main
workflow_dispatch:

jobs:

coverage:
name: Deploy Coverage Results
runs-on: ubuntu-latest

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

- name: Set up Conda with Python 3.8
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: 3.8
auto-activate-base: false

- name: Install dependencies
shell: bash -l {0}
run: |
python -m pip install --upgrade pip
python -m pip install -r develop.txt
python -m pip install twine
python -m pip install .

- name: Run Tests
shell: bash -l {0}
run: |
python setup.py test

- name: Check distribution
shell: bash -l {0}
run: |
python setup.py sdist
twine check dist/*

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.xml
flags: unittests

api:
name: Deploy API Documentation
needs: coverage
docs:
name: Build API Documentation
runs-on: ubuntu-latest
if: success()
permissions:
contents: write

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

- name: Set up Conda with Python 3.8
uses: conda-incubator/setup-miniconda@v2
- name: Set up Python
uses: actions/setup-python@v5
with:
auto-update-conda: true
python-version: 3.8
auto-activate-base: false
python-version: "3.12"
cache: pip

- name: Install dependencies
shell: bash -l {0}
run: |
conda install -c conda-forge pandoc
python -m pip install --upgrade pip
python -m pip install -r docs/requirements.txt
python -m pip install .
- name: Install package with docs dependencies
run: python -m pip install ".[docs]"

- name: Build API documentation
shell: bash -l {0}
run: |
sphinx-apidoc -t docs/_templates -feTMo docs/source cs_util
sphinx-apidoc -t docs/_script_templates -feTMo docs/source scripts
sphinx-build -E docs/source docs/_build
sphinx-build -b html docs/source docs/_build

# Upload the rendered HTML so it can be previewed from the run summary
# on pull requests, where the deploy is skipped.
- name: Upload built docs
uses: actions/upload-artifact@v4
with:
name: docs-html
path: docs/_build

- name: Deploy API documentation
uses: peaceiris/actions-gh-pages@v3.5.9
if: github.event_name == 'push'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build
84 changes: 17 additions & 67 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -1,89 +1,39 @@
name: CI

on:
push:
branches:
- develop
- main
pull_request:
branches:
- master
- develop
- main
workflow_dispatch:

jobs:
build:
test:
name: Run Unit Tests
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.10.12]
python-version: ["3.10", "3.12"]

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

- name: Report WPS Errors
uses: wemake-services/wemake-python-styleguide@0.14.1
continue-on-error: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
reporter: 'github-pr-review'
path: './cs_util'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install Poetry
run: pip install poetry
python-version: ${{ matrix.python-version }}
cache: pip

- name: Install Dependencies
shell: bash -l {0}
run: poetry install

- name: Build Package
run: poetry build
- name: Install package with test dependencies
run: python -m pip install ".[test]"

- name: Run Tests
shell: bash -l {0}
run: |
export PATH=/usr/share/miniconda/bin:$PATH
python setup.py test

- name: Save Test Results
if: always()
uses: actions/upload-artifact@v2
with:
name: unit-test-results-${{ matrix.os }}-${{ matrix.python-version }}
path: pytest.xml

- name: Check API Documentation build
shell: bash -l {0}
run: |
conda install -c conda-forge pandoc
sphinx-apidoc -t docs/_templates -feTMo docs/source cs_util
sphinx-apidoc -t docs/_script_templates -feTMo docs/source scripts
sphinx-build -b doctest -E docs/source docs/_build

- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.xml
flags: unittests

test-results:
name: Deploy Test Results
needs: build
runs-on: ubuntu-latest
if: success() || failure()

steps:
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
name: unit-test-results-ubuntu-latest-3.8
path: artifacts

- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1.5
with:
check_name: Unit Test Report
github_token: ${{ secrets.GITHUB_TOKEN }}
report_individual_runs: true
files: artifacts/pytest.xml
run: pytest
7 changes: 0 additions & 7 deletions docs/requirements.txt

This file was deleted.

4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Import relevant modules
import sys
import os
from importlib_metadata import metadata
from importlib.metadata import metadata

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand All @@ -18,7 +18,7 @@
project = "cs_util"

mdata = metadata(project)
author = mdata["Author"]
author = mdata["Author"] or mdata["Author-email"]
version = mdata["Version"]
copyright = "2022, {}".format(author)
gh_user = "martinkilbinger"
Expand Down
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,13 @@ test = [
"pytest-pydocstyle",
"pytest-cov",
]
docs = [
"sphinx>=8.0",
"numpydoc>=1.8",
"sphinxcontrib-bibtex>=2.6",
# 6.0.3 is a broken wheel on PyPI (dist-info only, no python module)
"sphinxawesome-theme>=5.3,!=6.0.3",
"nbsphinx>=0.9",
"nbsphinx-link>=1.3",
]

Loading