Skip to content

CDPCP-11472 - Add support for compute cluster enabled environments #758

CDPCP-11472 - Add support for compute cluster enabled environments

CDPCP-11472 - Add support for compute cluster enabled environments #758

Workflow file for this run

name: Test
on:
pull_request:
branches: [ "main" ]
jobs:
check_commits:
name: 'Commit count check'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Get commit count
run: |
COMMIT_COUNT=$(git rev-list --count origin/${{ github.event.pull_request.base.ref }}..${{ github.event.pull_request.head.sha }})
echo "Commit count: $COMMIT_COUNT"
if [ "$COMMIT_COUNT" -ne 1 ]; then
echo "❌ Pull request contains more than one commit. Please squash your commits."
exit 1
fi
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
go-version: ['1.23', '1.24']
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version: ${{ matrix.go-version }}
cache: false
- name: Setup Terraform
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_version: '1.10.*'
terraform_wrapper: false
- name: Run linters
uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 # v6.5.0
with:
args: --timeout 3m
- name: Generate
run: make generate
- name: Confirm no diff
run: |
git diff --compact-summary --exit-code || \
(echo "*** Unexpected differences after code generation. Run 'make generate' and commit."; exit 1)
- name: Build
run: make build
lint:
name: 'Terraform Provider Quality Gate :: Code analysis'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version-file: 'go.mod'
- name: Run linters
uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 # v6.5.0
with:
args: --timeout 3m
test:
name: 'Terraform Provider Quality Gate :: Unit test on: OS: ${{ matrix.os }} / Go: ${{ matrix.go-version }}'
needs: lint
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- windows-latest
- ubuntu-latest
go-version: ['1.23', '1.24']
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version-file: 'go.mod'
- name: Run tests
run: |
go test -count=1 -parallel=4 -timeout 10m -json -v ./... 2>&1 | tee TestResults-${{ matrix.os }}_${{ matrix.go-version }}.log
- name: Upload test log
uses: actions/upload-artifact@v4
if: always()
with:
name: TestResults-${{ matrix.os }}_${{ matrix.go-version }}.log
path: TestResults-${{ matrix.os }}_${{ matrix.go-version }}.log
if-no-files-found: error
coverage:
name: 'Terraform Provider Quality Gate :: Unit test coverage.'
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version-file: 'go.mod'
- name: Go Coverage
uses: gwatts/go-coverage-action@v2.0.0
with:
coverage-threshold: 32.0
cover-pkg: ./...
ignore-pattern: |
/cdp-sdk-go/
/main.go$
deadcode:
name: 'Terraform Provider Quality Gate :: Dead code analysis'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version-file: 'go.mod'
- name: Run deadcode
run: go install golang.org/x/tools/cmd/deadcode@latest && sh ./deadcode-check.sh
check-docs:
runs-on: ubuntu-latest
name: 'Terraform Provider Quality Gate :: Documentation'
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
with:
go-version: 1.24
- name: Run documentation generation
run: |
make docs
- name: Check for changes in docs/
run: |
if git diff --exit-code docs; then
echo "No changes detected in docs/"
else
echo "Documentation is out of sync or invalid schema is present. Please run 'make docs' and commit the changes/fixes."
exit 1
fi