Skip to content

Commit 0247ddc

Browse files
committed
ci: group test checks into state-machine and sink trees
Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
1 parent e01f312 commit 0247ddc

3 files changed

Lines changed: 173 additions & 119 deletions

File tree

.github/workflows/ci.yml

Lines changed: 16 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,26 @@ jobs:
132132
working-directory: sink/slog
133133
run: go run "$GOLANGCI_LINT" run --config "$GITHUB_WORKSPACE/.golangci.yml" ./...
134134

135-
# The race-test matrix lives in a reusable workflow so its legs render as a
136-
# single collapsible tree in the checks UI ("tests / test (1.25.11, …)") rather
137-
# than as flat top-level checks. Keep the module list in sync with the lint,
138-
# vuln, and coverage jobs below.
135+
# The state-machine race-test matrix lives in a reusable workflow so its legs
136+
# render as a single collapsible "state machine tests / …" tree in the checks
137+
# UI rather than as flat top-level checks. The sink-domain legs live in their
138+
# own "sink" tree (see the `sink` job below). Keep this module list in sync
139+
# with the lint, vuln, and coverage jobs below.
139140
tests:
141+
name: state machine tests
140142
needs: changes
141143
if: needs.changes.outputs.code == 'true'
142144
uses: ./.github/workflows/test.yml
143145
with:
144-
modules: "state state/expr durable cluster transport wasm e2e examples/fooddelivery examples/dispatch telemetry telemetry/slog telemetry/otel telemetry/datadog sink sink/bridge sink/file sink/http sink/prometheus sink/slog"
146+
modules: "state state/expr durable cluster transport wasm e2e examples/fooddelivery examples/dispatch telemetry telemetry/slog telemetry/otel telemetry/datadog"
147+
148+
# Every sink-domain check (in-workspace race tests, the SDK-backed destination
149+
# matrix, and the integration leg) groups under a single collapsible "sink / …"
150+
# tree via this reusable workflow.
151+
sink:
152+
needs: changes
153+
if: needs.changes.outputs.code == 'true'
154+
uses: ./.github/workflows/sink.yml
145155

146156
vuln:
147157
needs: changes
@@ -532,115 +542,6 @@ jobs:
532542
- name: Build site
533543
run: npm run build
534544

