Skip to content

Bump hashicorp/setup-terraform from 4.0.0 to 4.0.1 #87

Bump hashicorp/setup-terraform from 4.0.0 to 4.0.1

Bump hashicorp/setup-terraform from 4.0.0 to 4.0.1 #87

Workflow file for this run

# Terraform Provider CI workflow.
name: CI
on:
pull_request:
paths:
- '**.go'
- 'go.mod'
- 'go.sum'
- '.golangci.yml'
- '.github/workflows/ci.yml'
- '.goreleaser.yml'
- 'examples/**'
push:
paths:
- '**.go'
- 'go.mod'
- 'go.sum'
- '.golangci.yml'
- '.github/workflows/ci.yml'
- '.goreleaser.yml'
- 'examples/**'
permissions:
contents: read
jobs:
govulncheck:
name: Vulnerability Check
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- id: govulncheck
uses: golang/govulncheck-action@31f7c5463448f83528bd771c2d978d940080c9fd # master, uses checkout@v6.0.2 + setup-go@v6.2.0
with:
cache: false
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 -o terraform-provider-ona .
- name: Run linters
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
with:
version: v2.11.4
test:
name: Unit Tests
needs: 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 test -v -cover ./...
integration:
name: Integration Test (Terraform ${{ matrix.terraform }})
needs:
- build
- govulncheck
runs-on: ubuntu-latest
timeout-minutes: 10
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
strategy:
max-parallel: 1
matrix:
terraform:
- '1.7.*'
- '1.14.*'
env:
GITPOD_API_KEY: ${{ secrets.GITPOD_API_KEY }}
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
- name: Build provider
run: go build -o terraform-provider-ona .
- name: Setup dev overrides
run: |
cat > ~/.terraformrc << EOF
provider_installation {
dev_overrides {
"combor/ona" = "${{ github.workspace }}"
}
direct {}
}
EOF
- name: Clean up stale runners
working-directory: examples/cleanup
run: |
terraform apply -auto-approve \
-var="runner_manager_id=${{ secrets.RUNNER_MANAGER_ID }}"
terraform destroy -auto-approve \
-var="runner_manager_id=${{ secrets.RUNNER_MANAGER_ID }}"
- name: Terraform Apply
working-directory: examples
run: |
terraform apply -auto-approve \
-var="runner_name=tf-ci-${{ github.run_id }}" \
-var="runner_provider_type=RUNNER_PROVIDER_MANAGED" \
-var="runner_manager_id=${{ secrets.RUNNER_MANAGER_ID }}" \
-var="runner_region=eu-central-1" \
-var="project_name=tf-ci-proj-${{ github.run_id }}"
- name: Terraform Destroy
if: always()
working-directory: examples
run: |
terraform destroy -auto-approve \
-var="runner_name=tf-ci-${{ github.run_id }}" \
-var="runner_provider_type=RUNNER_PROVIDER_MANAGED" \
-var="runner_manager_id=${{ secrets.RUNNER_MANAGER_ID }}" \
-var="runner_region=eu-central-1" \
-var="project_name=tf-ci-proj-${{ github.run_id }}"
release:
name: Release
needs:
- test
- integration
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
environment: release
permissions:
contents: write
id-token: write
attestations: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
# Allow goreleaser to access older tag information.
fetch-depth: 0
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: 'go.mod'
cache: false
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7.0.0
id: import_gpg
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@1a80836c5c9d9e5755a25cb59ec6f45a3b5f41a8 # v7.2.1
with:
version: v2.15.2
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
- name: Attest build provenance
uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32 # v4.1.0
with:
subject-path: 'dist/*.zip,dist/*_SHA256SUMS,dist/*_SHA256SUMS.sig'