Fix: prevent perpetual drift in sub-environment configuration blocks #2561
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| types: [opened, synchronize] | |
| env: | |
| ENV0_API_ENDPOINT: ${{ secrets.ENV0_API_ENDPOINT }} | |
| ENV0_API_KEY: ${{ secrets.TF_PROVIDER_INTEGRATION_TEST_API_KEY }} # API Key for organization 'TF-provider-integration-tests' @ dev | |
| ENV0_API_SECRET: ${{ secrets.TF_PROVIDER_INTEGRATION_TEST_API_SECRET }} | |
| GO_VERSION: "1.26" | |
| TERRAFORM_VERSION: 1.11.4 | |
| jobs: | |
| unit-tests: | |
| name: Unit Tests | |
| timeout-minutes: 15 | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Install Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Generate mocks | |
| run: | | |
| go install go.uber.org/mock/mockgen@v0.3.0 | |
| go generate client/api_client.go | |
| - name: Go fmt | |
| run: | | |
| fmt_out=$(gofmt -l .) | |
| if [ -n "$fmt_out" ]; then | |
| echo "Go files are not formatted:" | |
| echo "$fmt_out" | |
| echo "Run: gofmt -w ." | |
| exit 1 | |
| fi | |
| - name: Go vet | |
| run: | | |
| go vet ./... | |
| - name: Install Terraform | |
| uses: hashicorp/setup-terraform@v3 | |
| with: | |
| terraform_version: ${{ env.TERRAFORM_VERSION }} | |
| - name: Verify Terraform installation | |
| run: | | |
| terraform version | |
| which terraform | |
| echo "TF_PATH=$(which terraform)" >> $GITHUB_ENV | |
| # Make sure terraform is executable | |
| chmod +x $(which terraform) | |
| ls -la $(which terraform) | |
| - name: golangci-lint | |
| uses: golangci/golangci-lint-action@v7 | |
| with: | |
| version: v2.9.0 | |
| - name: Go Test | |
| timeout-minutes: 20 | |
| run: | | |
| echo "Using Terraform at: $TF_PATH" | |
| echo "Terraform version: $TERRAFORM_VERSION" | |
| # Run tests with detailed logging and increased timeout | |
| TF_LOG=DEBUG go test -timeout 20m -v ./... | |
| env: | |
| TF_ACC: true | |
| TF_ACC_TERRAFORM_PATH: ${{ env.TF_PATH }} | |
| TF_ACC_TERRAFORM_VERSION: ${{ env.TERRAFORM_VERSION }} | |
| # See terraform-provider-env0 README for integration tests prerequisites | |
| integration-tests: | |
| name: Integration Tests | |
| runs-on: ubuntu-24.04 | |
| container: golang:1.26-alpine | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Install Opentofu | |
| run: apk add opentofu | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Run Harness tests | |
| run: go run tests/harness.go |