Bump the actions group in /.github/workflows with 3 updates #718
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Test | |
on: | |
push: | |
branches: | |
- master | |
tags: v* | |
pull_request: | |
schedule: | |
# run this on first day of the month at 3 am UTC | |
- cron: 0 3 1 * * | |
workflow_dispatch: | |
jobs: | |
build: | |
name: ${{ matrix.os }}, Python ${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
python-version: | |
- '3.10' | |
- '3.11' | |
- '3.12' | |
- '3.13' | |
include: | |
- os: ubuntu-20.04 | |
python-version: '3.10' | |
oldestdeps: true | |
concurrency: | |
group: ${{ github.ref }}-${{ matrix.os }}-${{ matrix.python-version }}-build | |
cancel-in-progress: true | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: astral-sh/setup-uv@887a942a15af3a7626099df99e897a18d9e5ab3a # v5.1.0 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set UV_RESOLUTION | |
if: ${{ matrix.oldestdeps }} | |
run: | | |
echo "UV_RESOLUTION=lowest-direct" >> $GITHUB_ENV | |
- name: Test package (no coverage) | |
if: ${{ !startsWith( matrix.os , 'ubuntu' ) }} | |
shell: bash # windows compat | |
run: | | |
uv run --no-editable --group test \ | |
pytest --color=yes --mpl | |
- name: Test package (with coverage) | |
if: startsWith( matrix.os , 'ubuntu' ) | |
# cannot use --frozen flag here because it would nullify UV_RESOLUTION | |
run: | | |
uv run --group test --group covcheck \ | |
coverage run --parallel-mode -m pytest --color=yes --mpl | |
- name: Upload coverage data | |
# only using reports from ubuntu because | |
# combining reports from multiple platforms is tricky (or impossible ?) | |
if: startsWith( matrix.os , 'ubuntu' ) | |
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 | |
with: | |
name: cmasher_coverage_data-${{ matrix.os }}-${{ matrix.python-version }}${{ matrix.oldestdeps }} | |
path: .coverage.* | |
if-no-files-found: ignore | |
include-hidden-files: true | |
coverage: | |
name: Combine & check coverage | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: astral-sh/setup-uv@887a942a15af3a7626099df99e897a18d9e5ab3a # v5.1.0 | |
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
pattern: cmasher_coverage_data-* | |
merge-multiple: true | |
- run: uv sync --only-group covcheck | |
- name: Check coverage | |
run: | | |
uv run --no-project coverage combine | |
uv run --no-project coverage html --skip-covered --skip-empty | |
uv run --no-project coverage report --fail-under=98 | |
- name: Upload HTML report if check failed. | |
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 | |
with: | |
name: cmasher_coverage_report | |
path: htmlcov | |
if: ${{ failure() }} | |
type-check: | |
name: type check w/ Python ${{ matrix.python-version }} | |
strategy: | |
matrix: | |
python-version: | |
- '3.10' | |
- '3.13' | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.ref }}-${{ matrix.python-version }}-typecheck | |
cancel-in-progress: true | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: astral-sh/setup-uv@887a942a15af3a7626099df99e897a18d9e5ab3a # v5.1.0 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Run mypy | |
run: uv run --no-editable --group typecheck mypy src/cmasher | |
docs: | |
name: Build docs | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.ref }}-docs | |
cancel-in-progress: true | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: astral-sh/setup-uv@887a942a15af3a7626099df99e897a18d9e5ab3a # v5.1.0 | |
with: | |
python-version: '3.13' | |
- name: Build | |
run: | | |
uv run --frozen --group docs --compile-bytecode \ | |
sphinx-build -M html docs/source site -W | |
- name: Upload artifacts | |
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 | |
with: | |
name: site | |
path: site | |
build-artifacts: | |
name: Build artifacts | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: astral-sh/setup-uv@887a942a15af3a7626099df99e897a18d9e5ab3a # v5.1.0 | |
- run: uv build | |
- run: uvx twine check dist/* | |
- run: uv run scripts/check_dist.py | |
- name: Upload artifacts | |
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 | |
with: | |
name: dist | |
path: dist | |
publish: | |
name: Publish to PyPI | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
needs: | |
- build | |
- type-check | |
- docs | |
- build-artifacts | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/CMasher | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: dist | |
path: dist | |
- name: Publish package distributions to PyPI | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
uses: pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70 # v1.12.3 |