Skip to content

RFC: rewrite a complicated string formatting operation with an fstring (2/2) #921

RFC: rewrite a complicated string formatting operation with an fstring (2/2)

RFC: rewrite a complicated string formatting operation with an fstring (2/2) #921

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
paths-ignore:
- README.md
concurrency:
# auto-cancel any in-progress job *on the same branch*
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
unit-tests:
strategy:
matrix:
os:
- ubuntu-latest
python-version:
- '3.10'
- '3.11'
- '3.12'
- '3.13'
- 3.14-dev
include:
- os: macos-latest
python-version: '3.10'
- os: macos-latest
python-version: '3.13'
- os: windows-latest
python-version: '3.10'
- os: windows-latest
python-version: '3.13'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{ matrix.python-version }}
- uses: astral-sh/setup-uv@d8db0a86d3d88f3017a4e6b8a1e2b234e7a0a1b5 # v4.0.0
- name: Build (without coverage)
if: matrix.os != 'ubuntu-latest'
run: uv sync --python-preference=only-system --group test --no-editable
- name: Build (with coverage)
if: matrix.os == 'ubuntu-latest'
run: uv sync --python-preference=only-system --group test --group covcheck --no-editable
- run: uv pip list
- name: Run tests (without coverage)
if: matrix.os != 'ubuntu-latest'
run: |
uv run --no-project pytest --color=yes --doctest-modules
- name: Run tests (with coverage)
if: matrix.os == 'ubuntu-latest'
run: |
uv run --no-project coverage run --parallel-mode \
-m pytest --color=yes --doctest-modules
- name: Upload coverage data
# only using reports from ubuntu because
# combining reports from multiple platforms is tricky (or impossible ?)
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: inifix_coverage_data-${{ matrix.os }}-${{ matrix.python-version }}
path: .coverage.*
if-no-files-found: ignore
include-hidden-files: true
concurrency-tests:
strategy:
matrix:
os:
- ubuntu-latest
python-version:
- '3.13'
- 3.14-dev
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: ${{ matrix.python-version }}
- uses: astral-sh/setup-uv@d8db0a86d3d88f3017a4e6b8a1e2b234e7a0a1b5 # v4.0.0
- name: Build
run: uv sync --python-preference=only-system --group test --group concurrency --no-editable
- run: uv pip list
- run: uv run --no-project pytest --color=yes --count 100 tests/test_concurrent.py
coverage:
name: Combine & check coverage
runs-on: ubuntu-latest
needs: unit-tests
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: astral-sh/setup-uv@d8db0a86d3d88f3017a4e6b8a1e2b234e7a0a1b5 # v4.0.0
- run: uv sync --only-group covcheck
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
pattern: inifix_coverage_data-*
merge-multiple: true
- 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=100
- name: Upload HTML report if check failed.
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: inifix_coverage_report
path: htmlcov
if: ${{ failure() }}
type-check:
strategy:
matrix:
python-version:
- '3.10'
- '3.13'
runs-on: ubuntu-latest
name: type check
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.python-version }}-typecheck
cancel-in-progress: true
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@d8db0a86d3d88f3017a4e6b8a1e2b234e7a0a1b5 # v4.0.0
- name: Build
run: uv sync -p ${{ matrix.python-version }} --group typecheck --no-editable
- name: Run mypy
run: uv run mypy src/inifix
check-readme:
runs-on: ubuntu-latest
name: check README.md
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@d8db0a86d3d88f3017a4e6b8a1e2b234e7a0a1b5 # v4.0.0
- run: uv run scripts/check_readme.py