Skip to content

Commit 1fb2b9f

Browse files
authored
Add artifact attestation for build provenance (#609)
- Add `check-yaml`, `actionlint`, `yamllint`, `zizmor` pre-commit hooks. - And perform fixes guided by them. - Update codecov from 4 to 5. This should maybe be looked at closer. - Remove `conda.recipe` instead of updating it, because it probably isn't used.
1 parent 8aca7ee commit 1fb2b9f

File tree

7 files changed

+48
-45
lines changed

7 files changed

+48
-45
lines changed

.github/workflows/pre-commit.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
push:
77
branches: [master]
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
pre-commit:
1114
name: pre-commit-hooks
@@ -18,4 +21,4 @@ jobs:
1821
- uses: actions/setup-python@v6
1922
with:
2023
python-version: "3.13"
21-
- uses: pre-commit/[email protected]
24+
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1

.github/workflows/publish_pypi.yml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish to PyPI
1+
name: Builid Wheel and Release
22

33
on:
44
pull_request:
@@ -17,24 +17,23 @@ on:
1717
tags:
1818
- '[0-9]+.[0-9]+.[0-9]+*'
1919

20-
permissions: {}
20+
permissions:
21+
contents: read
2122

2223
jobs:
2324
build-artifacts:
2425
runs-on: ubuntu-latest
25-
permissions:
26-
contents: read
2726
defaults:
2827
run:
2928
shell: bash -l {0}
3029
steps:
3130
- name: Checkout
32-
uses: actions/checkout@v5
31+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
3332
with:
3433
fetch-depth: 0
3534
persist-credentials: false
3635
- name: Set up Python
37-
uses: actions/setup-python@v6
36+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
3837
with:
3938
python-version: "3.9"
4039
- name: Install build dependencies
@@ -43,7 +42,7 @@ jobs:
4342
python -m pip install build twine
4443
- name: Build wheel and sdist
4544
run: python -m build
46-
- uses: actions/upload-artifact@v4
45+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
4746
with:
4847
name: releases
4948
path: dist
@@ -60,16 +59,15 @@ jobs:
6059
name: test-pypi
6160
url: https://test.pypi.org/p/toolz
6261
permissions:
63-
contents: read
6462
id-token: write
6563

6664
steps:
67-
- uses: actions/download-artifact@v5
65+
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
6866
with:
6967
name: releases
7068
path: dist
7169
- name: Publish to Test-PyPI
72-
uses: pypa/[email protected]
70+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
7371
with:
7472
repository-url: https://test.pypi.org/legacy/
7573
print-hash: true
@@ -84,16 +82,23 @@ jobs:
8482
name: pypi
8583
url: https://pypi.org/p/toolz
8684
permissions:
87-
contents: read
8885
id-token: write
86+
attestations: write
8987

9088
steps:
91-
- uses: actions/download-artifact@v5
89+
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
9290
with:
9391
name: releases
9492
path: dist
93+
94+
- name: Generate artifact attestation for sdist and wheel
95+
uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3.0.0
96+
with:
97+
subject-path: "dist/toolz-*"
98+
9599
- name: Publish to PyPI
96-
uses: pypa/[email protected]
100+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
97101
with:
102+
attestations: true
98103
print-hash: true
99104
verbose: true

.github/workflows/test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
branches: [master]
66
pull_request:
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
test:
1013
runs-on: ${{ matrix.os }}
@@ -50,6 +53,6 @@ jobs:
5053
coverage xml
5154
- name: codecov
5255
if: (! contains(matrix.python-version, 'pypy'))
53-
uses: codecov/codecov-action@v4
56+
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
5457
with:
5558
token: ${{ secrets.CODECOV_TOKEN }}

.pre-commit-config.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
ci:
2+
autofix_prs: false
3+
skip: [no-commit-to-branch]
14
fail_fast: false
25
default_language_version:
36
python: python3
@@ -13,6 +16,7 @@ repos:
1316
# Checks based on file type
1417
- id: check-ast
1518
- id: check-toml
19+
- id: check-yaml
1620
# Detect mistakes
1721
- id: check-vcs-permalinks
1822
- id: debug-statements
@@ -44,6 +48,19 @@ repos:
4448
additional_dependencies:
4549
- tomli; python_version<'3.11'
4650
files: ^(toolz|tlz|docs)/
51+
- repo: https://github.com/rhysd/actionlint
52+
rev: v1.7.8
53+
hooks:
54+
- id: actionlint
55+
- repo: https://github.com/adrienverge/yamllint
56+
rev: v1.37.1
57+
hooks:
58+
- id: yamllint
59+
args: [-d, "{extends: default, rules: {line-length: disable}}"]
60+
- repo: https://github.com/woodruffw/zizmor-pre-commit
61+
rev: v1.15.2
62+
hooks:
63+
- id: zizmor
4764
- repo: https://github.com/pre-commit/pygrep-hooks
4865
rev: v1.10.0
4966
hooks:
@@ -64,3 +81,8 @@ repos:
6481
hooks:
6582
- id: check-hooks-apply
6683
- id: check-useless-excludes
84+
- repo: https://github.com/pre-commit/pre-commit-hooks
85+
rev: v6.0.0
86+
hooks:
87+
- id: no-commit-to-branch
88+
args: [--branch, master]

conda.recipe/bld.bat

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

conda.recipe/build.sh

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

conda.recipe/meta.yaml

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

0 commit comments

Comments
 (0)