Skip to content

Commit edf6217

Browse files
committed
CI: add zizmor
1 parent a068126 commit edf6217

8 files changed

Lines changed: 147 additions & 66 deletions

File tree

.github/workflows/cd.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ name: CD
33
permissions:
44
contents: read
55

6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
8+
cancel-in-progress: true
9+
610
on:
711
workflow_dispatch:
812
pull_request:
@@ -15,20 +19,23 @@ on:
1519

1620
jobs:
1721
dist:
22+
name: Create dist
1823
runs-on: ubuntu-latest
1924
steps:
2025
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2126
with:
2227
fetch-depth: 0
28+
persist-credentials: false
2329

2430
- uses: hynek/build-and-inspect-python-package@fe0a0fb1925ca263d076ca4f2c13e93a6e92a33e # v2.17.0
2531

2632
publish:
33+
name: Publish
2734
needs: [dist]
2835
environment: pypi
2936
permissions:
30-
id-token: write
31-
attestations: write
37+
id-token: write # for trusted publishing
38+
attestations: write # for trusted publishing
3239
contents: read
3340
runs-on: ubuntu-latest
3441
if: github.event_name == 'release' && github.event.action == 'published'

.github/workflows/ci.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2828
with:
2929
fetch-depth: 0
30+
persist-credentials: false
3031

3132
- uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
3233
with:
@@ -52,10 +53,13 @@ jobs:
5253
- tests-nogil
5354
runs-on: [ubuntu-latest]
5455

56+
environment: ci-checks
57+
5558
steps:
5659
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5760
with:
5861
fetch-depth: 0
62+
persist-credentials: false
5963

6064
- uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
6165
with:
@@ -66,7 +70,9 @@ jobs:
6670
- name: Test package
6771
# Save some time; also at the moment of writing coverage crashes on python 3.13t
6872
if: ${{ matrix.environment != 'tests-nogil' }}
69-
run: pixi run -e ${{ matrix.environment }} tests-ci
73+
run: pixi run -e "${TASK_ENV}" tests-ci
74+
env:
75+
TASK_ENV: ${{ matrix.environment }}
7076

7177
- name: Test free-threading
7278
if: ${{ matrix.environment == 'tests-nogil' }}

.github/workflows/docs-build.yml

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

.github/workflows/docs-deploy.yml

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

.github/workflows/docs.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Docs
2+
3+
on: [push, pull_request]
4+
5+
permissions: {}
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
docs-build:
13+
name: Build
14+
runs-on: ubuntu-latest
15+
16+
permissions:
17+
contents: read
18+
19+
steps:
20+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
21+
with:
22+
persist-credentials: false
23+
24+
- uses: prefix-dev/setup-pixi@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
25+
with:
26+
pixi-version: v0.62.0
27+
cache: true
28+
environments: docs
29+
30+
- name: Build Docs
31+
run: pixi run -e docs docs
32+
33+
- name: Upload Artifact
34+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
35+
with:
36+
name: docs-build
37+
path: docs/build/
38+
39+
docs-deploy:
40+
name: Deploy
41+
if: ${{ github.event.workflow_run.event == 'push' }}
42+
needs: docs-build
43+
runs-on: ubuntu-latest
44+
45+
permissions:
46+
contents: write # needed for the deploy step
47+
48+
environment:
49+
name: docs-deploy
50+
51+
steps:
52+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
53+
with:
54+
persist-credentials: false
55+
56+
- name: Download Artifact
57+
uses: actions/download-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
58+
with:
59+
name: docs-build
60+
path: docs/build/
61+
62+
- name: Deploy
63+
uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0
64+
with:
65+
folder: docs/build/
66+
ssh-key: ${{ secrets.DEPLOY_KEY }}

lefthook.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ pre-commit:
4747
run: pixi {run} typos
4848
- name: actionlint
4949
run: pixi {run} actionlint
50+
- name: zizmor
51+
run: pixi {run} zizmor
5052
- name: blacken-docs
5153
glob: "*.md"
5254
stage_fixed: true

pixi.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ blacken-docs = ">=1.20.0,<2"
109109
pytest = ">=9.0.2,<10"
110110
validate-pyproject = ">=0.25,<0.26"
111111
pyrefly = ">=0.61.1,<0.62"
112+
zizmor = ">=1.24.1,<1.25"
112113
# NOTE: don't add cupy, jax, pytorch, or sparse here,
113114
# as they slow down mypy and are not portable across target OSs
114115

@@ -125,6 +126,7 @@ ruff-format = { cmd = "ruff format", description = "Format with ruff" }
125126
dprint = { cmd = "dprint fmt", description = "Format with dprint" }
126127
typos = { cmd = "typos --write-changes --force-exclude", description = "Fix typos" }
127128
actionlint = { cmd = "actionlint", description = "Lint actions with actionlint" }
129+
zizmor = { cmd = "zizmor .github -p", description = "GHA static analysis with zizmor" }
128130
blacken-docs = { cmd = "blacken-docs", description = "Format Python markdown blocks with Black" }
129131
validate-pyproject = { cmd = "validate-pyproject pyproject.toml", description = "Validate pyproject.toml" }
130132
numpydoc = { cmd = "numpydoc lint", description = "Validate docstrings with numpydoc" }

0 commit comments

Comments
 (0)