Skip to content

[pre-commit.ci] pre-commit autoupdate #225

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #225

Workflow file for this run

name: CI
on:
push:
branches:
- main
tags:
- "*"
pull_request:
types:
- opened
- synchronize
- reopened
merge_group:
defaults:
run:
shell: sh
env:
# NOTE: The default Python version is installed with actions/setup-python.
DEFAULT_PYTHON_VERSION: "3.11"
jobs:
################################################################################
# Build source distribution
################################################################################
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Get source
uses: actions/checkout@v3
with:
submodules: true
- # Required to run job via act: https://github.com/nektos/act
name: Setup Python
uses: actions/setup-python@v4
with:
cache: "pip"
cache-dependency-path: "./requirements-ci.txt"
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
- # Required to run job via act: https://github.com/nektos/act
name: Setup dependencies
run: pip install -r "./requirements-ci.txt"
- name: Build sdist
run: pipx run --spec build pyproject-build --outdir dist
- name: Upload sdist
uses: actions/upload-artifact@v3
with:
name: dist
path: |
./dist/*.tar.gz
./dist/*.whl
################################################################################
# Test package with Tox
################################################################################
test:
name: Test / ${{ matrix.os.name }}
runs-on: ${{ matrix.os.type }}
strategy:
matrix:
os:
- name: "Linux"
type: "ubuntu-latest"
- name: "macOS"
type: "macos-latest"
- name: "Windows"
type: "windows-latest"
steps:
- name: Get source
uses: actions/checkout@v3
with:
submodules: true
- # Required to run job via act: https://github.com/nektos/act
name: Setup Python
uses: actions/setup-python@v4
with:
cache: "pip"
cache-dependency-path: "./requirements-ci.txt"
python-version: |
3.9
3.10
3.11
- # Required to run job via act: https://github.com/nektos/act
name: Setup dependencies
run: pip install -r "./requirements-ci.txt"
- name: Test
run: pipx run tox
################################################################################
# Publish docs to GitHub Pages
################################################################################
publish-docs-to-github-pages:
name: Publish docs to GitHub Pages
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [test]
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
steps:
- name: Get source
uses: actions/checkout@v3
with:
submodules: true
- # Required to run job via act: https://github.com/nektos/act
name: Setup Python
uses: actions/setup-python@v4
with:
cache: "pip"
cache-dependency-path: "./pyproject.toml"
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
- name: Setup dependencies
run: pip install .[docs]
- name: Build docs
run: |
python -X utf8 -m talondoc autogen example/docs -o knausj_talon --generate-index
python -X utf8 -m talondoc build example/docs example/docs/_build
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v2
with:
path: example/docs/_build
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
################################################################################
# Publish package to GitHub Releases
################################################################################
publish-package-to-github-releases:
name: Publish package to GitHub Releases
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [build, test]
permissions:
contents: write
steps:
- name: Download dist
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Publish to GitHub Releases
uses: softprops/action-gh-release@v1
with:
files: |
dist/*.tar.gz
dist/*.whl
fail_on_unmatched_files: true
################################################################################
# Publish package to PyPI
################################################################################
publish-package-to-pypi:
name: Publish package to PyPI
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [build, test]
environment:
name: pypi
url: https://pypi.org/p/talondoc
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Download dist
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist