From 8d75ef3c85e40a7ba6b6cc1114712677b2ccf770 Mon Sep 17 00:00:00 2001 From: William Guilherme Date: Wed, 1 May 2024 15:00:31 -0700 Subject: [PATCH] fix: Added CodeCov Support to GitHub Workflow (#449) * fix: Added CodeCov Support to GitHub Workflow --- .github/workflows/zpa-test.yml | 45 ++++++++++++++----- .gitignore | 4 +- CHANGELOG.md | 11 +++++ GNUmakefile | 10 +++-- README.md | 7 ++- codecov.yml | 17 +++++++ docs/guides/release-notes.md | 13 +++++- zpa/common/testing/variable/variable.go | 4 +- zpa/common/version.go | 2 +- zpa/resource_zpa_app_connector_group_test.go | 4 +- ...resource_zpa_lss_config_controller_test.go | 2 +- zpa/resource_zpa_service_edge_group_test.go | 8 ++-- zpa/version.go | 2 +- 13 files changed, 100 insertions(+), 29 deletions(-) create mode 100644 codecov.yml diff --git a/.github/workflows/zpa-test.yml b/.github/workflows/zpa-test.yml index 3018731c..fd87007a 100644 --- a/.github/workflows/zpa-test.yml +++ b/.github/workflows/zpa-test.yml @@ -78,7 +78,7 @@ jobs: timeout_minutes: 30 # Adjust as needed command: | make sweep - go test -v -cover ./zpa -v -parallel 20 -timeout 60m + make test:integration:zpa make sweep env: ZPA_CLIENT_ID: ${{ secrets.ZPA_CLIENT_ID }} @@ -88,6 +88,13 @@ jobs: TF_ACC: ${{ secrets.TF_ACC }} ZPA_ACC_TEST_FORCE_SWEEPERS: ${{ secrets.ZPA_ACC_TEST_FORCE_SWEEPERS }} + - name: Publish test coverage + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage.out + fail_ci_if_error: true + zpa-qa2-tenants: runs-on: ubuntu-latest strategy: @@ -151,7 +158,7 @@ jobs: timeout_minutes: 30 # Adjust as needed command: | make sweep - go test -v -cover ./zpa -v -parallel 20 -timeout 60m + make test:integration:zpa make sweep env: ZPA_CLIENT_ID: ${{ secrets.ZPA_CLIENT_ID }} @@ -161,7 +168,15 @@ jobs: TF_ACC: ${{ secrets.TF_ACC }} ZPA_ACC_TEST_FORCE_SWEEPERS: ${{ secrets.ZPA_ACC_TEST_FORCE_SWEEPERS }} + - name: Publish test coverage + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage.out + fail_ci_if_error: true + zpa-beta-tenants: + needs: [zpa-qa1-tenants, zpa-qa2-tenants] runs-on: ubuntu-latest strategy: fail-fast: false @@ -223,7 +238,7 @@ jobs: timeout_minutes: 30 # Adjust as needed command: | make sweep - go test -v -cover ./zpa -v -parallel 20 -timeout 60m + make test:integration:zpa make sweep env: ZPA_CLIENT_ID: ${{ secrets.ZPA_CLIENT_ID }} @@ -232,11 +247,16 @@ jobs: ZPA_CLOUD: ${{ secrets.ZPA_CLOUD }} TF_ACC: ${{ secrets.TF_ACC }} ZPA_ACC_TEST_FORCE_SWEEPERS: ${{ secrets.ZPA_ACC_TEST_FORCE_SWEEPERS }} - needs: - - zpa-qa1-tenants - - zpa-qa2-tenants + + - name: Publish test coverage + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage.out + fail_ci_if_error: true zpa-prod-tenants: + needs: [zpa-qa1-tenants, zpa-qa2-tenants, zpa-beta-tenants] runs-on: ubuntu-latest strategy: fail-fast: false @@ -298,7 +318,7 @@ jobs: timeout_minutes: 30 # Adjust as needed command: | make sweep - go test -v -cover ./zpa -v -parallel 20 -timeout 60m + make test:integration:zpa make sweep env: ZPA_CLIENT_ID: ${{ secrets.ZPA_CLIENT_ID }} @@ -307,7 +327,10 @@ jobs: ZPA_CLOUD: ${{ secrets.ZPA_CLOUD }} TF_ACC: ${{ secrets.TF_ACC }} ZPA_ACC_TEST_FORCE_SWEEPERS: ${{ secrets.ZPA_ACC_TEST_FORCE_SWEEPERS }} - needs: - - zpa-qa1-tenants - - zpa-qa2-tenants - - zpa-beta-tenants \ No newline at end of file + + - name: Publish test coverage + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage.out + fail_ci_if_error: true \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5182faf4..6dda6c91 100644 --- a/.gitignore +++ b/.gitignore @@ -54,4 +54,6 @@ dist/* local_test/ local_test/* acceptance_test.yml -.VSCodeCounter \ No newline at end of file +.VSCodeCounter +coverage.out +coverage.html \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ba133d7c..dfcaa2b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 3.2.2 (May, xx 2024) + +### Notes + +- Release date: **(May, xx 2024)** +- Supported Terraform version: **v1.x** + +### Internal Changes + +- [PR #449](https://github.com/zscaler/terraform-provider-zpa/pull/449) - Added `CodeCov` Support to GitHub Workflow + ## 3.2.1 (April, 8 2024) ### Notes diff --git a/GNUmakefile b/GNUmakefile index 9be10227..e93e1a93 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -45,6 +45,12 @@ test: testacc: TF_ACC=1 go test $(TEST) $(TESTARGS) $(TEST_FILTER) -timeout 120m +test\:integration\:zpa: + @echo "$(COLOR_ZSCALER)Running zpa integration tests...$(COLOR_NONE)" + go test -v -race -cover -coverprofile=coverage.out -covermode=atomic ./zpa -parallel 20 -timeout 60m + go tool cover -html=coverage.out -o coverage.html + + build13: GOOS=$(shell go env GOOS) build13: GOARCH=$(shell go env GOARCH) ifeq ($(OS),Windows_NT) # is Windows_NT on XP, 2000, 7, Vista, 10... @@ -57,10 +63,6 @@ build13: fmtcheck @mkdir -p $(DESTINATION) go build -o $(DESTINATION)/terraform-provider-zpa_v3.2.1 -coverage: test - @echo "✓ Opening coverage for unit tests ..." - @go tool cover -html=coverage.txt - vet: @echo "==> Checking source code against go vet and staticcheck" @go vet ./... diff --git a/README.md b/README.md index 5c251ee3..8f6ee3e2 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ -[![Test](https://github.com/zscaler/terraform-provider-zpa/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/zscaler/terraform-provider-zpa/actions/workflows/test.yml) -[![Release](https://github.com/zscaler/terraform-provider-zpa/actions/workflows/release.yml/badge.svg?branch=master)](https://github.com/zscaler/terraform-provider-zpa/actions/workflows/release.yml) +[![Release](https://github.com/zscaler/terraform-provider-zpa/actions/workflows/release.yml/badge.svg)](https://github.com/zscaler/terraform-provider-zpa/actions/workflows/release.yml) +[![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/zscaler/terraform-provider-zpa)](https://github.com/zscaler/terraform-provider-zpa/v2/blob/master/.go-version) +[![Go Report Card](https://goreportcard.com/badge/github.com/zscaler/terraform-provider-zpa)](https://goreportcard.com/report/github.com/zscaler/terraform-provider-zpa) +[![codecov](https://codecov.io/gh/zscaler/terraform-provider-zpa/graph/badge.svg?token=7YX2V2LV8H)](https://codecov.io/gh/zscaler/terraform-provider-zpa) +[![License](https://img.shields.io/github/license/zscaler/terraform-provider-zpa?color=blue)](https://github.com/zscaler/terraform-provider-zpa/v2/blob/master/LICENSE) [![Zscaler Community](https://img.shields.io/badge/zscaler-community-blue)](https://community.zscaler.com/) [![Slack](https://img.shields.io/badge/Join%20Our%20Community-Slack-blue)](https://forms.gle/3iMJvVmJDvmUy36q9) diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..3ad62dce --- /dev/null +++ b/codecov.yml @@ -0,0 +1,17 @@ +ignore: + - "vendor/**/*" + - "dist/**/*" + +coverage: + status: + project: yes + patch: yes + changes: yes +comment: + layout: "reach, diff, flags, files" + behavior: default + require_changes: false # if true: only post the comment if coverage changes + require_base: yes # [yes :: must have a base report to post] + require_head: yes # [yes :: must have a head report to post] + branches: + - master diff --git a/docs/guides/release-notes.md b/docs/guides/release-notes.md index a9977569..1721ea4b 100644 --- a/docs/guides/release-notes.md +++ b/docs/guides/release-notes.md @@ -12,10 +12,21 @@ Track all ZPA Terraform provider's releases. New resources, features, and bug fi --- -``Last updated: v3.2.1`` +``Last updated: v3.2.2`` --- +## 3.2.2 (May, xx 2024) + +### Notes + +- Release date: **(May, xx 2024)** +- Supported Terraform version: **v1.x** + +### Internal Changes + +- [PR #449](https://github.com/zscaler/terraform-provider-zpa/pull/449) - Added `CodeCov` Support to GitHub Workflow + ## 3.2.1 (April, 8 2024) ### Notes diff --git a/zpa/common/testing/variable/variable.go b/zpa/common/testing/variable/variable.go index ed953905..bf9efed8 100644 --- a/zpa/common/testing/variable/variable.go +++ b/zpa/common/testing/variable/variable.go @@ -30,8 +30,8 @@ const ( ServiceEdgeDescription = "testAcc_service_edge_group" ServiceEdgeEnabled = true ServiceEdgeIsPublic = true - ServiceEdgeLatitude = "37.3382082" - ServiceEdgeLongitude = "-121.8863286" + ServiceEdgeLatitude = "37.33874" + ServiceEdgeLongitude = "-121.8852525" ServiceEdgeLocation = "San Jose, CA, USA" ServiceEdgeVersionProfileName = "Default" ) diff --git a/zpa/common/version.go b/zpa/common/version.go index 7dca9c55..9ce5133d 100644 --- a/zpa/common/version.go +++ b/zpa/common/version.go @@ -1,6 +1,6 @@ package common -var version = "3.2.0" +var version = "3.2.2" // Version returns version of provider func Version() string { diff --git a/zpa/resource_zpa_app_connector_group_test.go b/zpa/resource_zpa_app_connector_group_test.go index 8f3df830..da437a92 100644 --- a/zpa/resource_zpa_app_connector_group_test.go +++ b/zpa/resource_zpa_app_connector_group_test.go @@ -117,8 +117,8 @@ resource "%s" "%s" { enabled = "%s" country_code = "US" city_country = "San Jose, US" - latitude = "37.3382082" - longitude = "-121.8863286" + latitude = "37.33874" + longitude = "-121.8852525" location = "San Jose, CA, USA" upgrade_day = "SUNDAY" upgrade_time_in_secs = "66600" diff --git a/zpa/resource_zpa_lss_config_controller_test.go b/zpa/resource_zpa_lss_config_controller_test.go index fb039eb1..22b006dc 100644 --- a/zpa/resource_zpa_lss_config_controller_test.go +++ b/zpa/resource_zpa_lss_config_controller_test.go @@ -168,7 +168,7 @@ resource "%s" "%s" { operator = "OR" operands { object_type = "CLIENT_TYPE" - values = ["zpn_client_type_exporter", "zpn_client_type_ip_anchoring", "zpn_client_type_zapp", "zpn_client_type_edge_connector", "zpn_client_type_machine_tunnel", "zpn_client_type_browser_isolation", "zpn_client_type_slogger", "zpn_client_type_branch_connector"] + values = ["zpn_client_type_exporter", "zpn_client_type_machine_tunnel", "zpn_client_type_ip_anchoring", "zpn_client_type_edge_connector", "zpn_client_type_zapp", "zpn_client_type_slogger", "zpn_client_type_slogger", "zpn_client_type_zapp_partner", "zpn_client_type_branch_connector"] } } conditions { diff --git a/zpa/resource_zpa_service_edge_group_test.go b/zpa/resource_zpa_service_edge_group_test.go index 6270be11..8f0d57a9 100644 --- a/zpa/resource_zpa_service_edge_group_test.go +++ b/zpa/resource_zpa_service_edge_group_test.go @@ -120,10 +120,12 @@ resource "%s" "%s" { is_public = "%s" upgrade_day = "SUNDAY" upgrade_time_in_secs = "66600" - latitude = "37.3382082" - longitude = "-121.8863286" + country_code = "US" + city_country = "San Jose, US" + latitude = "37.33874" + longitude = "-121.8852525" location = "San Jose, CA, USA" - version_profile_name = "Default" + version_profile_id = 0 } data "%s" "%s" { diff --git a/zpa/version.go b/zpa/version.go index 4512140e..b093162a 100644 --- a/zpa/version.go +++ b/zpa/version.go @@ -1,4 +1,4 @@ package zpa // ProviderVersion is set at build-time in the release process -var ProviderVersion = "3.2.0" +var ProviderVersion = "3.2.2"