Skip to content

Commit d29e2f8

Browse files
committed
ci: centralize matrix vars in init job
Define runners and git-versions once in an init job, then reference via fromJSON() in both build-git and test matrices. Avoids duplication and keeps version justification comments in a single place.
1 parent 424a1eb commit d29e2f8

1 file changed

Lines changed: 23 additions & 29 deletions

File tree

.github/workflows/ci.yml

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,30 @@ on:
66
workflow_dispatch:
77
name: CI
88
jobs:
9+
init:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
runners: ${{ steps.matrix.outputs.runners }}
13+
git-versions: ${{ steps.matrix.outputs.git-versions }}
14+
steps:
15+
- name: Define matrix
16+
id: matrix
17+
run: |
18+
echo 'runners=["ubuntu-24.04","ubuntu-22.04","ubuntu-24.04-arm","ubuntu-22.04-arm","macos-15","macos-26","macos-15-intel","macos-26-intel"]' >> "$GITHUB_OUTPUT"
19+
# Git versions to test against:
20+
# 2.34.1 — Ubuntu 22.04 LTS (Jammy), oldest supported LTS, ships 1:2.34.1-1ubuntu1
21+
# 2.39.5 — Debian 12 (Bookworm), ships 1:2.39.5-0+deb12u3, reported failing in #1029
22+
# 2.47.3 — Debian 13 (Trixie) + Alpine 3.21, ships 1:2.47.3-0+deb13u1, also failing in #1029
23+
# 2.53.0 — Latest stable (2026-02-02), first version with cat-file --batch --filter= (added in 2.50.0)
24+
echo 'git-versions=["2.34.1","2.39.5","2.47.3","2.53.0"]' >> "$GITHUB_OUTPUT"
25+
926
build-git:
27+
needs: init
1028
strategy:
1129
fail-fast: false
1230
matrix:
13-
runner:
14-
- ubuntu-24.04
15-
- ubuntu-22.04
16-
- ubuntu-24.04-arm
17-
- ubuntu-22.04-arm
18-
- macos-15
19-
- macos-26
20-
- macos-15-intel
21-
- macos-26-intel
22-
git-version:
23-
- "2.34.1" # Ubuntu 22.04 LTS (Jammy) — oldest supported LTS, ships 1:2.34.1-1ubuntu1
24-
- "2.39.5" # Debian 12 (Bookworm) — ships 1:2.39.5-0+deb12u3, reported failing in #1029
25-
- "2.47.3" # Debian 13 (Trixie) + Alpine 3.21 — ships 1:2.47.3-0+deb13u1, also failing in #1029
26-
- "2.53.0" # Latest stable (2026-02-02) — first version in matrix with cat-file --batch --filter= (added in 2.50.0)
31+
runner: ${{ fromJSON(needs.init.outputs.runners) }}
32+
git-version: ${{ fromJSON(needs.init.outputs.git-versions) }}
2733
runs-on: ${{ matrix.runner }}
2834
name: build-git (${{ matrix.runner }}, git ${{ matrix.git-version }})
2935
steps:
@@ -74,24 +80,12 @@ jobs:
7480
retention-days: 1
7581

7682
test:
77-
needs: build-git
83+
needs: [init, build-git]
7884
strategy:
7985
fail-fast: false
8086
matrix:
81-
runner:
82-
- ubuntu-24.04
83-
- ubuntu-22.04
84-
- ubuntu-24.04-arm
85-
- ubuntu-22.04-arm
86-
- macos-15
87-
- macos-26
88-
- macos-15-intel
89-
- macos-26-intel
90-
git-version:
91-
- "2.34.1" # Ubuntu 22.04 LTS (Jammy) — oldest supported LTS, ships 1:2.34.1-1ubuntu1
92-
- "2.39.5" # Debian 12 (Bookworm) — ships 1:2.39.5-0+deb12u3, reported failing in #1029
93-
- "2.47.3" # Debian 13 (Trixie) + Alpine 3.21 — ships 1:2.47.3-0+deb13u1, also failing in #1029
94-
- "2.53.0" # Latest stable (2026-02-02) — first version in matrix with cat-file --batch --filter= (added in 2.50.0)
87+
runner: ${{ fromJSON(needs.init.outputs.runners) }}
88+
git-version: ${{ fromJSON(needs.init.outputs.git-versions) }}
9589
runs-on: ${{ matrix.runner }}
9690
name: test (${{ matrix.runner }}, git ${{ matrix.git-version }})
9791
steps:

0 commit comments

Comments
 (0)