Skip to content

feat: standardize acceptance tests, clean up docs, and implement test workflows #2

feat: standardize acceptance tests, clean up docs, and implement test workflows

feat: standardize acceptance tests, clean up docs, and implement test workflows #2

Workflow file for this run

# Terraform Provider testing workflow.
name: Tests
# This GitHub action runs your tests for each pull request and push.
# Optionally, you can turn it on using a schedule for regular testing.
on:
pull_request:
paths:
- "main.go"
- "forwardemail/**.go"
- "go.mod"
- "go.sum"
- ".github/workflows/test.yml"
push:
branches:
- main
permissions:
contents: read
jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version-file: 'go.mod'
cache: true
- run: go mod tidy
- run: go mod download
- run: go build -v .
docs:
name: Docs Test
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
id: go
- name: Install Task
uses: arduino/setup-task@v2
with:
version: "3.x"
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_wrapper: false
- name: Check if docs are up-to-date
run: |
task docs
git diff
BADDOCS=$(git status --porcelain)
test -z "$BADDOCS" || (echo -e "documentation needs regenerating using task docs: $BADDOCS"; exit 1)
# Run acceptance tests in a matrix with Terraform CLI versions
test:
name: Terraform Provider Acceptance Tests
needs: build
runs-on: ubuntu-latest
concurrency:
group: test-${{ github.run_id }}
cancel-in-progress: false
timeout-minutes: 15
strategy:
fail-fast: false
max-parallel: 1
matrix:
terraform:
- '1.5.6'
- '1.6.0'
- '1.7.5'
- '1.8.2'
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version-file: 'go.mod'
cache: true
- name: Install Task
uses: arduino/setup-task@v2
with:
version: "3.x"
- name: Install Terraform
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- run: go mod download
- name: Run Acceptance Tests
env:
TF_ACC: "1"
FORWARDEMAIL_API_KEY: ${{ secrets.FORWARDEMAIL_API_KEY }}
run: go test -v ./forwardemail/...
timeout-minutes: 10
- name: Cleanup Dangling Resources
env:
TF_ACC: "1"
FORWARDEMAIL_API_KEY: ${{ secrets.FORWARDEMAIL_API_KEY }}
run: task sweep
timeout-minutes: 5