Skip to content

Commit b3faedf

Browse files
committed
Remove matrix logic and flatten GHA workflow jobs
Signed-off-by: lelia <lelia@socket.dev>
1 parent 38cb0e0 commit b3faedf

3 files changed

Lines changed: 33 additions & 91 deletions

File tree

.github/workflows/publish-docker.yml

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: publish-docker
22

3-
# Orchestrator: generates the image matrix via ci_matrix.py, then calls
4-
# _docker-pipeline.yml for each image (build → test → push → floating tag).
3+
# Builds, tests, and publishes the socket-basics image to GHCR and Docker Hub.
4+
#
5+
# Flow: resolve-version → build-test-push → create-release
56
#
67
# Tag convention:
78
# v2.0.0 — immutable exact release
@@ -32,25 +33,17 @@ concurrency:
3233

3334
jobs:
3435

35-
# ── Job 1: Generate matrix ─────────────────────────────────────────────────
36-
# Runs ci_matrix.py to discover images and resolve the release version.
37-
# Downstream jobs consume these outputs — no image config is hardcoded in YAML.
38-
generate-matrix:
36+
# ── Job 1: Resolve version ─────────────────────────────────────────────────
37+
# Computes a clean semver string (no v prefix) consumed by downstream jobs.
38+
resolve-version:
3939
runs-on: ubuntu-latest
4040
outputs:
41-
matrix: ${{ steps.matrix.outputs.json }}
4241
version: ${{ steps.version.outputs.clean }}
4342
steps:
4443
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4544
with:
4645
ref: ${{ github.event_name == 'workflow_dispatch' && format('v{0}', inputs.tag) || github.ref }}
4746

48-
- name: 🐍 Generate image matrix
49-
id: matrix
50-
run: |
51-
JSON=$(python scripts/ci_matrix.py --target docker)
52-
echo "json=$JSON" >> "$GITHUB_OUTPUT"
53-
5447
- name: 🏷️ Resolve version
5548
id: version
5649
run: |
@@ -62,42 +55,38 @@ jobs:
6255
fi
6356
echo "clean=$CLEAN" >> "$GITHUB_OUTPUT"
6457
65-
# ── Job 2: Build → test → push (one run per image in the matrix) ───────────
58+
# ── Job 2: Build → test → push ─────────────────────────────────────────────
6659
# Delegates all Docker steps to the reusable _docker-pipeline workflow.
67-
# Adding a new image to ci_matrix.py automatically creates a new parallel run.
6860
build-test-push:
69-
name: publish (${{ matrix.image.name }})
70-
needs: generate-matrix
61+
name: publish (socket-basics)
62+
needs: resolve-version
7163
permissions:
7264
contents: write # force-update the floating major version tag (e.g. v2)
7365
packages: write # push images to GHCR
74-
strategy:
75-
fail-fast: false
76-
matrix:
77-
image: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
7866
uses: ./.github/workflows/_docker-pipeline.yml
7967
with:
80-
name: ${{ matrix.image.name }}
81-
dockerfile: ${{ matrix.image.dockerfile }}
82-
context: ${{ matrix.image.context }}
83-
check_set: ${{ matrix.image.check_set }}
68+
name: socket-basics
69+
dockerfile: Dockerfile
70+
context: .
71+
check_set: main
8472
push: true
85-
version: ${{ needs.generate-matrix.outputs.version }}
73+
tag_push: ${{ github.ref_type == 'tag' }}
74+
version: ${{ needs.resolve-version.outputs.version }}
8675
secrets: inherit
8776

8877
# ── Job 3: Create GitHub release + update CHANGELOG ────────────────────────
89-
# Runs once after all images are successfully pushed (not for workflow_dispatch
78+
# Runs once after the image is successfully pushed (not for workflow_dispatch
9079
# re-publishes — those don't create new releases).
9180
# Generates categorised release notes from merged PR labels (.github/release.yml),
9281
# creates the GitHub Release, then commits the CHANGELOG update back to main.
9382
create-release:
94-
needs: [generate-matrix, build-test-push]
83+
needs: [resolve-version, build-test-push]
9584
if: github.ref_type == 'tag'
9685
permissions:
9786
contents: write # create GitHub release + commit CHANGELOG back to main
9887
runs-on: ubuntu-latest
9988
env:
100-
VERSION: ${{ needs.generate-matrix.outputs.version }}
89+
VERSION: ${{ needs.resolve-version.outputs.version }}
10190
steps:
10291
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
10392
with:

.github/workflows/python-tests.yml

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
name: python-tests
22

3-
# Orchestrator: generates the Python version matrix via ci_matrix.py, then
4-
# runs pytest for each version in parallel.
5-
#
6-
# To expand test coverage to Python 3.10 / 3.11, edit _PYTHON_TEST_VERSIONS
7-
# in scripts/ci_matrix.py — no changes needed here.
8-
93
on:
104
push:
115
branches: [main]
@@ -14,15 +8,13 @@ on:
148
- "tests/**/*.py"
159
- "pyproject.toml"
1610
- "uv.lock"
17-
- "scripts/ci_matrix.py"
1811
- ".github/workflows/python-tests.yml"
1912
pull_request:
2013
paths:
2114
- "socket_basics/**/*.py"
2215
- "tests/**/*.py"
2316
- "pyproject.toml"
2417
- "uv.lock"
25-
- "scripts/ci_matrix.py"
2618
- ".github/workflows/python-tests.yml"
2719
workflow_dispatch:
2820

