From 5c5d88a84df2f133f5e9245789f0bc0dade63d7f Mon Sep 17 00:00:00 2001 From: Ragot Geoffrey Date: Tue, 15 Oct 2024 09:57:21 +0200 Subject: [PATCH] ci: add codecov report upload (#509) * ci: add codecov report upload --- .github/workflows/main.yml | 7 +++++-- Earthfile | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4861d5d9d..367248788 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -66,13 +66,16 @@ jobs: token: ${{ secrets.NUMARY_GITHUB_TOKEN }} - run: > earthly - --no-output --allow-privileged --secret SPEAKEASY_API_KEY=$SPEAKEASY_API_KEY ${{ contains(github.event.pull_request.labels.*.name, 'no-cache') && '--no-cache' || '' }} - +tests + +tests --coverage=true env: SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }} + - name: Upload coverage reports to Codecov with GitHub Action + uses: codecov/codecov-action@v4.2.0 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} GoReleaser: runs-on: "formance-runner" diff --git a/Earthfile b/Earthfile index 81aa9b606..9a1d45ce7 100644 --- a/Earthfile +++ b/Earthfile @@ -74,7 +74,7 @@ tests: SET goFlags="$goFlags,github.com/formancehq/ledger/pkg/accounts/..." SET goFlags="$goFlags,github.com/formancehq/ledger/pkg/assets/..." SET goFlags="$goFlags,github.com/formancehq/ledger/cmd/..." - SET goFlags="$goFlags -coverprofile cover.out" + SET goFlags="$goFlags -coverprofile coverage.txt" END IF [ "$includeIntegrationTests" = "true" ] @@ -88,9 +88,9 @@ tests: IF [ "$coverage" = "true" ] # as special case, exclude files suffixed by debug.go # toremovelater: exclude machine code as it will be updated soon - RUN cat cover.out | grep -v debug.go | grep -v "/machine/" > cover2.out - RUN mv cover2.out cover.out - SAVE ARTIFACT cover.out AS LOCAL cover.out + RUN cat coverage.txt | grep -v debug.go | grep -v "/machine/" > coverage2.txt + RUN mv coverage2.txt coverage.txt + SAVE ARTIFACT coverage.txt AS LOCAL coverage.txt END deploy: