--- 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 ./...