Skip to content

Commit 3513562

Browse files
authored
Merge pull request #2310 from EliahKagan/claude/ci-ubuntu-26-old-pythons-and-action-pins
Fx Python 3.8/3.9 jobs on Ubuntu 26.04, pin actions, and add zizmor
2 parents f1fb0bd + a938d65 commit 3513562

12 files changed

Lines changed: 137 additions & 35 deletions

‎.github/dependabot.yml‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
version: 2
2-
enable-beta-ecosystems: true
32
updates:
43
- package-ecosystem: github-actions
54
directory: "/"
65
schedule:
7-
interval: weekly
6+
interval: monthly
7+
cooldown:
8+
default-days: 7
9+
groups:
10+
github-actions:
11+
patterns: ["*"]
812

913
- package-ecosystem: pre-commit
1014
directory: "/"
1115
schedule:
1216
interval: monthly
17+
cooldown:
18+
default-days: 7
1319
groups:
1420
pre-commit:
1521
patterns: ["*"]

‎.github/workflows/alpine-test.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ jobs:
3232
adduser runner docker
3333
shell: sh -exo pipefail {0} # Run this as root, not the "runner" user.
3434

35-
- uses: actions/checkout@v7
35+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
3636
with:
3737
fetch-depth: 0
38+
persist-credentials: false
3839

3940
- name: Set workspace ownership
4041
run: |

‎.github/workflows/backend-benchmark.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ jobs:
1414
runs-on: ubuntu-latest
1515
timeout-minutes: 30
1616
steps:
17-
- uses: actions/checkout@v7
17+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
1818
with:
1919
fetch-depth: 0
2020
persist-credentials: false
21-
- uses: actions/setup-python@v7
21+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
2222
with:
2323
python-version: "3.12"
2424
- name: Ensure Git 2.52 or newer
@@ -75,7 +75,7 @@ jobs:
7575
>> "$GITHUB_STEP_SUMMARY"
7676
- name: Retain raw timings and comparison
7777
if: always()
78-
uses: actions/upload-artifact@v7
78+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
7979
with:
8080
name: backend-benchmark
8181
path: benchmark-results/

‎.github/workflows/codeql.yml‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ on:
1818
schedule:
1919
- cron: '27 10 * * 3'
2020

21+
permissions: {} # Expanded in the `analyze` job.
22+
2123
jobs:
2224
analyze:
2325
name: Analyze (${{ matrix.language }})
@@ -28,7 +30,7 @@ jobs:
2830
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
2931
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
3032
permissions:
31-
security-events: write
33+
security-events: write # Required for uploading SARIF to view in the Security tab.
3234

3335
strategy:
3436
fail-fast: false
@@ -48,7 +50,9 @@ jobs:
4850
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
4951
steps:
5052
- name: Checkout repository
51-
uses: actions/checkout@v7
53+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
54+
with:
55+
persist-credentials: false
5256

5357
# Add any setup steps before running the `github/codeql-action/init` action.
5458
# This includes steps like installing compilers or runtimes (`actions/setup-node`
@@ -58,7 +62,7 @@ jobs:
5862

5963
# Initializes the CodeQL tools for scanning.
6064
- name: Initialize CodeQL
61-
uses: github/codeql-action/init@v4
65+
uses: github/codeql-action/init@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
6266
with:
6367
languages: ${{ matrix.language }}
6468
build-mode: ${{ matrix.build-mode }}
@@ -90,6 +94,6 @@ jobs:
9094
exit 1
9195
9296
- name: Perform CodeQL Analysis
93-
uses: github/codeql-action/analyze@v4
97+
uses: github/codeql-action/analyze@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
9498
with:
9599
category: "/language:${{matrix.language}}"

‎.github/workflows/cygwin-test.yml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ jobs:
2828
git config --global core.autocrlf false # Affects the non-Cygwin git.
2929
shell: pwsh # Do this outside Cygwin, to affect actions/checkout.
3030

31-
- uses: actions/checkout@v7
31+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
3232
with:
3333
fetch-depth: 0
34+
persist-credentials: false
3435

