diff --git a/.github/workflows/docker-build-push.yaml b/.github/workflows/docker-build-push.yaml index 509d3ff..ebbfd82 100644 --- a/.github/workflows/docker-build-push.yaml +++ b/.github/workflows/docker-build-push.yaml @@ -34,13 +34,12 @@ jobs: go-version-file: 'go.mod' cache: true - - name: Install envtest binaries - run: | - make setup-envtest - - name: Run tests run: | - make test + go test -v ./... -coverprofile=coverage.out + go tool cover -func=coverage.out + env: + SKIP_INTEGRATION_TESTS: "true" - name: Set up QEMU uses: docker/setup-qemu-action@v3 diff --git a/.github/workflows/pr-validation.yaml b/.github/workflows/pr-validation.yaml index 7a327f4..00bbdd2 100644 --- a/.github/workflows/pr-validation.yaml +++ b/.github/workflows/pr-validation.yaml @@ -30,11 +30,10 @@ jobs: - name: Run go vet run: go vet ./... - - name: Install envtest binaries - run: make setup-envtest - - name: Run tests - run: make test + run: go test -v -race -coverprofile=coverage.out ./... + env: + SKIP_INTEGRATION_TESTS: "true" - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 6a72080..6215325 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -33,11 +33,10 @@ jobs: go-version-file: 'go.mod' cache: true - - name: Install envtest binaries - run: make setup-envtest - - name: Run tests - run: make test + run: go test -v ./... + env: + SKIP_INTEGRATION_TESTS: "true" - name: Set up QEMU uses: docker/setup-qemu-action@v3 diff --git a/internal/controller/suite_test.go b/internal/controller/suite_test.go index 750d4f5..fc5f371 100644 --- a/internal/controller/suite_test.go +++ b/internal/controller/suite_test.go @@ -48,6 +48,10 @@ var ( ) func TestControllers(t *testing.T) { + if os.Getenv("SKIP_INTEGRATION_TESTS") == "true" { + t.Skip("Skipping integration tests that require envtest") + } + RegisterFailHandler(Fail) RunSpecs(t, "Controller Suite") diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index cc8c21f..a6e7f76 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -47,6 +47,10 @@ var ( // The default setup requires Kind, builds/loads the Manager Docker image locally, and installs // CertManager. func TestE2E(t *testing.T) { + if os.Getenv("SKIP_INTEGRATION_TESTS") == "true" { + t.Skip("Skipping e2e tests that require Kubernetes cluster") + } + RegisterFailHandler(Fail) _, _ = fmt.Fprintf(GinkgoWriter, "Starting unifi-network-operator integration test suite\n") RunSpecs(t, "e2e suite")