99jobs :
1010 test :
1111 name : Test
12- runs-on : " ubuntu-latest"
13-
12+ runs-on : ubuntu-latest
13+
14+ strategy :
15+ matrix :
16+ include :
17+ - module : v1
18+ path : .
19+ - module : v2
20+ path : v2
21+
22+ defaults :
23+ run :
24+ working-directory : ${{ matrix.path }}
25+
1426 steps :
1527 - name : Checkout code
1628 uses : actions/checkout@v4
2638 path : |
2739 ~/.cache/go-build
2840 ~/go/pkg/mod
29- key : ubuntu-latest-go-1.24-${{ hashFiles('** /go.sum') }}
41+ key : ubuntu-latest-go-1.24-${{ hashFiles(format('{0} /go.sum', matrix.path) ) }}
3042 restore-keys : |
3143 ubuntu-latest-go-1.24-
3244
5567 benchmark :
5668 name : Benchmark
5769 runs-on : ubuntu-latest
70+
71+ strategy :
72+ matrix :
73+ include :
74+ - module : v1
75+ path : .
76+ - module : v2
77+ path : v2
78+
79+ defaults :
80+ run :
81+ working-directory : ${{ matrix.path }}
82+
5883 steps :
5984 - name : Checkout code
6085 uses : actions/checkout@v4
7095 path : |
7196 ~/.cache/go-build
7297 ~/go/pkg/mod
73- key : ubunsu -latest-go-1.24-${{ hashFiles('** /go.sum') }}
98+ key : ubuntu -latest-go-1.24-${{ hashFiles(format('{0} /go.sum', matrix.path) ) }}
7499 restore-keys : |
75100 ubunsu-latest-go-1.24-
76101
@@ -83,6 +108,19 @@ jobs:
83108 coverage :
84109 name : Coverage Check
85110 runs-on : ubuntu-latest
111+
112+ strategy :
113+ matrix :
114+ include :
115+ - module : v1
116+ path : .
117+ - module : v2
118+ path : v2
119+
120+ defaults :
121+ run :
122+ working-directory : ${{ matrix.path }}
123+
86124 steps :
87125 - name : Checkout code
88126 uses : actions/checkout@v4
98136 path : |
99137 ~/.cache/go-build
100138 ~/go/pkg/mod
101- key : ubuntu-latest-go-1.24-${{ hashFiles('** /go.sum') }}
139+ key : ubuntu-latest-go-1.24-${{ hashFiles(format('{0} /go.sum', matrix.path) ) }}
102140 restore-keys : |
103141 ubuntu-latest-go-1.24-
104142
@@ -138,6 +176,7 @@ jobs:
138176 - name : Update coverage badge
139177 uses : ncruces/go-coverage-report@main
140178 with :
179+ output-dir : ${{matrix.module}}
141180 coverage-file : coverage.out
142181 report : true
143182 chart : true
@@ -149,7 +188,7 @@ jobs:
149188 if : github.event_name == 'pull_request'
150189 run : |
151190 COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print substr($3, 1, length($3)-1)}')
152- echo "## 📊 Coverage Report" > coverage_comment.md
191+ echo "## 📊 ${{matrix.module}} Coverage Report" > coverage_comment.md
153192 echo "" >> coverage_comment.md
154193 echo "**Total Coverage: $COVERAGE%**" >> coverage_comment.md
155194 echo "" >> coverage_comment.md
@@ -167,6 +206,19 @@ jobs:
167206 lint :
168207 name : Lint
169208 runs-on : ubuntu-latest
209+
210+ strategy :
211+ matrix :
212+ include :
213+ - module : v1
214+ path : .
215+ - module : v2
216+ path : v2
217+
218+ defaults :
219+ run :
220+ working-directory : ${{ matrix.path }}
221+
170222 steps :
171223 - name : Checkout code
172224 uses : actions/checkout@v4
@@ -181,45 +233,3 @@ jobs:
181233 with :
182234 version : latest
183235 args : --timeout=5m
184-
185- security :
186- name : Security Scan
187- runs-on : ubuntu-latest
188- steps :
189- - name : Checkout code
190- uses : actions/checkout@v4
191-
192- - name : Set up Go
193- uses : actions/setup-go@v4
194- with :
195- go-version : ' 1.24'
196-
197- - name : Run Gosec Security Scanner
198- uses : securego/gosec@master
199- with :
200- args : ' -no-fail -fmt sarif -out results.sarif ./...'
201-
202- - name : Upload SARIF file
203- uses : github/codeql-action/upload-sarif@v3
204- with :
205- sarif_file : results.sarif
206-
207- notify :
208- name : Notify
209- runs-on : ubuntu-latest
210- needs : [test, benchmark, coverage, lint, security]
211- if : always()
212- steps :
213- - name : Notify success
214- if : needs.test.result == 'success' && needs.coverage.result == 'success' && needs.lint.result == 'success'
215- run : echo "✅ All checks passed!"
216-
217- - name : Notify failure
218- if : needs.test.result == 'failure' || needs.coverage.result == 'failure' || needs.lint.result == 'failure'
219- run : |
220- echo "❌ Some checks failed:"
221- echo "Tests: ${{ needs.test.result }}"
222- echo "Coverage: ${{ needs.coverage.result }}"
223- echo "Lint: ${{ needs.lint.result }}"
224- echo "Security: ${{ needs.security.result }}"
225- exit 1
0 commit comments