Skip to content

Commit 375fca4

Browse files
committed
fix: Remove EAGER_IMPORT export and update CI configurations
Remove the EAGER_IMPORT environment variable export from bench.sh as it's no longer needed. Update GitHub Actions workflows (bench, docs, release, test) to use standardized configurations including branch filtering, concurrency controls, and improved job structures. Update Read the Docs configuration to include --all-packages flag for uv sync. Add Python 3.14 classifier and lazy-loader dependency to pyproject.toml. These changes standardize the CI/CD pipeline configurations, improve build reliability, and ensure compatibility with newer Python versions.
1 parent f7444d2 commit 375fca4

9 files changed

Lines changed: 89 additions & 134 deletions

File tree

template/.config/copier/mise-tasks/bench.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,4 @@ set -o errexit
55
set -o nounset
66
set -o pipefail
77

8-
# ref: <https://github.com/scientific-python/lazy-loader#early-failure>
9-
export EAGER_IMPORT=1
10-
118
pytest -m 'benchmark' --numprocesses 0 --codspeed --codspeed-warmup-time='0.2' "$@"

template/.config/copier/mise-tasks/test.sh

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,12 @@ set -o errexit
55
set -o nounset
66
set -o pipefail
77

8-
function is-in-ci() {
9-
if [[ -z ${CI:-} ]]; then
8+
function in-ci() {
9+
if [[ -n ${CI:-} ]]; then
10+
return 0
11+
else
1012
return 1
1113
fi
12-
case "${CI,,}" in
13-
1 | on | true | y | yes) return 0 ;;
14-
0 | off | false | n | no | "") return 1 ;;
15-
*)
16-
echo "Invalid boolean: $CI." >&2
17-
exit 1
18-
;;
19-
esac
2014
}
2115

