1- name : Unit Tests
1+ name : unit
22
33on :
44 pull_request :
@@ -16,25 +16,56 @@ concurrency:
1616 cancel-in-progress : true
1717
1818jobs :
19- # Runs the unit tests for Go packages
20- go :
21- name : Go Unit Tests
19+ unit-tests :
20+ name : unit-tests (${{ matrix.shard.name }})
2221 runs-on : ubuntu-22.04
23- timeout-minutes : 25
22+ strategy :
23+ fail-fast : false
24+ matrix :
25+ shard :
26+ - name : fast
27+ packages : " ./... -./internal/kgateway/translator/gateway -./internal/kgateway/controller -./internal/kgateway/agentgatewaysyncer -./internal/sds/pkg/run -./internal/kgateway/setup"
28+ - name : translator-gateway
29+ packages : " ./internal/kgateway/translator/gateway"
30+ - name : controller
31+ packages : " ./internal/kgateway/controller"
32+ - name : agentgatewaysyncer
33+ packages : " ./internal/kgateway/agentgatewaysyncer"
34+ - name : sds-run
35+ packages : " ./internal/sds/pkg/run"
36+ - name : setup
37+ packages : " ./internal/kgateway/setup"
2438 steps :
25- - uses : actions/checkout@v4
26- - name : Setup Go
27- uses : actions/setup-go@v5
28- with :
29- go-version-file : go.mod
30- - name : Install dependencies
31- run : make mod-download
32- - name : Run Tests
33- shell : bash
34- run : make unit-with-coverage
35- - name : Validate Test Coverage
36- shell : bash
37- # The make will error if test coverage drops below a certain threshold
38- # We intentionally ignore the errors while we build out our test coverage, to establish a good baseline
39- # However, we should strive to establish a baseline, and then make it required on PRs
40- run : make --always-make --ignore-errors validate-test-coverage
39+ - uses : actions/checkout@v4
40+ - name : Setup Go
41+ uses : actions/setup-go@v5
42+ with :
43+ go-version-file : go.mod
44+ cache : true
45+ - name : Download deps
46+ run : make mod-download
47+ - name : Run unit tests (${{ matrix.shard.name }})
48+ run : make unit-with-coverage TEST_PKG="${{ matrix.shard.packages }}" GO_TEST_ARGS="-timeout=15m"
49+ - name : Validate Test Coverage
50+ shell : bash
51+ run : make validate-test-coverage || true
52+ - name : Upload coverage
53+ if : success()
54+ uses : actions/upload-artifact@v4
55+ with :
56+ name : coverage-${{ matrix.shard.name }}
57+ path : cover.out
58+ if-no-files-found : ignore
59+
60+ aggregate :
61+ name : unit (aggregate)
62+ runs-on : ubuntu-22.04
63+ needs :
64+ - unit-tests
65+ steps :
66+ - name : Download coverage artifacts
67+ uses : actions/download-artifact@v4
68+ with :
69+ path : ./coverage
70+ - name : Done
71+ run : echo "All unit tests passed"
0 commit comments