Skip to content

Commit

Permalink
Send coverage to Codacy (#27)
Browse files Browse the repository at this point in the history
* Send coverage to Codacy

* Update .coverage.sh to support linux
  • Loading branch information
NicklasWallgren committed Sep 11, 2022
1 parent 2d59c20 commit 9f32da7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
on: [ push, pull_request ]
name: Test

jobs:
test:
strategy:
Expand Down Expand Up @@ -41,9 +42,15 @@ jobs:
run: |
mkdir -p build
mysql -h 127.0.0.1 -u root -psecret go_template_test < deployment/docker/mariadb/procedures.sql
go test -v $(go list ./...) -p 1 -coverprofile=build/coverage.out -covermode count -coverpkg ./... || true TODO, do not suppress
./coverage.sh
- name: Send coverage Codacy
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
run: |
bash <(curl -Ls https://coverage.codacy.com/get.sh) report --force-coverage-parser go -r build/coverage.out
- name: Send coverage
- name: Send coverage Coveralls
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: goveralls -coverprofile=build/coverage.out -service=github
6 changes: 5 additions & 1 deletion coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ go test $(go list ./...) -p 1 -coverprofile=build/coverage.out -covermode count
# Removes the ignored paths from the coverage.out file
while read p || [ -n "$p" ]
do
sed -i '' "/${p//\//\\/}/d" ./build/coverage.out
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' "/${p//\//\\/}/d" ./build/coverage.out
else
sed -i "/${p//\//\\/}/d" ./build/coverage.out
fi
done < ./.coverageignore

if [[ -n $(has_param "--html" "$@") ]]; then
Expand Down

0 comments on commit 9f32da7

Please sign in to comment.