diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index a60ac671..d83655c8 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -61,5 +61,8 @@ jobs: ETH_MAINNET_ENDPOINT: ${{ secrets.ETH_MAINNET_ENDPOINT }} run: ./scripts/run-unit-tests.sh - - name: Run coverage - run: bash <(curl -s https://codecov.io/bash) + - name: Upload code coverage + uses: codecov/codecov-action@v3 + with: + verbose: true + fail_ci_if_error: true diff --git a/.gitignore b/.gitignore index a88acfa3..61edb11b 100644 --- a/.gitignore +++ b/.gitignore @@ -16,7 +16,7 @@ *.test # Output of the go coverage tool -/coverage.out +/coverage.txt /coverage.html # Logs from make targets diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..4feff269 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,7 @@ +# Don't calculate code coverage percentages on generated abigen files +ignore: + - ethereum/swap_factory.go + - ethereum/aggregator_v3_interface.go + - ethereum/erc20_mock.go + - ethereum/ierc20.go + - ethereum/block/ut_contract_test.go diff --git a/scripts/run-unit-tests.sh b/scripts/run-unit-tests.sh index 15890084..c2058f12 100755 --- a/scripts/run-unit-tests.sh +++ b/scripts/run-unit-tests.sh @@ -10,12 +10,12 @@ start-ganache # run unit tests echo "running unit tests..." -rm -f coverage.out -go test ./... -v -short -timeout=30m -count=1 -covermode=atomic -coverprofile=coverage.out +rm -f coverage.txt +go test ./... -v -short -timeout=30m -count=1 -covermode=atomic -coverprofile=coverage.txt OK=$? -if [[ -e coverage.out ]]; then - go tool cover -html=coverage.out -o coverage.html +if [[ -e coverage.txt ]]; then + go tool cover -html=coverage.txt -o coverage.html fi stop-monerod-regtest diff --git a/tests/integration_test.go b/tests/integration_test.go index b5d3731b..001ac521 100644 --- a/tests/integration_test.go +++ b/tests/integration_test.go @@ -560,7 +560,7 @@ func (s *IntegrationTestSuite) testAbortXMRTakerCancels(asset types.EthAsset) { // namespace (the namespace for swapd hosts providing XMR offers). We need // to wait a little extra before Alice calls Discover to ensure that the // advertisement went out. - common.SleepWithContext(ctx, time.Millisecond*500) + common.SleepWithContext(ctx, time.Second) peerIDs, err := ac.Discover(string(coins.ProvidesXMR), defaultDiscoverTimeout) require.NoError(s.T(), err)