Run pre-commit autoupdate
#881
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 | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- master | |
tags: | |
- v* | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: Set up Python | |
uses: actions/[email protected] | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: pip install -U hatch | |
- name: Lint | |
run: hatch run style:lint | |
test: | |
name: Test | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- platform: ubuntu-latest | |
python-version: 3.8 | |
py: py38 | |
- platform: ubuntu-latest | |
python-version: 3.9 | |
py: py39 | |
- platform: ubuntu-latest | |
python-version: "3.10" | |
py: py310 | |
- platform: ubuntu-latest | |
python-version: "3.11" | |
py: py311 | |
- platform: macos-latest | |
python-version: 3.9 | |
py: py39 | |
- platform: macos-latest | |
python-version: "3.11" | |
py: py311 | |
- platform: windows-latest | |
python-version: 3.8 | |
py: py38 | |
- platform: windows-latest | |
python-version: "3.11" | |
py: py311 | |
steps: | |
- uses: actions/[email protected] | |
- name: Set up Python | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Hatch | |
run: pip install -U hatch | |
- name: Run tests | |
run: hatch run +py=${{ matrix.py }} tests:all | |
- name: Convert coverage to XML | |
run: | | |
pip install coverage covdefaults | |
coverage xml | |
- name: Upload coverage | |
uses: codecov/[email protected] | |
test-docs: | |
name: Build documentation | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: Set up Python | |
uses: actions/[email protected] | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: pip install -U hatch | |
- name: Build documentation | |
run: hatch run docs:build | |
env: | |
SPHINX_GITHUB_CHANGELOG_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/[email protected] | |
with: | |
path: docs/_build/html/* | |
build-dist: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: | |
- lint | |
- test | |
- test-docs | |
name: Build package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
name: Setup Python | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: pip install -U hatch | |
- name: Build package | |
run: hatch build | |
- uses: actions/[email protected] | |
with: | |
path: dist/* | |
name: distribution | |
pypi-upload: | |
name: Upload to PyPI | |
needs: build-dist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
with: | |
name: distribution | |
path: dist | |
- uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
# repository_url: https://test.pypi.org/legacy/ | |
skip_existing: true | |
release: | |
name: Release | |
needs: build-dist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: Get tag metadata | |
id: tag | |
run: | | |
TAG_TITLE=${GITHUB_REF#refs/*/} | |
echo "title=$TAG_TITLE" >> $GITHUB_OUTPUT | |
git -c protocol.version=2 fetch --prune --progress \ | |
--no-recurse-submodules origin \ | |
+refs/heads/*:refs/remotes/origin/* +refs/tags/*:refs/tags/* | |
TAG_BODY="$(git tag -l --format='%(contents)' $TAG_TITLE)" | |
TAG_BODY="${TAG_BODY//'%'/'%25'}" | |
TAG_BODY="${TAG_BODY//$'\n'/'%0A'}" | |
TAG_BODY="${TAG_BODY//$'\r'/'%0D'}" | |
echo "body=$TAG_BODY" >> $GITHUB_OUTPUT | |
- name: Create Release | |
uses: softprops/[email protected] | |
id: create-release | |
with: | |
name: ${{ steps.tag.outputs.title }} | |
tag_name: ${{ steps.tag.outputs.title }} | |
body: ${{ steps.tag.outputs.body }} | |
draft: false | |
prerelease: false | |
- uses: actions/[email protected] | |
name: Download builds | |
with: | |
name: distribution | |
path: dist | |
- uses: shogo82148/[email protected] | |
name: Upload release assets | |
with: | |
upload_url: ${{ steps.create-release.outputs.upload_url }} | |
asset_path: dist/* |