3536
- name: Install Cygwin
36-
uses: cygwin/cygwin-install-action@v6
37+
uses: cygwin/cygwin-install-action@3f0a3f9f988f7e96b8c18098ae05eaec175f5b52 # v6.0.2
3738
with:
3839
packages: >-
3940
curl gcc-core git libcurl-devel libexpat-devel libiconv-devel

‎.github/workflows/dependencies.yml‎

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,49 @@ permissions:
1111

1212
jobs:
1313
test:
14-
runs-on: ubuntu-latest
14+
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
1515
strategy:
1616
fail-fast: false
1717
matrix:
1818
project: [smmap, gitdb]
1919
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.13t"]
20+
include:
21+
# setup-python has no builds of these versions for Ubuntu 26.04.
22+
- python-version: "3.8"
23+
os: ubuntu-24.04
24+
- python-version: "3.9"
25+
os: ubuntu-24.04
26+
27+
env:
28+
PROJECT: ${{ matrix.project }}
2029

2130
steps:
22-
- uses: actions/checkout@v7
31+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2332
with:
2433
fetch-depth: 0
25-
- uses: actions/setup-python@v7
34+
persist-credentials: false
35+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
2636
with:
2737
python-version: ${{ matrix.python-version }}
2838
allow-prereleases: true
2939
- name: Install test dependencies
3040
run: |
3141
python -m pip install --upgrade pip
3242
python -m pip install pytest flake8 ./smmap
33-
if test "${{ matrix.project }}" = gitdb; then python -m pip install ./gitdb; fi
43+
if test "$PROJECT" = gitdb; then python -m pip install ./gitdb; fi
3444
- name: Lint
35-
run: flake8 "${{ matrix.project }}/${{ matrix.project }}" --count --select=E9,F63,F7,F82 --show-source --statistics
45+
run: flake8 "$PROJECT/$PROJECT" --count --select=E9,F63,F7,F82 --show-source --statistics
3646
- name: Test
3747
run: |
38-
if test "${{ matrix.project }}" = gitdb; then
48+
if test "$PROJECT" = gitdb; then
3949
GITDB_TEST_GIT_REPO_BASE="$(git rev-parse --git-common-dir)" pytest -o addopts= -v gitdb/gitdb/test
4050
else
4151
pytest -o addopts= -v smmap/smmap/test
4252
fi
4353
uv-sync:
44-
runs-on: ubuntu-latest
54+
runs-on: ubuntu-slim
4555
steps:
46-
- uses: actions/checkout@v7
56+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
4757
with:
4858
persist-credentials: false
4959

‎.github/workflows/downstream.yml‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
project: [langchain, mlflow, bandit, swebench, datahub]
2020
backend: [gix, cli]
2121
steps:
22-
- uses: actions/checkout@v7
22+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2323
with:
2424
persist-credentials: false
2525
- name: Ensure Git 2.52 or newer
@@ -48,4 +48,7 @@ jobs:
4848
version: '0.12.13'
4949
enable-cache: false
5050
- name: Test latest release against this checkout
51-
run: uv run test/downstream/run.py "${{ matrix.project }}" --backend "${{ matrix.backend }}"
51+
env:
52+
PROJECT: ${{ matrix.project }}
53+
BACKEND: ${{ matrix.backend }}
54+
run: uv run test/downstream/run.py "$PROJECT" --backend "$BACKEND"

‎.github/workflows/git-cli.yml‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@ jobs:
1515
env:
1616
GIT_PYTHON_BACKEND: cli
1717
steps:
18-
- uses: actions/checkout@v7
19-
- uses: actions/checkout@v7
18+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
19+
with:
20+
persist-credentials: false
21+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2022
with:
2123
repository: git/git
2224
ref: v2.52.0
2325
path: .git-source
24-
- uses: actions/setup-python@v7
26+
persist-credentials: false
27+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
2528
with:
2629
python-version: '3.12'
2730
- name: Build minimum supported Git

‎.github/workflows/lint.yml‎

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,39 @@ jobs:
1414
runs-on: ubuntu-slim
1515