2216
function needs-gpu() {
@@ -37,7 +31,7 @@ else
3731
numprocesses='auto'
3832
fi
3933

40-
if is-in-ci; then
34+
if in-ci; then
4135
# ref: <https://docs.codecov.com/docs/test-analytics#1-output-a-junit-xml-file-in-your-ci>
4236
pytest \
4337
--junit-xml='junit.xml' --override-ini junit_family=legacy \

template/.github/workflows/bench.yaml

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,36 @@ name: Bench
55

66
on:
77
push:
8+
branches-ignore:
9+
- copier-update
10+
- mega-linter-fix/**
11+
- pre-commit-ci-update-config
12+
- release-please--branches**
813
pull_request:
914
workflow_dispatch:
1015

11-
jobs:
12-
skip-duplicate:
13-
name: Skip Duplicate
14-
permissions:
15-
actions: write
16-
runs-on: ubuntu-latest
17-
outputs:
18-
should-skip: ${{ steps.skip-duplicate.outputs.should-skip }}
19-
steps:
20-
- id: skip-duplicate
21-
name: Skip Duplicate
22-
uses: liblaf/actions/skip-duplicate@dist
23-
with:
24-
cancel-others: true
16+
env:
17+
FORCE_COLOR: 1
2518

26-
collect:
27-
name: Collect
28-
needs:
29-
- skip-duplicate
30-
if: needs.skip-duplicate.outputs.should-skip != 'true'
19+
concurrency:
20+
group: ${{ github.workflow }} @ ${{ github.ref }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
metadata:
25+
name: Metadata
3126
runs-on: ubuntu-latest
3227
outputs:
3328
has-benches: ${{ steps.collect.outputs.has-benches }}
29+
python-versions: ${{ steps.inspect.outputs.supported_python_classifiers_json_array }}
3430
steps:
3531
- name: Checkout
3632
uses: actions/checkout@v5
33+
- id: inspect
34+
name: Build and Inspect a Python Package
35+
uses: hynek/build-and-inspect-python-package@v2
3736
- name: Setup Python
38-
uses: liblaf/actions/setup-python@dist
37+
uses: liblaf/actions/setup-python@v1
3938
- id: collect
4039
name: Collect
4140
run: |-
@@ -48,14 +47,16 @@ jobs:
4847
bench:
4948
name: Bench
5049
needs:
51-
- collect
52-
if: needs.collect.outputs.has-benches == 'true'
50+
- metadata
51+
if: needs.metadata.outputs.has-benches == 'true'
5352
runs-on: ubuntu-latest
5453
steps:
5554
- name: Checkout
5655
uses: actions/checkout@v5
5756
- name: Setup Python
58-
uses: liblaf/actions/setup-python@dist
57+
uses: liblaf/actions/setup-python@v1
58+
with:
59+
python-version: ${{ matrix.python-version }}
5960
- name: Install Mise
6061
uses: jdx/mise-action@v3
6162
- name: Bench
@@ -65,3 +66,7 @@ jobs:
6566
mode: instrumentation
6667
env:
6768
FORCE_COLOR: 1
69+
strategy:
70+
matrix:
71+
python-version: ${{ fromJson(needs.metadata.outputs.python-versions) }}
72+
fail-fast: false

template/.github/workflows/build.yaml

Lines changed: 0 additions & 36 deletions
This file was deleted.

template/.github/workflows/docs.yaml

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,54 +5,43 @@ name: Docs
55

66
on:
77
push:
8+
branches-ignore:
9+
- copier-update
10+
- mega-linter-fix/**
11+
- pre-commit-ci-update-config
12+
- release-please--branches**
813
pull_request:
914
workflow_dispatch:
1015

1116
jobs:
12-
skip-duplicate:
13-
name: Skip Duplicate
14-
permissions:
15-
actions: write
16-
runs-on: ubuntu-latest
17-
outputs:
18-
should-skip: ${{ steps.skip-duplicate.outputs.should-skip }}
19-
steps:
20-
- id: skip-duplicate
21-
name: Skip Duplicate
22-
uses: liblaf/actions/skip-duplicate@dist
23-
with:
24-
cancel-others: true
25-
2617
docs:
2718
name: Docs
2819
permissions:
29-
contents: write
20+
id-token: write
3021
pages: write
31-
needs:
32-
- skip-duplicate
33-
if: needs.skip-duplicate.outputs.should-skip != 'true'
3422
runs-on: ubuntu-latest
23+
environment:
24+
name: github-pages
25+
url: ${{ steps.deploy.outputs.page_url }}
3526
steps:
3627
- name: Checkout
3728
uses: actions/checkout@v5
3829
with:
3930
fetch-depth: 0
31+
- name: Configure GitHub Pages
32+
uses: actions/configure-pages@v5
4033
- name: Setup Python
41-
uses: liblaf/actions/setup-python@dist
34+
uses: liblaf/actions/setup-python@v1
4235
- if: hashFiles('docs/scripts/pre-build.sh') != ''
4336
name: Pre-Build
4437
run: docs/scripts/pre-build.sh
4538
- name: Build
4639
run: mkdocs build
47-
- if: ${{ github.ref == 'refs/heads/main' }}
48-
name: Deploy
49-
uses: JamesIves/github-pages-deploy-action@v4
50-
with:
51-
folder: site
52-
single-commit: true
53-
- if: ${{ github.ref == 'refs/heads/main' }}
54-
name: Setup GitHub Pages
55-
uses: liblaf/actions/setup-pages@dist
40+
- name: Upload Github Pages Artifact
41+
uses: actions/upload-pages-artifact@v4
5642
with:
57-
token: ${{ github.token }}
58-
continue-on-error: true
43+
path: site
44+
- id: deploy
45+
if: ${{ github.ref == 'refs/heads/main' }}
46+
name: Deploy Github Pages Site
47+
uses: actions/deploy-pages@v4

template/.github/workflows/release.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ jobs:
4949
- name: Publish to PyPI
5050
uses: pypa/gh-action-pypi-publish@release/v1
5151
with:
52+
verbose: true
53+
print-hash: true
5254
attestations: true
5355

5456
release:
@@ -69,7 +71,6 @@ jobs:
6971
name: ${{ needs.build.outputs.artifact-name }}
7072
path: dist
7173
- name: Upload Release Assets
72-
uses: liblaf/actions/release@dist
74+
uses: softprops/action-gh-release@v2
7375
with:
7476
files: dist/*
75-
tag: ${{ github.ref_name }}

template/.github/workflows/test.yaml

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,36 @@ name: Test
77

88
on:
99
push:
10+
branches-ignore:
11+
- copier-update
12+
- mega-linter-fix/**
13+
- pre-commit-ci-update-config
14+
- release-please--branches**
1015
pull_request:
1116
workflow_dispatch:
1217

13-
jobs:
14-
skip-duplicate:
15-
name: Skip Duplicate
16-
permissions:
17-
actions: write
18-
runs-on: ubuntu-latest
19-
outputs:
20-
should-skip: ${{ steps.skip-duplicate.outputs.should-skip }}
21-
steps:
22-
- id: skip-duplicate
23-
name: Skip Duplicate
24-
uses: liblaf/actions/skip-duplicate@dist
25-
with:
26-
cancel-others: true
18+
env:
19+
FORCE_COLOR: 1
2720

28-
collect:
29-
name: Collect
30-
needs:
31-
- skip-duplicate
32-
if: needs.skip-duplicate.outputs.should-skip != 'true'
21+
concurrency:
22+
group: ${{ github.workflow }} @ ${{ github.ref }}
23+
cancel-in-progress: true
24+
25+
jobs:
26+
metadata:
27+
name: Metadata
3328
runs-on: ubuntu-latest
3429
outputs:
3530
has-tests: ${{ steps.collect.outputs.has-tests }}
31+
python-versions: ${{ steps.inspect.outputs.supported_python_classifiers_json_array }}
3632
steps:
3733
- name: Checkout
3834
uses: actions/checkout@v5
35+
- id: inspect
36+
name: Build and Inspect a Python Package
37+
uses: hynek/build-and-inspect-python-package@v2
3938
- name: Setup Python
40-
uses: liblaf/actions/setup-python@dist
39+
uses: liblaf/actions/setup-python@v1
4140
- id: collect
4241
name: Collect
4342
run: |-
@@ -49,26 +48,27 @@ jobs:
4948
5049
test:
5150
name: Test
52-
needs:
53-
- collect
54-
if: needs.collect.outputs.has-tests == 'true'
5551
permissions:
5652
id-token: write
53+
needs:
54+
- metadata
55+
if: needs.metadata.outputs.has-tests == 'true'
5756
runs-on: ubuntu-latest
5857
steps:
5958
- name: Checkout
6059
uses: actions/checkout@v5
6160
with:
6261
fetch-depth: 0 # I don't know why, but it is present in the official example
6362
- name: Setup Python
64-
uses: liblaf/actions/setup-python@dist
63+
uses: liblaf/actions/setup-python@v1
64+
with:
65+
python-version: ${{ matrix.python-version }}
6566
- name: Install Mise
6667
uses: jdx/mise-action@v3
6768
- name: Test
6869
run: mise run test
69-
env:
70-
FORCE_COLOR: 1
71-
- name: Upload Coverage
70+
- if: success() || failure()
71+
name: Upload Coverage
7272
uses: codecov/codecov-action@v5
7373
with:
7474
use_oidc: true
@@ -77,3 +77,7 @@ jobs:
7777
uses: codecov/test-results-action@v1
7878
with:
7979
use_oidc: true
80+
strategy:
81+
matrix:
82+
python-version: ${{ fromJson(needs.metadata.outputs.python-versions) }}
83+
fail-fast: false

template/.readthedocs.yaml.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ build:
3838
# %% if package_manager == "pixi":
3939
- pixi install --frozen
4040
# %% elif package_manager == "uv":
41-
- UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --all-extras --all-groups --frozen --link-mode copy
41+
- UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --all-extras --all-groups --frozen --all-packages --link-mode copy
4242
# %% endif
4343

4444
pre_build:

template/pyproject.toml.jinja

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ classifiers = [
2121
"Programming Language :: Python :: 3",
2222
"Programming Language :: Python :: 3.12",
2323
"Programming Language :: Python :: 3.13",
24+
"Programming Language :: Python :: 3.14",
2425
"Typing :: Typed",
2526
]
26-
dependencies = []
27+
dependencies = ["lazy-loader>=0.4,<0.5"]
2728
dynamic = ["version"]
2829

2930
[project.urls]

0 commit comments

Comments
 (0)