Harden CI, release, and acceptance test safety

This commit is contained in:
beatz174-bit
2026-05-12 15:12:44 +10:00
parent 878a472005
commit 1980d1f08a
7 changed files with 159 additions and 382 deletions
+22 -8
View File
@@ -2,6 +2,7 @@ name: ci
on:
push:
branches: [main]
pull_request:
jobs:
@@ -16,14 +17,27 @@ jobs:
with:
go-version-file: go.mod
- name: Verify formatting and run quality gate
run: ./scripts/check.sh
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
- name: Build provider binary (stamped metadata)
- name: Verify go mod tidy is clean
run: |
VERSION="${GITHUB_REF_NAME:-dev}"
COMMIT="$(git rev-parse --short HEAD)"
DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
go mod tidy
git diff --exit-code go.mod go.sum
go build -o terraform-provider-dynu \
-ldflags="-X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${DATE}"
- name: Verify gofmt
run: |
files="$(git ls-files '*.go')"
test -z "$(gofmt -l ${files})"
- name: Go vet
run: go vet ./...
- name: Go tests
run: go test ./...
- name: Terraform fmt check
run: terraform fmt -check -recursive examples
- name: Repository quality gate
run: ./scripts/check.sh
+32
View File
@@ -0,0 +1,32 @@
name: release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: '~> v2'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}