From 9f32da7a6a02b204c6b14a2d9feaf5542e3a9424 Mon Sep 17 00:00:00 2001 From: NicklasWallgren Date: Sun, 11 Sep 2022 14:36:34 +0200 Subject: [PATCH] Send coverage to Codacy (#27) * Send coverage to Codacy * Update .coverage.sh to support linux --- .github/workflows/main.yml | 11 +++++++++-- coverage.sh | 6 +++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 71fa93a..8ee514f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,6 @@ on: [ push, pull_request ] name: Test + jobs: test: strategy: @@ -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 \ No newline at end of file diff --git a/coverage.sh b/coverage.sh index d80bdb1..a3b0a54 100755 --- a/coverage.sh +++ b/coverage.sh @@ -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