fix(gha)(deps): bump the github-actions group with 2 updates #175
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
--- | |
# SPDX-FileCopyrightText: JΓΌrgen MΓΌlbert | |
# | |
# SPDX-License-Identifier: EUPL-1.2 | |
# | |
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: CI | |
run-name: "${{ github.event_name == 'workflow_dispatch' && format('CI: {0}', github.ref_name) || '' }}" | |
# yamllint disable-line rule:truthy | |
on: | |
push: | |
branches: [main, develop, release] | |
paths: | |
- src/* | |
- docs/* | |
- .github/workflows/ci.yml | |
- mkdocs.yml | |
- pyproject.toml | |
pull_request: | |
types: [opened, reopened, synchronize] | |
release: | |
types: [published] | |
workflow_dispatch: | |
env: | |
FORCE_COLOR: "1" | |
DEFAULT_PYTHON: "3.12" | |
ALL_PYTHON_VERSIONS: "['3.12']" | |
PRE_COMMIT_CACHE: ~/.cache/pre-commit | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repository to the GitHub Actions runner | |
- name: π§° Checkout Source Code | |
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
- name: π Set up Python | |
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 | |
with: | |
python-version: ${{ env.DEFAULT_PYTHON }} | |
check-latest: true | |
- name: π§° Install Requirements | |
run: pip install --constraint=.github/workflows/constraints.txt pip | |
- name: Init hatch check cache | |
id: python-hatch-check | |
run: echo "dir=$(hatch env show check)" >> "$GITHUB_OUTPUT" | |
# - name: Run pre-commit with hatch | |
# run: hatch run check:pre-commit run --all-files | |
# TODO: remove pre-commit | |
lint-ruff-format: | |
name: Check ruff-format | |
runs-on: ubuntu-latest | |
needs: | |
- pre-commit | |
steps: | |
# Checkout the repository to the GitHub Actions runner | |
- name: π§° Checkout Source Code | |
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
- name: π Set up Python | |
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 | |
with: | |
python-version: ${{ env.DEFAULT_PYTHON }} | |
check-latest: true | |
- name: π§° Install Requirements | |
run: pip install --constraint=.github/workflows/constraints.txt pip | |
- name: Run hatch fmt | |
run: hatch fmt --formatter | |
lint-ruff: | |
name: Check ruff-format | |
runs-on: ubuntu-latest | |
needs: | |
- pre-commit | |
steps: | |
# Checkout the repository to the GitHub Actions runner | |
- name: π§° Checkout Source Code | |
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
- name: π Set up Python | |
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 | |
with: | |
python-version: ${{ env.DEFAULT_PYTHON }} | |
check-latest: true | |
- name: π§° Install Requirements | |
run: pip install --constraint=.github/workflows/constraints.txt pip | |
- name: Run hatch fmt | |
run: hatch fmt --linter | |
lint-pylint: | |
name: Check ruff-format | |
runs-on: ubuntu-latest | |
needs: | |
- pre-commit | |
steps: | |
# Checkout the repository to the GitHub Actions runner | |
- name: π§° Checkout Source Code | |
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
- name: π Set up Python | |
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 | |
with: | |
python-version: ${{ env.DEFAULT_PYTHON }} | |
check-latest: true | |
- name: π§° Install Requirements | |
run: pip install --constraint=.github/workflows/constraints.txt pip | |
- name: Run hatch fmt | |
run: hatch run lint:pythonlint | |
test-full: | |
name: "Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }}" | |
runs-on: ${{ matrix.os }} | |
needs: | |
- lint-ruff | |
- lint-pylint | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
environment: [staging, production] | |
exclude: | |
- os: ubuntu-latest | |
python-version: "3.12" | |
steps: | |
# Checkout the repository to the GitHub Actions runner | |
- name: π§° Checkout Source Code | |
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
- name: "π Set up Python ${{ matrix.python-version }}" | |
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: π§° Install Requirements | |
run: pip install --constraint=.github/workflows/constraints.txt pip | |
- name: Run tests | |
run: hatch test --python ${{ matrix.python-version }} --cover-quiet --randomize --parallel --retries 5 --retry-delay 3 | |
- name: Disambiguate coverage filename | |
run: mv .coverage ".coverage.${{ matrix.os }}.${{ matrix.python-version }}" | |
- name: Upload coverage data | |
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 | |
with: | |
name: coverage-${{ matrix.os }}-${{ matrix.python-version }} | |
path: .coverage* | |
- name: Download coverage data | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
pattern: coverage-* | |
merge-multiple: true | |
- name: Combine coverage data | |
run: hatch run coverage:combine | |
- name: Export coverage reports | |
run: | | |
hatch run coverage:report-xml | |
hatch run coverage:report-uncovered-html | |
- name: Upload uncovered HTML report | |
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 | |
with: | |
name: uncovered-html-report | |
path: htmlcov | |
- name: Generate coverage summary | |
run: hatch run coverage:generate-summary | |
- name: Write coverage summary report | |
if: github.event_name == 'pull_request' | |
run: hatch run coverage:write-summary-report | |
- name: Update coverage pull request comment | |
if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork | |
uses: marocchino/sticky-pull-request-comment@52423e01640425a022ef5fd42c6fb5f633a02728 # v2.9.1 | |
with: | |
path: coverage-report.md | |
test-docs: | |
name: Test Docs | |
runs-on: ubuntu-latest | |
needs: test-full | |
steps: | |
# Checkout the repository to the GitHub Actions runner | |
- name: π§° Checkout Source Code | |
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
- name: π Set up Python | |
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 | |
with: | |
python-version: ${{ env.DEFAULT_PYTHON }} | |
check-latest: true | |
- name: π§° Install Requirements | |
run: pip install --constraint=.github/workflows/constraints.txt pip | |
- name: Build Docs | |
run: hatch run docs:build | |
- name: Docs build-check | |
run: hatch run docs:build-check | |
- name: Docs links check | |
run: hatch run docs:validate-links | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: | |
- test-full | |
- test-docs | |
permissions: | |
contents: write | |
packages: write | |
environment: | |
name: release | |
steps: | |
# Checkout the repository to the GitHub Actions runner | |
- name: "π§° Checkout Source Code" | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: "βοΈοΈ Set up Python" | |
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 | |
with: | |
python-version: ${{ env.DEFAULT_PYTHON }} | |
check-latest: true | |
- name: βοΈοΈ Get full Python version | |
id: full-python-version | |
run: | | |
echo version="$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")" >> "$GITHUB_OUTPUT" | |
- name: π§° Install Requirements | |
run: | | |
pip install --constraint=.github/workflows/constraints.txt pip | |
- name: βοΈοΈ Check Hatch Version | |
id: check-version | |
run: | | |
[[ "$(hatch version)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || echo "prerelease=true" >> "$GITHUB_OUTPUT" | |
- name: π§ Build and Publish | |
run: hatch build | |
- name: π¦ Create Release | |
if: startsWith(github.event.ref, 'refs/tags/') | |
uses: ncipollo/release-action@cdcc88a9acf3ca41c16c37bb7d21b9ad48560d87 # v1.15.0 | |
with: | |
artifacts: dist/* | |
token: ${{ secrets.GITHUB_TOKEN }} | |
draft: false | |
prerelease: steps.check-version.outputs.prerelease == 'true' | |
- name: Publish to PyPI | |
run: hatch publish | |
# https://github.com/marketplace/actions/alls-green#why | |
release-all-green: # This job does nothing and is only used for the branch protection | |
if: always() | |
needs: | |
- pre-commit | |
- lint-ruff-format | |
- lint-ruff | |
- lint-pylint | |
- test-full | |
- release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Decide whether the needed jobs succeeded or failed | |
uses: re-actors/alls-green@223e4bb7a751b91f43eda76992bcfbf23b8b0302 # v1.2.2 | |
with: | |
jobs: ${{ toJSON(needs) }} |