Skip to content

Fix acceptance test timeouts #3641

Fix acceptance test timeouts

Fix acceptance test timeouts #3641

name: Terraform Provider Checks
on:
pull_request:
push:
branches:
- main
permissions:
contents: read
jobs:
# ensure go.mod and go.sum are updated
depscheck:
name: Check Dependencies
runs-on: ubuntu-latest
permissions:
contents: read # Required for checkout
steps:
- name: Harden Runner
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit
- name: Check out code into the Go module directory
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Set up Go
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
with:
cache: true
go-version-file: 'go.mod'
id: go
- name: Run 'go mod tidy' and check for differences
run: |
go mod tidy
git diff --exit-code -- go.mod go.sum || \
(echo; echo "Unexpected difference in go.mod/go.sum files. Run 'go mod tidy' command or revert any go.mod/go.sum changes and commit."; exit 1)
# ensure the code builds
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read # Required for checkout
steps:
- name: Harden Runner
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit
- name: Check out code into the Go module directory
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Set up Go
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
with:
cache: true
go-version-file: 'go.mod'
id: go
- name: Get dependencies
run: |
go mod download
- name: Build
run: |
go build -v .
# run unit tests
unit_test:
name: Unit Test
needs: build
runs-on: ubuntu-latest
permissions:
contents: read # Required for checkout
steps:
- name: Harden Runner
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit
- name: Check out code into the Go module directory
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Set up Go
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
with:
cache: true
go-version-file: 'go.mod'
id: go
- name: Get dependencies
run: |
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.6
go mod download
- name: Run unit tests
run: |
go clean -testcache
go test -v ./... -run "^TestUnit" -coverprofile=coverage.out
go tool cover -html=coverage.out -o coverage.cov.html
- name: Upload Coverage Artifacts
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: Test Coverage
path: coverage.cov.html
# ensure docs are generated
gencheck:
name: Check Generated Docs
needs: build
runs-on: ubuntu-latest
permissions:
contents: read # Required for checkout
steps:
- name: Harden Runner
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit
- name: Check out code into the Go module directory
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 2
- name: Set up Go
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
with:
cache: true
go-version-file: 'go.mod'
id: go
- name: Generate docs and check for differences
run: |
go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
tfplugindocs generate --provider-name powerplatform --rendered-provider-name "Power Platform"
git diff HEAD --exit-code -- docs/