535-
# The SDK-backed sink destinations are standalone modules kept out of the
536-
# workspace (see go.work / the magefile), so they build with GOWORK=off via
537-
# their own replace directives. Each is one matrix leg across the OS matrix for
538-
# race tests; lint, vuln, and the coverage gate run on Linux. This keeps the
539-
# vendor SDKs out of the core modules' dependency graphs.
540-
sink-destinations:
541-
needs: changes
542-
if: needs.changes.outputs.code == 'true'
543-
strategy:
544-
fail-fast: false
545-
matrix:
546-
os: [ubuntu-latest, macos-latest, windows-latest]
547-
module:
548-
- sink/cloudwatch
549-
- sink/dynamo
550-
- sink/eventbridge
551-
- sink/firehose
552-
- sink/gcppubsub
553-
- sink/kafka
554-
- sink/kinesis
555-
- sink/nats
556-
- sink/otel
557-
- sink/redis
558-
- sink/s3
559-
- sink/sns
560-
- sink/sql
561-
- sink/sqs
562-
- sink/statsd
563-
- sink/timestream
564-
- examples/sinkflow
565-
runs-on: ${{ matrix.os }}
566-
env:
567-
GOWORK: "off"
568-
THRESHOLD: "80"
569-
steps:
570-
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
571-
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
572-
with:
573-
go-version: "1.26.4"
574-
cache-dependency-path: "**/go.sum"
575-
- name: test -race
576-
shell: bash
577-
run: go test -C "${{ matrix.module }}" -race ./...
578-
- name: golangci-lint
579-
if: matrix.os == 'ubuntu-latest'
580-
shell: bash
581-
run: go -C "${{ matrix.module }}" run "$GOLANGCI_LINT" run --config "$GITHUB_WORKSPACE/.golangci.yml" ./...
582-
- name: govulncheck
583-
if: matrix.os == 'ubuntu-latest'
584-
shell: bash
585-
run: go -C "${{ matrix.module }}" run "$GOVULNCHECK" ./...
586-
- name: coverage gate
587-
if: matrix.os == 'ubuntu-latest'
588-
shell: bash
589-
run: |
590-
go test -C "${{ matrix.module }}" -covermode=atomic -coverprofile=coverage.out ./...
591-
pct=$(go -C "${{ matrix.module }}" tool cover -func=coverage.out | awk '/^total:/ {sub(/%/,"",$3); print $3}')
592-
echo "total coverage: ${pct}% (threshold ${THRESHOLD}%)"
593-
awk -v p="$pct" -v t="$THRESHOLD" 'BEGIN { exit (p+0 < t+0) ? 1 : 0 }' \
594-
|| { echo "::error::coverage ${pct}% is below the ${THRESHOLD}% threshold"; exit 1; }
595-
596-
# Integration / E2E leg, behind the `integration` build tag, run with
597-
# GOWORK=off. The hermetic destinations (sql, http, file, slog, prometheus,
598-
# statsd, otel) and the flagship sinkflow example run end-to-end; the
599-
# container-backed destinations drive a real emulator via testcontainers
600-
# (Docker is available on GitHub-hosted ubuntu runners) and skip cleanly if a
601-
# daemon is ever absent. Kept off the default test matrix so the hermetic
602-
# checks stay fast.
603-
integration:
604-
needs: changes
605-
if: needs.changes.outputs.code == 'true'
606-
strategy:
607-
fail-fast: false
608-
matrix:
609-
module:
610-
- sink/file
611-
- sink/http
612-
- sink/prometheus
613-
- sink/slog
614-
- sink/sql
615-
- sink/statsd
616-
- sink/otel
617-
- sink/cloudwatch
618-
- sink/dynamo
619-
- sink/eventbridge
620-
- sink/firehose
621-
- sink/gcppubsub
622-
- sink/kafka
623-
- sink/kinesis
624-
- sink/nats
625-
- sink/redis
626-
- sink/s3
627-
- sink/sns
628-
- sink/sqs
629-
- sink/timestream
630-
- examples/sinkflow
631-
runs-on: ubuntu-latest
632-
env:
633-
GOWORK: "off"
634-
steps:
635-
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
636-
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
637-
with:
638-
go-version: "1.26.4"
639-
cache-dependency-path: "**/go.sum"
640-
- name: integration tests
641-
shell: bash
642-
run: go test -C "${{ matrix.module }}" -tags integration ./...
643-
644545
# Single required status check. Branch protection requires only `gate`, which
645546
# aggregates the required jobs: it fails if any of them failed or was
646547
# cancelled, and treats a skipped job (docs-only PRs, or PRs that touch no
@@ -649,7 +550,7 @@ jobs:
649550
# never blocks a merge.
650551
gate:
651552
if: always()
652-
needs: [changes, lint, tests, vuln, coverage, docs, sink-destinations, integration]
553+
needs: [changes, lint, tests, sink, vuln, coverage, docs]
653554
runs-on: ubuntu-latest
654555
steps:
655556
- name: Fail if a required job did not pass

