File tree Expand file tree Collapse file tree 1 file changed +23
-11
lines changed Expand file tree Collapse file tree 1 file changed +23
-11
lines changed Original file line number Diff line number Diff line change @@ -16,27 +16,39 @@ concurrency:
1616 cancel-in-progress : true
1717
1818jobs :
19+ coverage :
20+ runs-on : ubuntu-latest
21+ steps :
22+ - uses : actions/checkout@v4
23+ - uses : actions/setup-go@v5
24+ with :
25+ go-version-file : ./go.mod
26+ - run : |
27+ ./ci/test.sh
28+ echo "PERCENT=$(go tool cover -func ./ci/out/coverage.prof | tail -n1 | awk '{print $3}' | tr -d '%')" >> "$GITHUB_OUTPUT"
29+ {
30+ echo "HTML<<EOF"
31+ cat ./ci/out/coverage.html
32+ echo EOF
33+ } >> "$GITHUB_OUTPUT"
34+
1935 deploy :
2036 environment :
2137 name : github-pages
2238 url : ${{ steps.deployment.outputs.page_url }}
2339 runs-on : ubuntu-latest
40+ needs : coverage
2441 steps :
25- - name : Checkout
26- uses : actions/checkout@v4
2742 - name : Setup Pages
2843 uses : actions/configure-pages@v5
29- - name : Setup Go
30- uses : actions/setup-go@v5
31- with :
32- go-version-file : ./go.mod
33- - name : Generate coverage and badge
44+ - name : Write coverage.html and coverage.svg
45+ env :
46+ PERCENT : ${{ steps.coverage.outputs.PERCENT }}
47+ HTML : ${{ steps.coverage.outputs.HTML }}
3448 run : |
35- ./ci/test.sh
3649 mkdir -p ./ci/out/static
37- cp ./ci/out/coverage.html ./ci/out/static/coverage.html
38- percent=$(go tool cover -func ./ci/out/coverage.prof | tail -n1 | awk '{print $3}' | tr -d '%')
39- wget -O ./ci/out/static/coverage.svg "https://img.shields.io/badge/coverage-${percent}%25-success"
50+ wget -O ./ci/out/static/coverage.svg "https://img.shields.io/badge/coverage-${PERCENT}%25-success"
51+ echo "$HTML" > ./ci/out/static/coverage.html
4052 - name : Upload artifact
4153 uses : actions/upload-pages-artifact@v3
4254 with :
You can’t perform that action at this time.
0 commit comments