Skip to content

CI

CI #237

Workflow file for this run

name: CI
on:
push:
branches: [refactor, main]
tags: ["*"]
schedule:
- cron: '0 8 * * MON'
pull_request:
branches: [refactor, main]
workflow_dispatch:
env:
PYTHON_LATEST: "3.11"
jobs:
pre_commit:
name: "🅿️ pre-commit"
runs-on: "ubuntu-latest"
timeout-minutes: 5
steps:
- uses: "actions/checkout@v4"
- uses: "actions/setup-python@v5"
with:
python-version: ${{env.PYTHON_LATEST}}
cache: pip
- uses: "pre-commit/[email protected]"
tests:
name: "Test Python ${{ matrix.python-version }}"
runs-on: "ubuntu-latest"
needs: "pre_commit"
timeout-minutes: 5
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "${{ matrix.python-version }}"
cache: pip
- name: "Run tests"
run: |
set -xe
python -VV
python -m site
python -m pip install -U pip setuptools wheel
python -m pip install -e ".[tests]"
coverage run --omit "src/readfish/read_until/*.py,src/readfish/entry_points/targets.py" -pm pytest
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
name: my-artifact-${{ matrix.python-version }}
path: .coverage*
if-no-files-found: warn
include-hidden-files: true
merge:
name: merge
runs-on: ubuntu-latest
needs: tests
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: coverage-data
pattern: my-artifact-*
include-hidden-files: true
coverage:
name: Combine coverage
runs-on: ubuntu-latest
needs: [tests, merge]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_LATEST }}
cache: pip
- name: Download coverage data
uses: actions/download-artifact@v4
with:
name: coverage-data
- name: Combine coverage
run: |
python -m pip install coverage[toml]
python -m coverage combine
python -m coverage report --skip-empty --fail-under=72 --format=markdown >> $GITHUB_STEP_SUMMARY
build-package:
name: Build python package
runs-on: ubuntu-latest
needs: tests
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_LATEST }}
cache: pip
- name: Build package
run: |
python -m pip install --upgrade pip
python -m pip install build
python -m build
- name: Upload built package
uses: actions/upload-artifact@v4
with:
name: built-package
path: dist/
if-no-files-found: error
build-docs:
name: Build HTML docs
runs-on: ubuntu-latest
needs: "pre_commit"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_LATEST }}
cache: pip
- name: Build docs
run: |
python -m pip install .[docs]
cd docs
make html
- name: Upload built HTML
uses: actions/upload-artifact@v4
with:
name: html-docs
path: docs/_build/html
if-no-files-found: error
deploy:
name: Deploy docs and package
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
needs:
- build-docs
- build-package
environment:
name: PyPI
url: https://pypi.org/p/readfish
permissions:
id-token: write
contents: write
steps:
- name: Download HTML docs
uses: actions/download-artifact@v4
with:
name: html-docs
path: _build/html
- name: Download python package
uses: actions/download-artifact@v4
with:
name: built-package
path: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Deploy docs to gh-pages branch
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: _build/html/