logfire_slo: seed the generated burn-rate alerts' channels at creation #231
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
| # Terraform Provider testing workflow. | |
| name: Tests | |
| # This GitHub action runs your tests for each pull request and push. | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| paths-ignore: | |
| - 'README.md' | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - 'README.md' | |
| # Testing only needs permissions to read the repository contents. | |
| permissions: | |
| contents: read | |
| jobs: | |
| # Ensure project builds before running testing matrix | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version-file: 'go.mod' | |
| cache: true | |
| - run: go mod download | |
| - run: go build -v . | |
| - name: Run linters | |
| uses: golangci/golangci-lint-action@82606bf257cbaff209d206a39f5134f0cfbfd2ee # v9.2.1 | |
| with: | |
| version: latest | |
| generate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version-file: 'go.mod' | |
| cache: true | |
| # We need the latest version of Terraform for our documentation generation to use | |
| - uses: hashicorp/setup-terraform@dfe3c3f87815947d99a8997f908cb6525fc44e9e # v4.0.1 | |
| with: | |
| terraform_wrapper: false | |
| - run: make generate | |
| - name: git diff | |
| run: | | |
| git diff --compact-summary --exit-code || \ | |
| (echo; echo "Unexpected difference in directories after code generation. Run 'make generate' command and commit."; exit 1) | |
| # Run acceptance tests in a matrix with Terraform CLI versions | |
| test: | |
| # Only run acceptance tests for PRs from the same repo (skips forked PRs) | |
| if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }} | |
| name: Terraform Provider Acceptance Tests | |
| needs: build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| strategy: | |
| max-parallel: 1 | |
| fail-fast: false | |
| matrix: | |
| terraform: | |
| - '1.8.*' | |
| - '1.14.*' | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version-file: 'go.mod' | |
| cache: true | |
| - uses: hashicorp/setup-terraform@dfe3c3f87815947d99a8997f908cb6525fc44e9e # v4.0.1 | |
| with: | |
| terraform_version: ${{ matrix.terraform }} | |
| terraform_wrapper: false | |
| - run: go mod download | |
| - name: Check if secrets are available | |
| id: check-secrets | |
| run: | | |
| if [[ -z "${{ secrets.LOGFIRE_API_KEY }}" ]]; then | |
| echo "skip_tests=true" >> $GITHUB_OUTPUT | |
| echo "LOGFIRE_API_KEY secret not available, skipping acceptance tests" | |
| else | |
| echo "skip_tests=false" >> $GITHUB_OUTPUT | |
| echo "LOGFIRE_API_KEY secret available, running acceptance tests" | |
| fi | |
| - name: Run acceptance tests | |
| if: steps.check-secrets.outputs.skip_tests == 'false' | |
| env: | |
| TF_ACC: "1" | |
| LOGFIRE_API_KEY: ${{ secrets.LOGFIRE_API_KEY }} | |
| LOGFIRE_EXPECTED_ORG: "terraform-provider-logfire" | |
| run: go test -v -cover ./internal/provider/ | |
| timeout-minutes: 10 | |
| - name: Skip acceptance tests | |
| if: steps.check-secrets.outputs.skip_tests == 'true' | |
| run: echo "Skipping acceptance tests - LOGFIRE_API_KEY secret not available" |