.github/workflows/sink.yml

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
name: sink
2+
3+
# Reusable sink test suite. Groups every sink-domain check under a single
4+
# collapsible "sink / …" tree in the checks UI rather than sprawling across the
5+
# top-level check list:
6+
# - unit: race tests for the in-workspace sink modules (Go × OS).
7+
# - sink-destinations: the SDK-backed destinations, built GOWORK=off via their
8+
# own replace directives, with lint/vuln/coverage on Linux.
9+
# - integration: the `integration`-tagged end-to-end leg (GOWORK=off).
10+
# Called by ci.yml so the caller job name ("sink") becomes the tree prefix.
11+
on:
12+
workflow_call:
13+
14+
env:
15+
GOLANGCI_LINT: github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.12.2
16+
GOVULNCHECK: golang.org/x/vuln/cmd/govulncheck@v1.3.0
17+
18+
permissions:
19+
contents: read
20+
21+
jobs:
22+
# Race tests for the in-workspace sink modules (sink core + the hermetic,
23+
# SDK-free adapters), across the Go × OS matrix. These live in the workspace,
24+
# so they build without GOWORK=off — same as the state-machine unit matrix.
25+
unit:
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
go: ["1.25.11", "1.26.4"]
30+
os: [ubuntu-latest, macos-latest, windows-latest]
31+
runs-on: ${{ matrix.os }}
32+
env:
33+
MODULES: "sink sink/bridge sink/file sink/http sink/prometheus sink/slog"
34+
steps:
35+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
36+
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
37+
with:
38+
go-version: ${{ matrix.go }}
39+
cache-dependency-path: "**/go.sum"
40+
- name: test -race
41+
shell: bash
42+
run: |
43+
for module in $MODULES; do
44+
echo "::group::test -race ($module)"
45+
go test -C "$module" -race ./...
46+
echo "::endgroup::"
47+
done
48+
49+
# The SDK-backed sink destinations are standalone modules kept out of the
50+
# workspace (see go.work / the magefile), so they build with GOWORK=off via
51+
# their own replace directives. Each is one matrix leg across the OS matrix for
52+
# race tests; lint, vuln, and the coverage gate run on Linux. This keeps the
53+
# vendor SDKs out of the core modules' dependency graphs.
54+
sink-destinations:
55+
strategy:
56+
fail-fast: false
57+
matrix:
58+
os: [ubuntu-latest, macos-latest, windows-latest]
59+
module:
60+
- sink/cloudwatch
61+
- sink/dynamo
62+
- sink/eventbridge
63+
- sink/firehose
64+
- sink/gcppubsub
65+
- sink/kafka
66+
- sink/kinesis
67+
- sink/nats
68+
- sink/otel
69+
- sink/redis
70+
- sink/s3
71+
- sink/sns
72+
- sink/sql
73+
- sink/sqs
74+
- sink/statsd
75+
- sink/timestream
76+
- examples/sinkflow
77+
runs-on: ${{ matrix.os }}
78+
env:
79+
GOWORK: "off"
80+
THRESHOLD: "80"
81+
steps:
82+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
83+
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
84+
with:
85+
go-version: "1.26.4"
86+
cache-dependency-path: "**/go.sum"
87+
- name: test -race
88+
shell: bash
89+
run: go test -C "${{ matrix.module }}" -race ./...
90+
- name: golangci-lint
91+
if: matrix.os == 'ubuntu-latest'
92+
shell: bash
93+
run: go -C "${{ matrix.module }}" run "$GOLANGCI_LINT" run --config "$GITHUB_WORKSPACE/.golangci.yml" ./...
94+
- name: govulncheck
95+
if: matrix.os == 'ubuntu-latest'
96+
shell: bash
97+
run: go -C "${{ matrix.module }}" run "$GOVULNCHECK" ./...
98+
- name: coverage gate
99+
if: matrix.os == 'ubuntu-latest'
100+
shell: bash
101+
run: |
102+
go test -C "${{ matrix.module }}" -covermode=atomic -coverprofile=coverage.out ./...
103+
pct=$(go -C "${{ matrix.module }}" tool cover -func=coverage.out | awk '/^total:/ {sub(/%/,"",$3); print $3}')
104+
echo "total coverage: ${pct}% (threshold ${THRESHOLD}%)"
105+
awk -v p="$pct" -v t="$THRESHOLD" 'BEGIN { exit (p+0 < t+0) ? 1 : 0 }' \
106+
|| { echo "::error::coverage ${pct}% is below the ${THRESHOLD}% threshold"; exit 1; }
107+
108+
# Integration / E2E leg, behind the `integration` build tag, run with
109+
# GOWORK=off. The hermetic destinations (sql, http, file, slog, prometheus,
110+
# statsd, otel) and the flagship sinkflow example run end-to-end; the
111+
# container-backed destinations drive a real emulator via testcontainers
112+
# (Docker is available on GitHub-hosted ubuntu runners) and skip cleanly if a
113+
# daemon is ever absent. Kept off the default test matrix so the hermetic
114+
# checks stay fast.
115+
integration:
116+
strategy:
117+
fail-fast: false
118+
matrix:
119+
module:
120+
- sink/file
121+
- sink/http
122+
- sink/prometheus
123+
- sink/slog
124+
- sink/sql
125+
- sink/statsd
126+
- sink/otel
127+
- sink/cloudwatch
128+
- sink/dynamo
129+
- sink/eventbridge
130+
- sink/firehose
131+
- sink/gcppubsub
132+
- sink/kafka
133+
- sink/kinesis
134+
- sink/nats
135+
- sink/redis
136+
- sink/s3
137+
- sink/sns
138+
- sink/sqs
139+
- sink/timestream
140+
- examples/sinkflow
141+
runs-on: ubuntu-latest
142+
env:
143+
GOWORK: "off"
144+
steps:
145+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
146+
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
147+
with:
148+
go-version: "1.26.4"
149+
cache-dependency-path: "**/go.sum"
150+
- name: integration tests
151+
shell: bash
152+
run: go test -C "${{ matrix.module }}" -tags integration ./...

.github/workflows/test.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
name: tests
22

3-
# Reusable race-test matrix. Runs `go test -race ./...` for every module in the
4-
# suite across the Go × OS matrix. Called by ci.yml so the matrix legs render as
5-
# a single collapsible tree in the checks UI (e.g. "tests / test (1.25.11,
6-
# ubuntu-latest)") instead of cluttering the top-level checks list.
3+
# Reusable race-test matrix for the state-machine modules. Runs `go test -race
4+
# ./...` for each module across the Go × OS matrix. Called by ci.yml so the legs
5+
# render as a single collapsible tree in the checks UI (e.g. "state machine tests
6+
# / test (1.25.11, ubuntu-latest)") instead of cluttering the top-level checks
7+
# list. The sink-domain modules have their own reusable workflow (sink.yml).
78
on:
89
workflow_call:
910
inputs:

0 commit comments

Comments
 (0)