Skip to content

Commit 38978db

Browse files
committed
Clean up workflows
Add Zizmor and apply easy fixes Clean up one-line jobs Update pre-commit
1 parent 76c3786 commit 38978db

File tree

5 files changed

+47
-22
lines changed

5 files changed

+47
-22
lines changed

.github/workflows/python-package.yml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ jobs:
2626
timeout-minutes: 5
2727
steps:
2828
- uses: actions/checkout@v6
29+
with:
30+
persist-credentials: false
2931
- name: Install Ruff
3032
run: pip install ruff
3133
- name: Ruff Check
@@ -38,6 +40,8 @@ jobs:
3840
timeout-minutes: 5
3941
steps:
4042
- uses: actions/checkout@v6
43+
with:
44+
persist-credentials: false
4145
- name: Checkout submodules
4246
run: git submodule update --init --recursive --depth 1
4347
- name: Install typing dependencies
@@ -59,6 +63,7 @@ jobs:
5963
version: ${{ env.sdl-version }}
6064
- uses: actions/checkout@v6
6165
with:
66+
persist-credentials: false
6267
fetch-depth: ${{ env.git-depth }}
6368
- name: Checkout submodules
6469
run: git submodule update --init --recursive --depth 1
@@ -86,6 +91,7 @@ jobs:
8691
steps:
8792
- uses: actions/checkout@v6
8893
with:
94+
persist-credentials: false
8995
fetch-depth: ${{ env.git-depth }}
9096
- name: Checkout submodules
9197
run: git submodule update --init --recursive --depth 1
@@ -117,10 +123,10 @@ jobs:
117123
steps:
118124
- uses: actions/checkout@v6
119125
with:
126+
persist-credentials: false
120127
fetch-depth: ${{ env.git-depth }}
121128
- name: Checkout submodules
122-
run: |
123-
git submodule update --init --recursive --depth 1
129+
run: git submodule update --init --recursive --depth 1
124130
- name: Set up Python ${{ matrix.python-version }}
125131
uses: actions/setup-python@v6
126132
with:
@@ -143,19 +149,15 @@ jobs:
143149
pip install pytest pytest-cov pytest-benchmark pytest-timeout build
144150
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
145151
- name: Initialize package
146-
run: |
147-
pip install -e . # Install the package in-place.
152+
run: pip install -e . # Install the package in-place.
148153
- name: Build package
149-
run: |
150-
python -m build
154+
run: python -m build
151155
- name: Test with pytest
152156
if: runner.os == 'Windows'
153-
run: |
154-
pytest --cov-report=xml --timeout=300
157+
run: pytest --cov-report=xml --timeout=300
155158
- name: Test with pytest (Xvfb)
156159
if: always() && runner.os != 'Windows'
157-
run: |
158-
xvfb-run -e /tmp/xvfb.log --server-num=$RANDOM --auto-servernum pytest --cov-report=xml --timeout=300
160+
run: xvfb-run -e /tmp/xvfb.log --server-num=$RANDOM --auto-servernum pytest --cov-report=xml --timeout=300
159161
- name: Xvfb logs
160162
if: runner.os != 'Windows'
161163
run: cat /tmp/xvfb.log
@@ -181,6 +183,7 @@ jobs:
181183
version: ${{ env.sdl-version }}
182184
- uses: actions/checkout@v6
183185
with:
186+
persist-credentials: false
184187
fetch-depth: ${{ env.git-depth }}
185188
- name: Checkout submodules
186189
run: git submodule update --init --recursive --depth 1
@@ -206,6 +209,7 @@ jobs:
206209
steps:
207210
- uses: actions/checkout@v6
208211
with:
212+
persist-credentials: false
209213
fetch-depth: ${{ env.git-depth }}
210214
- name: Checkout submodules
211215
run: git submodule update --init --depth 1
@@ -239,6 +243,7 @@ jobs:
239243
steps:
240244
- uses: actions/checkout@v6
241245
with:
246+
persist-credentials: false
242247
fetch-depth: ${{ env.git-depth }}
243248
- name: Checkout submodules
244249
run: git submodule update --init --recursive --depth 1
@@ -270,8 +275,9 @@ jobs:
270275
# Skip test on emulated architectures
271276
CIBW_TEST_SKIP: "*_aarch64"
272277
- name: Remove asterisk from label
278+
env:
279+
BUILD_DESC: ${{ matrix.build }}
273280
run: |
274-
BUILD_DESC=${{ matrix.build }}
275281
BUILD_DESC=${BUILD_DESC//\*}
276282
echo BUILD_DESC=${BUILD_DESC} >> $GITHUB_ENV
277283
- name: Archive wheel
@@ -295,6 +301,7 @@ jobs:
295301
steps:
296302
- uses: actions/checkout@v6
297303
with:
304+
persist-credentials: false
298305
fetch-depth: ${{ env.git-depth }}
299306
- name: Checkout submodules
300307
run: git submodule update --init --recursive --depth 1
@@ -317,8 +324,9 @@ jobs:
317324
CIBW_TEST_SKIP: "pp* *-macosx_arm64 *-macosx_universal2:arm64"
318325
MACOSX_DEPLOYMENT_TARGET: "10.13"
319326
- name: Remove asterisk from label
327+
env:
328+
PYTHON_DESC: ${{ matrix.python }}
320329
run: |
321-
PYTHON_DESC=${{ matrix.python }}
322330
PYTHON_DESC=${PYTHON_DESC//\*/X}
323331
echo PYTHON_DESC=${PYTHON_DESC} >> $GITHUB_ENV
324332
- name: Archive wheel
@@ -336,6 +344,7 @@ jobs:
336344
steps:
337345
- uses: actions/checkout@v6
338346
with:
347+
persist-credentials: false
339348
fetch-depth: ${{ env.git-depth }}
340349
- name: Checkout submodules
341350
run: git submodule update --init --recursive --depth 1
@@ -365,7 +374,7 @@ jobs:
365374
name: pypi
366375
url: https://pypi.org/project/tcod/${{ github.ref_name }}
367376
permissions:
368-
id-token: write
377+
id-token: write # Attestation
369378
steps:
370379
- uses: actions/download-artifact@v7
371380
with:

.github/workflows/release-on-tag.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,23 @@ on:
55

66
name: Create Release
77

8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: false
11+
812
jobs:
913
build:
1014
name: Create Release
1115
runs-on: ubuntu-latest
1216
timeout-minutes: 5
1317
permissions:
14-
contents: write
18+
contents: write # Publish GitHub Releases
1519
steps:
16-
- name: Checkout code
17-
uses: actions/checkout@v6
20+
- uses: actions/checkout@v6
21+
with:
22+
persist-credentials: false
1823
- name: Generate body
19-
run: |
20-
scripts/get_release_description.py | tee release_body.md
24+
run: scripts/get_release_description.py | tee release_body.md
2125
- name: Create Release
2226
id: create_release
2327
uses: ncipollo/release-action@v1

.github/zizmor.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
rules:
2+
anonymous-definition:
3+
disable: true
4+
excessive-permissions:
5+
disable: true
6+
unpinned-uses:
7+
disable: true

.pre-commit-config.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@ repos:
1717
- id: fix-byte-order-marker
1818
- id: detect-private-key
1919
- repo: https://github.com/astral-sh/ruff-pre-commit
20-
rev: v0.14.10
20+
rev: v0.14.13
2121
hooks:
2222
- id: ruff-check
2323
args: [--fix-only, --exit-non-zero-on-fix]
2424
- id: ruff-format
25+
- repo: https://github.com/zizmorcore/zizmor-pre-commit
26+
rev: v1.22.0
27+
hooks:
28+
- id: zizmor

.vscode/settings.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"files.insertFinalNewline": true,
1414
"files.trimTrailingWhitespace": true,
1515
"files.associations": {
16-
"*.spec": "python",
16+
"*.spec": "python"
1717
},
1818
"mypy-type-checker.importStrategy": "fromEnvironment",
1919
"cSpell.words": [
@@ -548,12 +548,13 @@
548548
"xrel",
549549
"xvfb",
550550
"ydst",
551-
"yrel"
551+
"yrel",
552+
"zizmor"
552553
],
553554
"python.testing.pytestArgs": [],
554555
"python.testing.unittestEnabled": false,
555556
"python.testing.pytestEnabled": true,
556557
"[python]": {
557558
"editor.defaultFormatter": "charliermarsh.ruff"
558-
},
559+
}
559560
}

0 commit comments

Comments
 (0)