powerplatform_data_loss_prevention_policy added additional validation for default_action_rule_behavior and action_rules when both are empty #1660
This file contains 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: Terraform Provider Checks | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
# ensure go.mod and go.sum are updated | |
depscheck: | |
name: Check Dependencies | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | |
with: | |
egress-policy: audit | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Set up Go | |
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | |
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 | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | |
with: | |
egress-policy: audit | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Set up Go | |
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | |
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 | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | |
with: | |
egress-policy: audit | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Set up Go | |
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | |
with: | |
cache: true | |
go-version-file: 'go.mod' | |
id: go | |
- name: Get dependencies | |
run: | | |
go install github.com/golangci/golangci-lint/cmd/[email protected] | |
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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
with: | |
name: Test Coverage | |
path: coverage.cov.html | |
# ensure docs are generated | |
gencheck: | |
name: Check Generated Docs | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | |
with: | |
egress-policy: audit | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
fetch-depth: 2 | |
- name: Set up Go | |
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | |
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/ |