Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0f14077

Browse files
committed
Split coverage and deploy jobs in static.yml to avoid env issue
1 parent f2b9c3f commit 0f14077

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

‎.github/workflows/static.yml

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,39 @@ concurrency:
1616
cancel-in-progress: true
1717

1818
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+
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:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /