Skip to content

Commit f87c07b

Browse files
committed
drop coveralls.io
1 parent c118aa0 commit f87c07b

2 files changed

Lines changed: 71 additions & 6 deletions

File tree

.github/workflows/build.yml

Lines changed: 70 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,75 @@ jobs:
4343
- name: Build
4444
run: go build .
4545

46-
- name: actions-goveralls
47-
uses: shogo82148/actions-goveralls@v1
48-
with:
49-
path-to-profile: coverage.out
50-
5146
- name: Go report card
5247
uses: creekorful/goreportcard-action@v1.0
48+
49+
# Generate code coverage badge and push it to the 'coverage' branch.
50+
# Reference it in your README.md like this:
51+
#
52+
# [![coverage](https://github.com/USERNAME/REPO/blob/coverage/BRANCH/badge.svg)](#)
53+
#
54+
# If you have a detailed HTML report of the coverage (here called report.html), replace the '#' with:
55+
#
56+
# https://htmlpreview.github.io/?https://github.com/USERNAME/REPO/blob/coverage/BRANCH/report.html
57+
#
58+
# You need to have given write permissions for the for the workflow:
59+
#
60+
# permissions:
61+
# contents: write
62+
#
63+
# To create the 'coverage' branch for the repository:
64+
#
65+
# git checkout BRANCH
66+
# git checkout --orphan coverage && git rm --cached $(git ls-files) && echo '# Coverage branch' > README.md
67+
# git add README.md && git commit -m 'Add README.md' && git push origin coverage
68+
# git checkout --force BRANCH
69+
- name: Extract branch name
70+
run: echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
71+
id: extract_branch
72+
- uses: actions/checkout@v3
73+
with:
74+
ref: coverage
75+
path: coverage
76+
- name: Ensure directories for this branch exist
77+
env:
78+
BRANCH: ${{ steps.extract_branch.outputs.branch }}
79+
run: mkdir -p coverage/${BRANCH}
80+
- name: Extract code coverage
81+
id: coverage
82+
env:
83+
BRANCH: ${{ steps.extract_branch.outputs.branch }}
84+
# Change this to extract the coverage percentage (without the percent sign) for your language into COVERAGE.
85+
# Here we are using a 'coverage.out' file generated by 'go test -coverprofile=coverage.out ./...'
86+
# You may also generate a HTML report and place at 'badges/${BRANCH}/coverage.html'.
87+
run: |
88+
echo "COVERAGE=$(go tool cover -func=coverage.out | grep total | tr -s '\t' | cut -f 3 | rev | cut -c2- | rev)" >> $GITHUB_OUTPUT
89+
go tool cover -html=coverage.out -o=coverage/${BRANCH}/report.html
90+
- name: Generate the badge SVG image
91+
uses: emibcn/badge-action@v2.0.3
92+
with:
93+
label: 'coverage'
94+
status: ${{ steps.coverage.outputs.coverage }}%
95+
path: coverage/${{ steps.extract_branch.outputs.branch }}/badge.svg
96+
color: ${{
97+
steps.coverage.outputs.coverage > 90 && 'green' ||
98+
steps.coverage.outputs.coverage > 80 && 'yellow,green' ||
99+
steps.coverage.outputs.coverage > 70 && 'yellow' ||
100+
steps.coverage.outputs.coverage > 60 && 'orange,yellow' ||
101+
steps.coverage.outputs.coverage > 50 && 'orange' ||
102+
steps.coverage.outputs.coverage > 40 && 'red,orange' ||
103+
steps.coverage.outputs.coverage > 30 && 'red,red,orange' ||
104+
steps.coverage.outputs.coverage > 20 && 'red,red,red,orange' ||
105+
'red' }}
106+
- name: Commit coverage files
107+
env:
108+
BRANCH: ${{ steps.extract_branch.outputs.branch }}
109+
run: |
110+
pushd coverage
111+
git config --local user.email "action@github.com"
112+
git config --local user.name "GitHub Action"
113+
test ! -f "${BRANCH}/badge.svg" || git add "${BRANCH}/badge.svg"
114+
test ! -f "${BRANCH}/report.html" || git add "${BRANCH}/report.html"
115+
test -z "$(git status --porcelain)" || git commit -m "update"
116+
git push
117+
popd

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[![build](https://github.com/linkdata/gitsemver/actions/workflows/build.yml/badge.svg)](https://github.com/linkdata/gitsemver/actions/workflows/build.yml)
2-
[![coverage](https://coveralls.io/repos/github/linkdata/gitsemver/badge.svg?branch=main)](https://coveralls.io/github/linkdata/gitsemver?branch=main)
2+
[![coverage](https://github.com/linkdata/gitsemver/blob/coverage/main/badge.svg)](https://htmlpreview.github.io/?https://github.com/linkdata/gitsemver/blob/coverage/main/report.html)
33
[![goreport](https://goreportcard.com/badge/github.com/linkdata/gitsemver)](https://goreportcard.com/report/github.com/linkdata/gitsemver)
44
[![Docs](https://godoc.org/github.com/linkdata/gitsemver?status.svg)](https://godoc.org/github.com/linkdata/gitsemver)
55

0 commit comments

Comments
 (0)