From 2252055b935728aa94bf91380e455316a2c8790f Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Thu, 23 Dec 2021 08:39:43 +0100 Subject: [PATCH] enable codecoverage --- .github/workflows/test.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0f015a75f..7d21dd664 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,7 @@ jobs: go-version: ${{ matrix.go-version }} - name: Checkout code uses: actions/checkout@v2 - - id: cache-paths + - id: go-env run: | echo "::set-output name=cache::$(go env GOCACHE)" echo "::set-output name=mod-cache::$(go env GOMODCACHE)" @@ -22,10 +22,17 @@ jobs: uses: actions/cache@v2 with: path: | - ${{ steps.cache-paths.outputs.cache }} - ${{ steps.cache-paths.outputs.mod-cache }} + ${{ steps.go-env.outputs.cache }} + ${{ steps.go-env.outputs.mod-cache }} key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: ${{ runner.os }}-go- - name: Test run: | - go test ./... + go test -coverprofile='coverage.out' -covermode=atomic ./... + - name: Upload Code Coverage + uses: codecov/codecov-action@v2 + with: + fail_ci_if_error: true + files: coverage.out + flags: ${{ matrix.os }},go-${{ matrix.go-version }} + token: ${{ secrets.CODECOV_TOKEN }}