1- name : CI/CD Pipeline
1+ name : CI
22
33on :
44 push :
55 branches : [ main, develop ]
6- tags : [ 'v*' ]
76 pull_request :
87 branches : [ main, develop ]
98
109env :
1110 GO_VERSION : ' 1.24.5'
12- CGO_ENABLED : 0
1311
1412jobs :
15- validate :
16- name : Validate Workflow
17- runs-on : ubuntu-latest
18- steps :
19- - name : Checkout code
20- uses : actions/checkout@v4
21-
22- - name : Validate workflow syntax
23- run : |
24- # Check if workflow files are valid YAML
25- python3 -c "import yaml; yaml.safe_load(open('.github/workflows/ci.yml'))"
26- echo "✅ Workflow syntax is valid"
27-
28- - name : Check workflow context usage
29- run : |
30- # Check for potential context issues
31- if grep -q "steps\." .github/workflows/ci.yml; then
32- echo "⚠️ Found steps context usage - verifying validity"
33- fi
34- echo "✅ Workflow context usage appears valid"
35-
3613 test :
37- name : Test & Coverage
14+ name : Test
3815 runs-on : ubuntu-latest
3916 strategy :
4017 matrix :
4118 go-version : [1.24.4, 1.24.5]
42- platform : [ubuntu-latest, windows-latest, macos-latest]
4319
4420 steps :
4521 - name : Checkout code
5430 - name : Install dependencies
5531 run : go mod download
5632
57- - name : Run tests with coverage
58- env :
59- CGO_ENABLED : 1
33+ - name : Run tests
6034 run : |
6135 go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
6236 go tool cover -func=coverage.out
@@ -65,15 +39,12 @@ jobs:
6539 uses : codecov/codecov-action@v4
6640 with :
6741 file : ./coverage.out
68- flags : unittests
69- name : codecov-umbrella
7042 fail_ci_if_error : false
71- verbose : true
7243
7344 quality :
7445 name : Code Quality
7546 runs-on : ubuntu-latest
76- needs : [validate, test]
47+ needs : [test]
7748
7849 steps :
7950 - name : Checkout code
@@ -111,17 +82,10 @@ jobs:
11182 - name : Run gosec
11283 run : gosec ./...
11384
114- - name : Check for race conditions
115- env :
116- CGO_ENABLED : 1
117- run : go test -race ./...
118-
119-
120-
12185 build :
12286 name : Build
12387 runs-on : ubuntu-latest
124- needs : [validate, test, quality]
88+ needs : [test, quality]
12589 strategy :
12690 matrix :
12791 goos : [linux, windows, darwin]
@@ -145,106 +109,4 @@ jobs:
145109 GOOS : ${{ matrix.goos }}
146110 GOARCH : ${{ matrix.goarch }}
147111 CGO_ENABLED : 0
148- run : |
149- go build -v -ldflags="-s -w" ./...
150- go test -c ./...
151-
152- - name : Upload build artifacts
153- uses : actions/upload-artifact@v4
154- with :
155- name : build-${{ matrix.goos }}-${{ matrix.goarch }}
156- path : |
157- *.exe
158- *.test
159- retention-days : 7
160-
161- benchmark :
162- name : Benchmark
163- runs-on : ubuntu-latest
164- needs : [validate, test]
165-
166- steps :
167- - name : Checkout code
168- uses : actions/checkout@v4
169-
170- - name : Set up Go
171- uses : actions/setup-go@v4
172- with :
173- go-version : ${{ env.GO_VERSION }}
174- cache : true
175-
176- - name : Run benchmarks
177- run : |
178- go test -bench=. -benchmem ./...
179- go test -bench=. -benchmem -cpu=1,2,4 ./...
180-
181- release :
182- name : Release
183- runs-on : ubuntu-latest
184- needs : [test, quality, build]
185- if : startsWith(github.ref, 'refs/tags/v')
186- permissions :
187- contents : write
188- packages : write
189-
190- steps :
191- - name : Checkout code
192- uses : actions/checkout@v4
193-
194- - name : Set up Go
195- uses : actions/setup-go@v4
196- with :
197- go-version : ${{ env.GO_VERSION }}
198- cache : true
199-
200- - name : Build for multiple platforms
201- env :
202- CGO_ENABLED : 0
203- run : |
204- # Build for current platform
205- go build -v -ldflags="-s -w" -o go-errors ./...
206-
207- # Build for other platforms
208- GOOS=linux GOARCH=amd64 go build -v -ldflags="-s -w" -o go-errors-linux-amd64 ./...
209- GOOS=linux GOARCH=arm64 go build -v -ldflags="-s -w" -o go-errors-linux-arm64 ./...
210- GOOS=windows GOARCH=amd64 go build -v -ldflags="-s -w" -o go-errors-windows-amd64.exe ./...
211- GOOS=darwin GOARCH=amd64 go build -v -ldflags="-s -w" -o go-errors-darwin-amd64 ./...
212- GOOS=darwin GOARCH=arm64 go build -v -ldflags="-s -w" -o go-errors-darwin-arm64 ./...
213-
214- - name : Generate checksums
215- run : |
216- sha256sum go-errors* > checksums.txt
217-
218- - name : Create Release
219- id : create_release
220- uses : softprops/action-gh-release@v2
221- with :
222- tag_name : ${{ github.ref_name }}
223- name : Release ${{ github.ref_name }}
224- draft : false
225- prerelease : false
226- files : |
227- go-errors
228- go-errors-linux-amd64
229- go-errors-linux-arm64
230- go-errors-windows-amd64.exe
231- go-errors-darwin-amd64
232- go-errors-darwin-arm64
233- checksums.txt
234- generate_release_notes : true
235- env :
236- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
237-
238- dependency-review :
239- name : Dependency Review
240- runs-on : ubuntu-latest
241- if : github.event_name == 'pull_request'
242-
243- steps :
244- - name : Checkout code
245- uses : actions/checkout@v4
246-
247- - name : Dependency Review
248- uses : actions/dependency-review-action@v4
249- with :
250- fail-on-severity : moderate
112+ run : go build -v ./...
0 commit comments