@@ -16,39 +16,27 @@ concurrency:
16
16
cancel-in-progress :true
17
17
18
18
jobs :
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
-
35
19
deploy :
36
20
environment :
37
21
name :github-pages
38
22
url :${{ steps.deployment.outputs.page_url }}
39
23
runs-on :ubuntu-latest
40
- needs :coverage
41
24
steps :
25
+ -name :Checkout
26
+ uses :actions/checkout@v4
42
27
-name :Setup Pages
43
28
uses :actions/configure-pages@v5
44
- -name :Write coverage.html and coverage.svg
45
- env :
46
- PERCENT :${{ steps.coverage.outputs.PERCENT }}
47
- HTML :${{ steps.coverage.outputs.HTML }}
29
+ -name :Setup Go
30
+ uses :actions/setup-go@v5
31
+ with :
32
+ go-version-file :./go.mod
33
+ -name :Generate coverage and badge
48
34
run :|
35
+ ./ci/test.sh
49
36
mkdir -p ./ci/out/static
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
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"
52
40
-name :Upload artifact
53
41
uses :actions/upload-pages-artifact@v3
54
42
with :