- CI: run gofmt, go vet, and golangci-lint on PRs; full build on merge to main - Release: checkout go-unifi alongside provider, add manual dispatch trigger, make GPG signing optional Both workflows now checkout shadyeip/go-unifi to satisfy the replace directive in go.mod. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
80 lines
1.9 KiB
YAML
80 lines
1.9 KiB
YAML
---
|
|
name: ci
|
|
|
|
on:
|
|
pull_request: {}
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
# Runs on PRs: fast validation checks
|
|
validate:
|
|
if: github.event_name == 'pull_request'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout provider
|
|
uses: actions/checkout@v4
|
|
with:
|
|
path: terraform-provider-unifi
|
|
|
|
- name: Checkout go-unifi dependency
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: shadyeip/go-unifi
|
|
path: go-unifi
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: terraform-provider-unifi/go.mod
|
|
cache: true
|
|
check-latest: true
|
|
|
|
- name: Check formatting
|
|
working-directory: terraform-provider-unifi
|
|
run: |
|
|
unformatted=$(gofmt -l .)
|
|
if [ -n "$unformatted" ]; then
|
|
echo "::error::Files not formatted with gofmt:"
|
|
echo "$unformatted"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Vet
|
|
working-directory: terraform-provider-unifi
|
|
run: go vet ./...
|
|
|
|
- name: Lint
|
|
uses: golangci/golangci-lint-action@v6.5.2
|
|
with:
|
|
working-directory: terraform-provider-unifi
|
|
skip-pkg-cache: true
|
|
|
|
# Runs on merge to main: full build
|
|
build:
|
|
if: github.event_name == 'push'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout provider
|
|
uses: actions/checkout@v4
|
|
with:
|
|
path: terraform-provider-unifi
|
|
|
|
- name: Checkout go-unifi dependency
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: shadyeip/go-unifi
|
|
path: go-unifi
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: terraform-provider-unifi/go.mod
|
|
cache: true
|
|
check-latest: true
|
|
|
|
- name: Build
|
|
working-directory: terraform-provider-unifi
|
|
run: go build ./...
|