TER-33: Fix schedule_rotation drift. Migrate to TF Plugin Framework. #2083
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
| # This GitHub action runs your tests for each commit push and/or PR. Optionally | |
| # you can turn it on using a cron schedule for regular testing. | |
| # | |
| name: Tests | |
| on: | |
| push: | |
| branches: | |
| - master | |
| tags-ignore: | |
| - '*' | |
| paths-ignore: | |
| - 'README.md' | |
| pull_request: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| concurrency: | |
| group: tests-${{ github.head_ref || github.ref }} | |
| cancel-in-progress: true | |
| # For systems with an upstream API that could drift unexpectedly (like most SaaS systems, etc.), | |
| # we recommend testing at a regular interval not necessarily tied to code changes. This will | |
| # ensure you are alerted to something breaking due to an API change, even if the code did not | |
| # change. | |
| # schedule: | |
| # - cron: '0 13 * * *' | |
| jobs: | |
| # ensure the code builds... | |
| build: | |
| name: Build | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | |
| with: | |
| go-version-file: go.mod | |
| - name: Get dependencies | |
| run: | | |
| go mod download | |
| - name: Build | |
| run: | | |
| go build -v ./... | |
| lint: | |
| name: Lint | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| timeout-minutes: 2 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Lint test names | |
| run: | | |
| scripts/lint-test-names.sh | |
| - name: Check new resources have tests | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| git fetch origin ${{ github.base_ref }} --depth=1 | |
| scripts/lint-test-coverage.sh origin/${{ github.base_ref }} | |
| # run acceptance tests in sharded matrix for speed | |
| test: | |
| name: Matrix Test | |
| needs: build | |
| runs-on: blacksmith-4vcpu-ubuntu-2404 | |
| timeout-minutes: 45 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| terraform: | |
| - '1.13.*' | |
| shard: [0, 1, 2, 3] | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | |
| with: | |
| go-version-file: go.mod | |
| - uses: hashicorp/setup-terraform@dfe3c3f87815947d99a8997f908cb6525fc44e9e # v4.0.1 | |
| with: | |
| terraform_version: ${{ matrix.terraform }} | |
| terraform_wrapper: false | |
| - name: Get dependencies | |
| run: | | |
| go mod download | |
| - name: Sweep dangling test resources | |
| if: matrix.shard == 0 | |
| timeout-minutes: 5 | |
| env: | |
| ROOTLY_API_TOKEN: ${{ secrets.ROOTLY_API_TOKEN }} | |
| run: | | |
| go test ./internal/provider -v -tags=sweep -sweep=all -sweep-allow-failures -timeout 5m | |
| continue-on-error: true | |
| - name: Install gotestsum | |
| run: go install gotest.tools/gotestsum@latest | |
| - name: Run internal/provider tests (shard 0 only, sequential) | |
| if: matrix.shard == 0 | |
| timeout-minutes: 15 | |
| env: | |
| TF_ACC: "1" | |
| ROOTLY_API_TOKEN: ${{ secrets.ROOTLY_API_TOKEN }} | |
| run: | | |
| gotestsum --format standard-verbose -- \ | |
| -v -cover -timeout 15m \ | |
| ./internal/provider/ | |
| - name: Discover and shard provider tests | |
| id: shard | |
| run: | | |
| # List test functions from provider/ only, shard by modulo | |
| TESTS=$(go test -list 'Test.*' ./provider/ 2>/dev/null | grep '^Test' | sort) | |
| TOTAL=$(echo "$TESTS" | wc -l) | |
| SHARD=${{ matrix.shard }} | |
| SHARDS=4 | |
| # Select tests for this shard | |
| SHARD_TESTS=$(echo "$TESTS" | awk "NR % $SHARDS == $SHARD") | |
| if [ -z "$SHARD_TESTS" ]; then | |
| echo "run=false" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| # Build regex pattern | |
| PATTERN=$(echo "$SHARD_TESTS" | paste -sd '|') | |
| echo "pattern=^($PATTERN)$" >> "$GITHUB_OUTPUT" | |
| echo "count=$(echo "$SHARD_TESTS" | wc -l)" >> "$GITHUB_OUTPUT" | |
| echo "run=true" >> "$GITHUB_OUTPUT" | |
| echo "Shard $SHARD: $(echo "$SHARD_TESTS" | wc -l)/$TOTAL tests" | |
| - name: TF acceptance tests (provider/) | |
| if: steps.shard.outputs.run == 'true' | |
| timeout-minutes: 45 | |
| env: | |
| TF_ACC: "1" | |
| ROOTLY_API_TOKEN: ${{ secrets.ROOTLY_API_TOKEN }} | |
| run: | | |
| gotestsum --format standard-verbose -- \ | |
| -v -cover -timeout 45m -parallel 4 \ | |
| -run '${{ steps.shard.outputs.pattern }}' \ | |
| ./provider/ | |
| # Gate job for branch protection — succeeds only when all shards pass | |
| test-summary: | |
| name: "Matrix Test (1.13.*)" | |
| needs: test | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| if: always() | |
| steps: | |
| - name: Check shard results | |
| run: | | |
| if [ "${{ needs.test.result }}" != "success" ]; then | |
| echo "Test shards failed: ${{ needs.test.result }}" | |
| exit 1 | |
| fi | |
| echo "All test shards passed." |