1616
steps:
17-
- uses: actions/checkout@v7
17+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
18+
with:
19+
persist-credentials: false
1820

19-
- uses: actions/setup-python@v7
21+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
2022
with:
2123
python-version: "3.x"
2224

23-
- uses: pre-commit/action@v3.0.1
25+
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
26+
27+
# Check that all `actions/checkout` in CI jobs have `persist-credentials: false`.
28+
check-no-persist-credentials:
29+
runs-on: ubuntu-slim
30+
31+
env:
32+
GLOB: .github/workflows/*.@(yaml|yml)
33+
34+
steps:
35+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
36+
with:
37+
persist-credentials: false
38+
sparse-checkout: ".github/workflows"
39+
- name: List workflows to be scanned
40+
run: |
41+
shopt -s extglob
42+
printf '%s\n' $GLOB # Pathname expansion in $GLOB intended.
43+
- name: Scan workflows
44+
run: |
45+
shopt -s extglob
46+
yq '.jobs.*.steps[]
47+
| select(.uses == "actions/checkout@*" and .with.["persist-credentials"]? != false)
48+
| {"file": filename, "line": line, "name": (.name // .uses)}
49+
| .file + ":" + (.line | tostring) + ": " + .name
50+
' -- $GLOB >query-output.txt # Pathname expansion in $GLOB intended.
51+
cat query-output.txt
52+
test -z "$(<query-output.txt)" # Report failure if we found anything.

‎.github/workflows/pythonpackage.yml‎

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,13 @@ jobs:
5959
shell: bash --noprofile --norc -exo pipefail {0}
6060

6161
steps:
62-
- uses: actions/checkout@v7
62+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
6363
with:
6464
fetch-depth: 0
65+
persist-credentials: false
6566

6667
- name: Set up Python ${{ matrix.python-version }}
67-
uses: actions/setup-python@v7
68+
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
6869
with:
6970
python-version: ${{ matrix.python-version }}
7071
allow-prereleases: ${{ matrix.experimental }}
@@ -97,7 +98,7 @@ jobs:
9798
9899
- name: Set up WSL (Windows)
99100
if: matrix.os-type == 'windows'
100-
uses: Vampire/setup-wsl@v7.2.0
101+
uses: Vampire/setup-wsl@4c48163d9f981914dd8caa0fc335fe19cca5bff4 # v7.2.0
101102
with:
102103
wsl-version: 1
103104

@@ -206,7 +207,6 @@ jobs:
206207
continue-on-error: true
207208

208209
- name: Check types with mypy
209-
if: matrix.python-version != '3.8'
210210
run: |
211211
mypy --python-version="${PYTHON_VERSION%t}" # Version only, with no "t" for free-threaded.
212212
env:
@@ -232,7 +232,7 @@ jobs:
232232

233233
- name: Retain test results and backend operation counts
234234
if: always()
235-
uses: actions/upload-artifact@v7
235+
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
236236
with:
237237
name: tests-${{ matrix.os-type }}-${{ matrix.python-version }}-${{ matrix.backend }}
238238
path: test-results/
@@ -251,11 +251,24 @@ jobs:
251251
matrix:
252252
os: [ubuntu-latest, macos-latest, windows-latest]
253253
python: ["3.8", "3.9", "3.10"]
254+
exclude:
255+
# setup-python has no builds of these versions for Ubuntu 26.04.
256+
- os: ubuntu-latest
257+
python: "3.8"
258+
- os: ubuntu-latest
259+
python: "3.9"
260+
include:
261+
- os: ubuntu-24.04
262+
python: "3.8"
263+
- os: ubuntu-24.04
264+
python: "3.9"
254265
env:
255266
GIT_PYTHON_BACKEND: cli
256267
steps:
257-
- uses: actions/checkout@v7
258-
- uses: actions/setup-python@v7
268+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
269+
with:
270+
persist-credentials: false
271+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
259272
with:
260273
python-version: ${{ matrix.python }}
261274
- name: Install the supported runtime

0 commit comments

Comments
 (0)