diff --git a/.github/workflows/gotest.yml b/.github/workflows/gotest.yml index 5452f3dec..ca2c6dd0b 100644 --- a/.github/workflows/gotest.yml +++ b/.github/workflows/gotest.yml @@ -38,7 +38,7 @@ jobs: go-version-file: 'go.mod' - name: Install missing tools run: sudo apt update && sudo apt install -y zsh - - name: Run unit tests 👉️ Summary (top left) → «Failures/Errors» table + - name: Run unit tests run: | make test_unit && [[ ! $(jq -s -c 'map(select(.Action == "fail")) | .[]' test/unit/gotest.json) ]] @@ -131,7 +131,7 @@ jobs: go-version-file: 'go.mod' - name: Install missing tools run: sudo apt update && sudo apt install -y zsh - - name: Run CLI tests 👉️ Summary (top left) → «Failures/Errors» table + - name: Run CLI tests env: IPFS_PATH: ${{ runner.temp }}/ipfs-test run: make test_cli diff --git a/mk/golang.mk b/mk/golang.mk index 86ef5c54d..0bc14c87d 100644 --- a/mk/golang.mk +++ b/mk/golang.mk @@ -44,18 +44,19 @@ endef # Only disable colors when running in CI (non-interactive terminal) GOTESTSUM_NOCOLOR := $(if $(CI),--no-color,) -# Unit tests with coverage (excludes test/cli which has separate target) +# Unit tests with coverage (excludes packages that need ipfs binary) # Produces JSON for CI reporting and coverage profile for Codecov test_unit: test/bin/gotestsum $$(DEPS_GO) rm -f test/unit/gotest.json coverage/unit_tests.coverprofile - gotestsum $(GOTESTSUM_NOCOLOR) --jsonfile test/unit/gotest.json -- $(go-flags-with-tags) $(GOTFLAGS) -covermode=atomic -coverprofile=coverage/unit_tests.coverprofile -coverpkg=./... $$($(GOCC) list ./... | grep -v '/test/cli') + gotestsum $(GOTESTSUM_NOCOLOR) --jsonfile test/unit/gotest.json -- $(go-flags-with-tags) $(GOTFLAGS) -covermode=atomic -coverprofile=coverage/unit_tests.coverprofile -coverpkg=./... $$($(GOCC) list ./... | grep -v '/test/cli' | grep -v '/client/rpc') .PHONY: test_unit -# CLI integration tests (requires built binary in PATH) +# CLI/integration tests (requires built binary in PATH) +# Includes test/cli and client/rpc (which uses test/cli/harness) # Produces JSON for CI reporting test_cli: cmd/ipfs/ipfs test/bin/gotestsum rm -f test/cli/cli-tests.json - PATH="$(CURDIR)/cmd/ipfs:$(CURDIR)/test/bin:$$PATH" gotestsum $(GOTESTSUM_NOCOLOR) --jsonfile test/cli/cli-tests.json -- -v ./test/cli/... + PATH="$(CURDIR)/cmd/ipfs:$(CURDIR)/test/bin:$$PATH" gotestsum $(GOTESTSUM_NOCOLOR) --jsonfile test/cli/cli-tests.json -- -v ./test/cli/... ./client/rpc/... .PHONY: test_cli # Build kubo for all platforms from .github/build-platforms.yml diff --git a/test/dependencies/go.mod b/test/dependencies/go.mod index 826fd60eb..75bbdf72c 100644 --- a/test/dependencies/go.mod +++ b/test/dependencies/go.mod @@ -15,7 +15,7 @@ require ( github.com/ipfs/iptb-plugins v0.5.1 github.com/multiformats/go-multiaddr v0.16.1 github.com/multiformats/go-multihash v0.2.3 - gotest.tools/gotestsum v1.12.3 + gotest.tools/gotestsum v1.13.0 ) require ( diff --git a/test/dependencies/go.sum b/test/dependencies/go.sum index 829479591..78d6acaef 100644 --- a/test/dependencies/go.sum +++ b/test/dependencies/go.sum @@ -985,8 +985,8 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools/gotestsum v1.12.3 h1:jFwenGJ0RnPkuKh2VzAYl1mDOJgbhobBDeL2W1iEycs= -gotest.tools/gotestsum v1.12.3/go.mod h1:Y1+e0Iig4xIRtdmYbEV7K7H6spnjc1fX4BOuUhWw2Wk= +gotest.tools/gotestsum v1.13.0 h1:+Lh454O9mu9AMG1APV4o0y7oDYKyik/3kBOiCqiEpRo= +gotest.tools/gotestsum v1.13.0/go.mod h1:7f0NS5hFb0dWr4NtcsAsF0y1kzjEFfAil0HiBQJE03Q= gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q= gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA= honnef.co/go/tools v0.6.1 h1:R094WgE8K4JirYjBaOpz/AvTyUu/3wbmAoskKN/pxTI=