Skip to content

Commit e5189c4

Browse files
authored
Merge pull request #121 from mxmehl/ci-hardening
2 parents 27067e6 + 6f0f212 commit e5189c4

5 files changed

Lines changed: 28 additions & 4 deletions

File tree

.github/actions/uvbuild/action.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,8 @@ runs:
2828
enable-cache: true
2929
- name: Setup project
3030
run: |
31-
uv sync --locked --all-extras --dev ${{ inputs.uv_args }}
31+
uv_args="${UV_ARGS}"
32+
uv sync --locked --all-extras --dev $uv_args
33+
env:
34+
UV_ARGS: ${{ inputs.uv_args }}
3235
shell: bash

.github/workflows/release-vulnerabilities.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
schedule:
99
- cron: "35 9 * * 1" # run a check once a week
1010

11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
osv-check:
1316
runs-on: ubuntu-latest

.github/workflows/release.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ jobs:
1717
contents: read
1818
steps:
1919
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
20+
with:
21+
persist-credentials: false
2022
- name: Set up Python
2123
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
2224
- name: Install uv
2325
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
2426
with:
25-
enable-cache: true
27+
enable-cache: false # avoid cache-poisoning attacks
2628
- name: Build package
2729
run: uv build
2830
- name: Publish package to PyPI
29-
run: uv publish
31+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0

.github/workflows/test.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
- main
1111
pull_request:
1212

13+
permissions:
14+
contents: read
15+
1316
jobs:
1417
# Test using the tool via uv on different OSes and python versions
1518
test-os-python-matrix:
@@ -29,6 +32,8 @@ jobs:
2932

3033
steps:
3134
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
35+
with:
36+
persist-credentials: false
3237
- uses: ./.github/actions/uvbuild
3338
with:
3439
python: ${{ matrix.python-version }}
@@ -42,6 +47,8 @@ jobs:
4247
runs-on: ubuntu-24.04
4348
steps:
4449
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
50+
with:
51+
persist-credentials: false
4552
- name: Set up Python
4653
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
4754
with:
@@ -64,6 +71,8 @@ jobs:
6471
runs-on: ubuntu-24.04
6572
steps:
6673
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
74+
with:
75+
persist-credentials: false
6776
- uses: ./.github/actions/uvbuild
6877
with:
6978
uv_args: --no-dev
@@ -91,13 +100,17 @@ jobs:
91100
runs-on: ubuntu-24.04
92101
steps:
93102
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
103+
with:
104+
persist-credentials: false
94105
- uses: ./.github/actions/uvbuild
95106
- name: Lint with ruff
96107
run: uv run ruff check
97108
ty:
98109
runs-on: ubuntu-24.04
99110
steps:
100111
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
112+
with:
113+
persist-credentials: false
101114
- uses: ./.github/actions/uvbuild
102115
- name: Test typing with ty
103116
run: uv run ty check
@@ -107,5 +120,7 @@ jobs:
107120
runs-on: ubuntu-latest
108121
steps:
109122
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
123+
with:
124+
persist-credentials: false
110125
- name: Check REUSE Compliance
111126
uses: fsfe/reuse-action@676e2d560c9a403aa252096d99fcab3e1132b0f5 # v6.0.0

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ classifiers = [
2525
"Topic :: System :: Systems Administration",
2626
"Intended Audience :: Developers",
2727
"Intended Audience :: System Administrators",
28-
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
2928
"Programming Language :: Python :: 3",
3029
"Programming Language :: Python :: 3.10",
3130
"Programming Language :: Python :: 3.11",
@@ -85,6 +84,8 @@ ignore = [
8584
"D212",
8685
"PTH123",
8786
]
87+
[tool.ruff.lint.extend-per-file-ignores]
88+
"tests/*" = ["S101", "PLR", "PT011", "ANN001"]
8889
[tool.ruff.lint.pydocstyle]
8990
convention = "google"
9091

0 commit comments

Comments
 (0)