@@ -34,45 +26,28 @@ concurrency:
3426
cancel-in-progress: true
3527

3628
jobs:
37-
38-
# ── Job 1: Generate matrix ─────────────────────────────────────────────────
39-
generate-matrix:
40-
runs-on: ubuntu-latest
41-
outputs:
42-
matrix: ${{ steps.matrix.outputs.json }}
43-
steps:
44-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
45-
with:
46-
fetch-depth: 1
47-
persist-credentials: false
48-
- name: 🐍 Generate Python version matrix
49-
id: matrix
50-
run: |
51-
JSON=$(python scripts/ci_matrix.py --target python)
52-
echo "json=$JSON" >> "$GITHUB_OUTPUT"
53-
54-
# ── Job 2: Test (one run per Python version in the matrix) ─────────────────
5529
test:
56-
needs: generate-matrix
5730
runs-on: ubuntu-latest
5831
timeout-minutes: 20
59-
strategy:
60-
fail-fast: false
61-
matrix:
62-
config: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
6332
steps:
6433
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
6534
with:
6635
fetch-depth: 1
6736
persist-credentials: false
68-
- name: 🐍 Setup Python ${{ matrix.config.python-version }}
37+
- name: 🐍 Setup Python
6938
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
7039
with:
71-
python-version: ${{ matrix.config.python-version }}
40+
python-version: "3.12"
7241
cache: "pip"
7342
- name: 🛠️ Install deps
7443
run: |
7544
python -m pip install --upgrade pip
7645
pip install -e ".[dev]"
46+
- name: 🔒 Assert version files in sync
47+
run: |
48+
V_PY=$(python -c "from socket_basics.version import __version__; print(__version__)")
49+
V_TOML=$(python -c "import tomllib; print(tomllib.loads(open('pyproject.toml').read())['project']['version'])")
50+
[ "$V_PY" = "$V_TOML" ] || (echo "Version mismatch: version.py=$V_PY pyproject.toml=$V_TOML" && exit 1)
51+
echo "Version in sync: $V_PY"
7752
- name: 🧪 Run tests
7853
run: pytest -q tests/

.github/workflows/smoke-test.yml

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
name: smoke-test
22

3-
# Orchestrator: generates the image matrix via ci_matrix.py, then calls
4-
# _docker-pipeline.yml for each image in smoke-only mode (no push).
3+
# Builds the main socket-basics image and verifies all baked-in tools respond.
4+
# Calls _docker-pipeline.yml in smoke-only mode (no push to registries).
55

66
on:
77
push:
88
branches: [main]
99
paths:
1010
- 'Dockerfile'
1111
- 'scripts/smoke-test-docker.sh'
12-
- 'scripts/ci_matrix.py'
1312
- '.github/workflows/smoke-test.yml'
1413
- '.github/workflows/_docker-pipeline.yml'
1514
pull_request:
1615
paths:
1716
- 'Dockerfile'
1817
- 'scripts/smoke-test-docker.sh'
19-
- 'scripts/ci_matrix.py'
2018
- '.github/workflows/smoke-test.yml'
2119
- '.github/workflows/_docker-pipeline.yml'
2220
schedule:
@@ -31,33 +29,13 @@ concurrency:
3129
cancel-in-progress: true
3230

3331
jobs:
34-
35-
# ── Job 1: Generate matrix ─────────────────────────────────────────────────
36-
generate-matrix:
37-
runs-on: ubuntu-latest
38-
outputs:
39-
matrix: ${{ steps.matrix.outputs.json }}
40-
steps:
41-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
42-
- name: 🐍 Generate image matrix
43-
id: matrix
44-
run: |
45-
JSON=$(python scripts/ci_matrix.py --target docker)
46-
echo "json=$JSON" >> "$GITHUB_OUTPUT"
47-
48-
# ── Job 2: Smoke (one run per image in the matrix) ─────────────────────────
4932
smoke:
50-
name: smoke (${{ matrix.image.name }})
51-
needs: generate-matrix
52-
strategy:
53-
fail-fast: false
54-
matrix:
55-
image: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
33+
name: smoke (socket-basics)
5634
uses: ./.github/workflows/_docker-pipeline.yml
5735
with:
58-
name: ${{ matrix.image.name }}
59-
dockerfile: ${{ matrix.image.dockerfile }}
60-
context: ${{ matrix.image.context }}
61-
check_set: ${{ matrix.image.check_set }}
36+
name: socket-basics
37+
dockerfile: Dockerfile
38+
context: .
39+
check_set: main
6240
push: false
6341
secrets: inherit

0 commit comments

Comments
 (0)