Skip to content

chore(deps): bump the actions group across 4 directories with 2 updates #599

chore(deps): bump the actions group across 4 directories with 2 updates

chore(deps): bump the actions group across 4 directories with 2 updates #599

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
FORCE_COLOR: "3"
UVX_CONSTRAINT: requirements/lock/uvx-tools.txt
UVX_COMMAND: uvx -crequirements/lock/uvx-tools.txt
NOX_COMMAND: uv run --script noxfile.py
# EXTRA_PYTHON_VERSIONS: "pypy-3.11"
permissions: {}
jobs:
pre_job:
# continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- name: Don't run CI on draft PR
if:
github.event_name == 'pull_request' && github.event.pull_request.draft
== true
run: exit 1
- id: skip_check
uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf # v5.3.1
with:
paths_ignore: '[".cruft.json", ".copier.yml"]'
get-parameters:
name: Get parameters
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Set python version parameters
id: versions
shell: python
run: |
import os
import json
import re
import tomllib
from pathlib import Path
python_versions = []
for classifier in tomllib.loads(Path("pyproject.toml").read_text())["project"]["classifiers"]:
if match := re.match(r"Programming Language :: Python :: (\d+\.\d+)$", classifier):
python_versions.append(match.group(1))
default_python_version = Path(".python-version").read_text().strip()
extra_python_versions = [_.strip() for _ in os.getenv("EXTRA_PYTHON_VERSIONS", "").split(",") if _]
min_python_version = python_versions[0]
max_python_version = python_versions[-1]
minmax_python_versions = [min_python_version, max_python_version, *extra_python_versions]
minmax_default_python_versions = list({*minmax_python_versions, default_python_version})
all_python_versions = list({*python_versions, *extra_python_versions})
print("{default_python_version=:s}")
print("{min_python_version=:s}")
print("{max_python_version=:s}")
print("{minmax_python_versions=}")
print("{minmax_default_python_versions=}")
print("{all_python_version=}")
with open(os.getenv("GITHUB_OUTPUT"), "a") as f:
f.write(f"{default_python_version=:s}\n")
f.write(f"{min_python_version=:s}\n")
f.write(f"{max_python_version=:s}\n")
f.write(f"minmax_python_versions={json.dumps(minmax_python_versions)}\n")
f.write(f"minmax_default_python_versions={json.dumps(minmax_default_python_versions)}\n")
f.write(f"all_python_versions={json.dumps(all_python_versions)}\n")
outputs:
default-python-version:
${{ steps.versions.outputs.default_python_version }}
min-python-version: ${{ steps.versions.outputs.min_python_version }}
max-python-version: ${{ steps.versions.outputs.max_python_version }}
minmax-python-versions:
${{ steps.versions.outputs.minmax_python_versions }}
minmax-default-python-versions:
${{ steps.versions.outputs.minmax_default_python_versions }}
all-python-version: ${{ steps.versions.outputs.all_python_versions }}
lint:
# only run checks not covered by pre-commit.ci
name: Lint package
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
# Not always needed but some hooks use it...
- uses: ./.github/actions/setup-cached-uv-and-python
with:
python-version-file: ".python-version"
cache-dependency-path: uv.lock
- name: Get prek version
shell: bash
run: |
prek_version=$(grep prek "$UVX_CONSTRAINT" | cut -d " " -f1 | sed "s/prek==//")
echo "prek_version: ${prek_version}"
echo "prek_version=${prek_version}" >> "$GITHUB_ENV"
- name: Setup prek
uses: j178/prek-action@bdca6f102f98e2b4c7029491a53dfd366469e33d # v2.0.4
with:
prek-version: ${{ env.prek_version }}
install-only: true
- name: Run prek
env:
SKIP: "typecheck"
run: >-
prek run --show-diff-on-failure --color=always --all-files
--hook-stage=manual -v
pinact:
name: Pin actions
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Pin actions
uses: suzuki-shunsuke/pinact-action@896d595f299e71d65b9d28349d6956abe144390a # v3.0.0
with:
skip_push: "true"
typecheck:
name: Typecheck package
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
# - windows-latest
session:
- typecheck
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: ./.github/actions/setup-cached-uv-and-python
with:
python-version-file: ".python-version"
cache-dependency-path: uv.lock
- name: Get python version
id: python_version
run: |
python_version=$(cat .python-version)
echo "python_version=${python_version}" >> "$GITHUB_OUTPUT"
shell: bash
- name: typecheck
env:
python_version: ${{ steps.python_version.outputs.python_version }}
session: ${{ matrix.session }}
run: $NOX_COMMAND -s "${session}-${python_version}"
shell: bash
test:
name: Test package across pythons
needs:
- pre_job
- get-parameters
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
python-version:
- ${{ needs.get-parameters.outputs.default-python-version }}
markers:
- "book and nocli and cookie and nojupyter and longname"
- "book and argparse and cookie and jupyter"
- "book and click and copier and nojupyter"
- "furo and typer and copier and jupyter"
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
fetch-depth: 0 # needed for copier
- uses: ./.github/actions/setup-cached-uv-and-python
with:
python-version: |
${{ needs.get-parameters.outputs.min-python-version }}
${{ needs.get-parameters.outputs.default-python-version }}
${{ matrix.python-version }}
cache-dependency-path: uv.lock
- name: Prek cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cache/prek
key:
prek-cache|${{ runner.os }}|${{ runner.arch }}|${{
env.pythonLocation }}|${{ hashFiles(env.UVX_CONSTRAINT) }}|${{
hashFiles('.pre-commit-config.yaml') }}
- name: Setup git
run: |
git config --global init.defaultBranch main
- uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4.0.0
- name: Test with nox
env:
python_version: ${{ matrix.python-version }}
run: >-
$NOX_COMMAND -s test-"$python_version" -- ++no-cov ++test-options -m
\'${{ matrix.markers }}\'
shell: bash
# - name: Upload coverage data
# uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
# with:
# name: coverage-data-${{ matrix.os }}-${{ matrix.python-version }}
# path: .nox/test-*/tmp/.coverage*
# include-hidden-files: true
# if-no-files-found: ignore
# coverage:
# name: Combine coverage
# needs:
# - pre_job
# - test
# if: needs.pre_job.outputs.should_skip != 'true'
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
# with:
# persist-credentials: false
# - name: Download individual coverage reports
# uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
# with:
# pattern: coverage-data-*
# path: .nox
# merge-multiple: true
# - name: Display structure of downloaded files
# run: ls -aR
# - uses: ./.github/actions/setup-cached-uv-and-python
# with:
# python-version-file: ".python-version"
# cache-dependency-path: requirements/lock/uvx-tools.txt
# - name: Run coverage
# run: |
# $NOX_COMMAND -s coverage -- ++coverage combine html markdown
# cat coverage.md
# cat coverage.md >> "$GITHUB_STEP_SUMMARY"
# # fail if under 100%
# $NOX_COMMAND -s coverage -- ++coverage report ++coverage-options --fail-under=100
# shell: bash
# - name: Upload HTML report if check failed.
# uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
# with:
# name: html-report
# path: htmlcov
# if: ${{ failure() }}
docs:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
permissions:
contents: write
uses: ./.github/workflows/docs.yml
with:
deploy: false
# Ensure everything required is passing for branch protection.
required-checks-pass:
if: always()
needs:
- pre_job
- lint
- pinact
- typecheck
- test
# - coverage
- docs
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
with:
allowed-skips: "lint,pinact,typecheck,test,coverage,docs"
jobs: ${{ toJSON(needs) }}