1- name : " Build and Test "
1+ name : " Run Tests "
22
33on :
44 push :
1010 workflow_dispatch :
1111
1212concurrency :
13- group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github. ref }}
13+ group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1414 cancel-in-progress : true
1515
1616jobs :
17- build :
18- name : Build ${{ matrix.os }}
19- strategy :
20- fail-fast : false
21- matrix :
22- os : [ ubuntu, windows, macos ]
23- runs-on : ${{ matrix.os }}-latest
24- steps :
25- - name : Checkout code
26- uses : actions/checkout@v5
27- with :
28- ref : ${{ github.event.pull_request.head.sha }}
29-
30- - name : Setup Go with cache
31- uses : jfrog/.github/actions/install-go-with-cache@main
32-
33- - name : Install dependencies
34- run : make deps
35-
36- - name : Build binary
37- run : make build
38-
39- - name : Upload build artifacts
40- uses : actions/upload-artifact@v4
41- with :
42- name : jfrog-evidence-${{ matrix.os }}
43- path : build/jfrog-evidence*
44- retention-days : 7
45-
46- test :
47- name : Test ${{ matrix.os }}
48- strategy :
49- fail-fast : false
50- matrix :
51- os : [ ubuntu, windows, macos ]
52- runs-on : ${{ matrix.os }}-latest
17+ unit-tests :
18+ name : Unit Tests
19+ runs-on : ubuntu-latest
5320 steps :
5421 - name : Checkout code
5522 uses : actions/checkout@v5
@@ -64,196 +31,3 @@ jobs:
6431
6532 - name : Run unit tests
6633 run : make test-unit
67-
68- test-coverage :
69- name : Test Coverage Report
70- runs-on : ubuntu-latest
71- steps :
72- - name : Checkout code
73- uses : actions/checkout@v5
74- with :
75- ref : ${{ github.event.pull_request.head.sha }}
76-
77- - name : Setup Go with cache
78- uses : jfrog/.github/actions/install-go-with-cache@main
79-
80- - name : Install dependencies
81- run : make deps
82-
83- - name : Run tests with coverage
84- run : make test
85-
86- - name : Generate coverage report
87- run : make coverage
88-
89- - name : Upload coverage report
90- uses : actions/upload-artifact@v4
91- with :
92- name : coverage-report
93- path : |
94- coverage/coverage.out
95- coverage/coverage.html
96- retention-days : 30
97-
98- - name : Display coverage summary
99- run : |
100- echo "### Test Coverage Summary" >> $GITHUB_STEP_SUMMARY
101- echo "" >> $GITHUB_STEP_SUMMARY
102- echo "```" >> $GITHUB_STEP_SUMMARY
103- go tool cover -func=coverage/coverage.out | tail -n 1 >> $GITHUB_STEP_SUMMARY
104- echo "```" >> $GITHUB_STEP_SUMMARY
105- echo "" >> $GITHUB_STEP_SUMMARY
106- echo "📊 Full coverage report available in artifacts" >> $GITHUB_STEP_SUMMARY
107-
108- - name : Check coverage threshold
109- run : |
110- COVERAGE=$(go tool cover -func=coverage/coverage.out | grep total | awk '{print $3}' | sed 's/%//')
111- echo "Total coverage: ${COVERAGE}%"
112- THRESHOLD=70
113- if (( $(echo "$COVERAGE < $THRESHOLD" | bc -l) )); then
114- echo "⚠️ Coverage ${COVERAGE}% is below threshold ${THRESHOLD}%"
115- echo "::warning::Code coverage ${COVERAGE}% is below the recommended threshold of ${THRESHOLD}%"
116- else
117- echo "✅ Coverage ${COVERAGE}% meets threshold ${THRESHOLD}%"
118- fi
119-
120- integration-test :
121- name : Integration Tests
122- runs-on : ubuntu-latest
123- if : github.event_name == 'push' && github.ref == 'refs/heads/main'
124- steps :
125- - name : Checkout code
126- uses : actions/checkout@v5
127-
128- - name : Setup Go with cache
129- uses : jfrog/.github/actions/install-go-with-cache@main
130-
131- - name : Install dependencies
132- run : make deps
133-
134- - name : Run integration tests
135- run : make test-integration
136- continue-on-error : true
137- env :
138- INTEGRATION_TEST : true
139-
140- benchmark :
141- name : Benchmarks
142- runs-on : ubuntu-latest
143- if : github.event_name == 'push' && github.ref == 'refs/heads/main'
144- steps :
145- - name : Checkout code
146- uses : actions/checkout@v5
147-
148- - name : Setup Go with cache
149- uses : jfrog/.github/actions/install-go-with-cache@main
150-
151- - name : Install dependencies
152- run : make deps
153-
154- - name : Run benchmarks
155- run : make benchmark
156-
157- - name : Upload benchmark results
158- uses : actions/upload-artifact@v4
159- with :
160- name : benchmark-results
161- path : benchmark-results.txt
162- retention-days : 30
163- if : always()
164-
165- multi-platform-build :
166- name : Multi-Platform Build
167- runs-on : ubuntu-latest
168- if : github.event_name == 'push' && github.ref == 'refs/heads/main'
169- steps :
170- - name : Checkout code
171- uses : actions/checkout@v5
172-
173- - name : Setup Go with cache
174- uses : jfrog/.github/actions/install-go-with-cache@main
175-
176- - name : Install dependencies
177- run : make deps
178-
179- - name : Build for all platforms
180- run : make build-all
181-
182- - name : Upload multi-platform artifacts
183- uses : actions/upload-artifact@v4
184- with :
185- name : jfrog-evidence-all-platforms
186- path : build/
187- retention-days : 30
188-
189- code-quality :
190- name : Code Quality Check
191- runs-on : ubuntu-latest
192- steps :
193- - name : Checkout code
194- uses : actions/checkout@v5
195- with :
196- ref : ${{ github.event.pull_request.head.sha }}
197-
198- - name : Setup Go with cache
199- uses : jfrog/.github/actions/install-go-with-cache@main
200-
201- - name : Install dependencies
202- run : make deps
203-
204- - name : Install tools
205- run : make install-tools
206-
207- - name : Format check
208- run : |
209- make fmt
210- if [ -n "$(git status --porcelain)" ]; then
211- echo "::error::Code is not properly formatted. Please run 'make fmt'"
212- git diff
213- exit 1
214- fi
215-
216- - name : Run vet
217- run : make vet
218-
219- - name : Run linter
220- run : make lint
221- continue-on-error : true
222-
223- summary :
224- name : Test Summary
225- needs : [build, test, test-coverage, code-quality]
226- runs-on : ubuntu-latest
227- if : always()
228- steps :
229- - name : Summary
230- run : |
231- echo "## Workflow Summary" >> $GITHUB_STEP_SUMMARY
232- echo "" >> $GITHUB_STEP_SUMMARY
233-
234- if [[ "${{ needs.build.result }}" == "success" ]]; then
235- echo "✅ **Build:** Passed" >> $GITHUB_STEP_SUMMARY
236- else
237- echo "❌ **Build:** Failed" >> $GITHUB_STEP_SUMMARY
238- fi
239-
240- if [[ "${{ needs.test.result }}" == "success" ]]; then
241- echo "✅ **Tests:** Passed" >> $GITHUB_STEP_SUMMARY
242- else
243- echo "❌ **Tests:** Failed" >> $GITHUB_STEP_SUMMARY
244- fi
245-
246- if [[ "${{ needs.test-coverage.result }}" == "success" ]]; then
247- echo "✅ **Coverage:** Generated" >> $GITHUB_STEP_SUMMARY
248- else
249- echo "❌ **Coverage:** Failed" >> $GITHUB_STEP_SUMMARY
250- fi
251-
252- if [[ "${{ needs.code-quality.result }}" == "success" ]]; then
253- echo "✅ **Code Quality:** Passed" >> $GITHUB_STEP_SUMMARY
254- else
255- echo "⚠️ **Code Quality:** Issues found" >> $GITHUB_STEP_SUMMARY
256- fi
257-
258- echo "" >> $GITHUB_STEP_SUMMARY
259- echo "📦 Artifacts available for download in the workflow run" >> $GITHUB_STEP_SUMMARY
0 commit comments