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
@@ -149,7 +187,7 @@ jobs:
149187 if : github.event_name == 'pull_request'
150188 run : |
151189 COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print substr($3, 1, length($3)-1)}')
152- echo "## 📊 Coverage Report" > coverage_comment.md
190+ echo "## 📊 ${{matrix.module}} Coverage Report" > coverage_comment.md
153191 echo "" >> coverage_comment.md
154192 echo "**Total Coverage: $COVERAGE%**" >> coverage_comment.md
155193 echo "" >> coverage_comment.md
@@ -167,6 +205,19 @@ jobs:
167205 lint :
168206 name : Lint
169207 runs-on : ubuntu-latest
208+
209+ strategy :
210+ matrix :
211+ include :
212+ - module : v1
213+ path : .
214+ - module : v2
215+ path : v2
216+
217+ defaults :
218+ run :
219+ working-directory : ${{ matrix.path }}
220+
170221 steps :
171222 - name : Checkout code
172223 uses : actions/checkout@v4
@@ -181,45 +232,3 @@ jobs:
181232 with :
182233 version : latest
183234 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