Update locked dependencies #35
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: Lint, Type-Check, Test, Build and Publish Package | |
on: | |
pull_request: | |
branches: [main] | |
push: | |
branches: [main] | |
tags: ["v*"] | |
jobs: | |
uv-check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
cache-dependency-glob: uv.lock | |
- name: Check uv.lock | |
run: uv lock --locked | |
mypy: | |
needs: uv-check | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
cache-dependency-glob: uv.lock | |
- name: Set Up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install mypy From Locked Dependencies | |
run: uv sync --python ${{ matrix.python-version }} --no-python-downloads --only-group | |
type-check --frozen | |
- name: Save Hashed Python Version | |
run: echo "HASHED_PYTHON_VERSION=$(uv run --no-sync --no-python-downloads --python | |
${{ matrix.python-version }} python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
with: | |
path: ./.mypy_cache | |
key: mypy|${{ env.HASHED_PYTHON_VERSION }} | |
- name: Run mypy | |
run: uv run --python ${{ matrix.python-version }} --no-sync --no-python-downloads mypy | |
. | |
pre-commit: | |
needs: uv-check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
cache-dependency-glob: uv.lock | |
- name: Set Up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version-file: .python-version | |
- name: Install pre-commit From Locked Dependencies | |
run: uv sync --no-python-downloads --only-group pre-commit --frozen | |
- name: Save Hashed Python Version | |
run: echo "HASHED_PYTHON_VERSION=$(uv run --no-sync --no-python-downloads --python | |
${{ matrix.python-version }} python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit|${{ env.HASHED_PYTHON_VERSION }}|${{ hashFiles('.pre-commit-config.yaml')}} | |
- name: Setup pre-commit Environments | |
run: uv run --no-sync --no-python-downloads pre-commit install-hooks | |
- name: Store pre-commit Checks Which Require Skipping | |
run: echo "SKIP=check-github-workflows,ruff,ruff-format,taplo-format,taplo-lint,uv-lock,yamlfmt" | |
>> $GITHUB_ENV | |
- name: Run pre-commit | |
run: uv run --no-sync --no-python-downloads pre-commit run --all-files --hook-stage | |
manual | |
pytest: | |
needs: uv-check | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
cache-dependency-glob: uv.lock | |
- name: Set Up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install pytest From Locked Dependencies | |
run: uv sync --python ${{ matrix.python-version }} --no-python-downloads --only-group | |
test --frozen | |
- name: Save Hashed Python Version | |
run: echo "HASHED_PYTHON_VERSION=$(uv run --no-sync --no-python-downloads --python | |
${{ matrix.python-version }} python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
with: | |
path: ./.pytest_cache | |
key: pytest|${{ env.HASHED_PYTHON_VERSION }} | |
- name: Run pytest | |
run: uv run --python ${{ matrix.python-version }} --no-sync --no-python-downloads pytest | |
ruff: | |
needs: uv-check | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
cache-dependency-glob: uv.lock | |
- name: Set Up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install ruff From Locked Dependencies | |
run: uv sync --python ${{ matrix.python-version }} --no-python-downloads --only-group | |
lint-format --frozen | |
- name: Save Hashed Python Version | |
run: echo "HASHED_PYTHON_VERSION=$(uv run --no-sync --no-python-downloads --python | |
${{ matrix.python-version }} python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
with: | |
path: ./.ruff_cache | |
key: ruff|${{ env.HASHED_PYTHON_VERSION }} | |
- name: Run Ruff | |
run: uv run --python ${{ matrix.python-version }} --no-sync --no-python-downloads ruff | |
check --output-format=github | |
taplo-format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
cache-dependency-glob: uv.lock | |
- name: Set Up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version-file: .python-version | |
- name: Install Taplo From Locked Dependencies | |
run: uv sync --no-python-downloads --only-group lint-format --frozen | |
- name: Run Taplo Formatter | |
run: uv run taplo format . --check | |
taplo-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
cache-dependency-glob: uv.lock | |
- name: Set Up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version-file: .python-version | |
- name: Install Taplo From Locked Dependencies | |
run: uv sync --no-python-downloads --only-group lint-format --frozen | |
- name: Run Taplo Linter | |
run: uv run taplo lint . --default-schema-catalogs | |
yamlfmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Golang | |
uses: actions/setup-go@v5 | |
with: | |
cache: false | |
- name: Install yamlfmt | |
run: go install github.com/google/yamlfmt/cmd/yamlfmt@latest | |
- name: Run yamlfmt | |
run: yamlfmt . -lint | |
build: | |
needs: [mypy, pre-commit, pytest, ruff, taplo-format, taplo-lint, yamlfmt] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
cache-dependency-glob: uv.lock | |
- name: Build Package | |
run: uv build --no-sources | |
- name: Save Build Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: built-typed_classproperties-package | |
path: dist/ | |
publish: | |
needs: [build] | |
runs-on: ubuntu-latest | |
environment: publish | |
permissions: | |
id-token: write | |
if: github.ref_type == 'tag' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
cache-dependency-glob: uv.lock | |
- name: Download Build Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: built-typed_classproperties-package | |
path: dist/ | |
- name: Publish to PyPI | |
run: uv publish | |
test-publish: | |
needs: [build] | |
runs-on: ubuntu-latest | |
environment: test-publish | |
permissions: | |
id-token: write | |
if: github.ref_type != 'tag' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
cache-dependency-glob: uv.lock | |
- name: Download Build Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: built-typed_classproperties-package | |
path: dist/ | |
- name: Publish to PyPI | |
run: uv publish --publish-url https://test.pypi.org/legacy/ | |
release: | |
needs: [publish] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
if: github.ref_type == 'tag' | |
steps: | |
- name: Download Build Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: built-typed_classproperties-package | |
path: dist/ | |
- name: Sign Build Artifacts | |
uses: sigstore/[email protected] | |
with: | |
inputs: ./dist/*.tar.gz ./dist/*.whl | |
- name: Create GitHub Release | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: gh release create '${{ github.ref_name }}' --repo '${{ github.repository }}' --notes | |
"" | |
- name: Add Signed Build Artifacts To GitHub Release | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: gh release upload '${{ github.ref_name }}' dist/** --repo '${{ github.repository | |
}}' |