0.16.1 #174
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
env: | |
# Run tests | |
RUN_TESTS: 'true' | |
# Run security check | |
RUN_SECURITY_CHECK: 'true' | |
# Publish artifacts | |
PUBLISH_ARTIFACTS: 'true' | |
permissions: | |
contents: read | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
branches: | |
- 'main' | |
release: | |
types: [ published ] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test-package: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ '3.8', '3.9', '3.10', '3.11' ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Update conda and add it to the system path | |
run: | | |
# $CONDA is an environment variable pointing to the root of the miniconda directory | |
echo $CONDA/bin >> $GITHUB_PATH | |
# Update conda | |
conda update -n base -c defaults conda | |
- name: Install dependencies using conda | |
run: | | |
make venv | |
- name: Tests with reports | |
if: ${{ env.RUN_TESTS == 'true' }} | |
run: | | |
make test-with-report | |
deploy-package: | |
if: ${{ github.event_name == 'release' }} | |
needs: [ test-package ] | |
runs-on: ubuntu-latest | |
environment: | |
name: production | |
url: https://github.com | |
permissions: | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Update conda and add it to the system path | |
run: | | |
# $CONDA is an environment variable pointing to the root of the miniconda directory | |
echo $CONDA/bin >> $GITHUB_PATH | |
# Update conda | |
conda update -n base -c defaults conda | |
- name: Install & Update dependencies using conda | |
run: | | |
make update | |
- name: Check the security using PyUP safety package | |
if: ${{ env.RUN_SECURITY_CHECK == 'true' }} | |
run: | | |
make safety-review | |
- name: Build package | |
run: | | |
make build-package | |
- name: Publish package distributions to PyPI | |
if: ${{ env.PUBLISH_ARTIFACTS == 'true' }} | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
deploy-doc: | |
if: ${{ github.event_name == 'push' }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Update conda and add it to the system path | |
run: | | |
# $CONDA is an environment variable pointing to the root of the miniconda directory | |
echo $CONDA/bin >> $GITHUB_PATH | |
# Update conda | |
conda update -n base -c defaults conda | |
- name: Install & Update dependencies using conda | |
run: | | |
make update | |
- name: Create a cache id in Github environment | |
if: ${{ env.PUBLISH_ARTIFACTS == 'true' }} | |
run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV | |
- name: Restore all cache id(s) | |
if: ${{ env.PUBLISH_ARTIFACTS == 'true' }} | |
uses: actions/cache@v4 | |
with: | |
key: docs-${{ env.cache_id }} | |
path: .cache | |
restore-keys: | | |
docs- | |
- name: Publish package docs to Github Pages | |
if: ${{ env.PUBLISH_ARTIFACTS == 'true' }} | |
run: | | |
# Configure git | |
git config --global user.name "Mkdocs" | |
# Deploy documentation to github pages using Mkdocs | |
make mkdocs-deploy-docs |