Create a new GitHub Actions workflow to submit a pull request for new controller versions.
79 lines
1.9 KiB
YAML
79 lines
1.9 KiB
YAML
---
|
|
on:
|
|
pull_request: {}
|
|
push:
|
|
branches:
|
|
- "main"
|
|
tags:
|
|
- "v*"
|
|
|
|
env:
|
|
GO_VERSION: "1.16"
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: "ubuntu-latest"
|
|
steps:
|
|
- uses: "actions/checkout@v3"
|
|
- uses: "actions/cache@v2"
|
|
with:
|
|
path: "~/go/pkg/mod"
|
|
key: "${{ runner.os }}-gomod-${{ hashFiles('**/go.sum') }}"
|
|
restore-keys: |
|
|
${{ runner.os }}-gomod-
|
|
|
|
- uses: "actions/setup-go@v2"
|
|
with:
|
|
go-version: "${{ env.GO_VERSION }}"
|
|
- run: "go build ./..."
|
|
|
|
generate:
|
|
needs: "build"
|
|
runs-on: "ubuntu-latest"
|
|
steps:
|
|
- uses: "actions/checkout@v3"
|
|
- uses: "actions/cache@v2"
|
|
with:
|
|
path: "~/go/pkg/mod"
|
|
key: "${{ runner.os }}-gomod-${{ hashFiles('**/go.sum') }}"
|
|
restore-keys: |
|
|
${{ runner.os }}-gomod-
|
|
|
|
- uses: "actions/setup-go@v2"
|
|
with:
|
|
go-version: "${{ env.GO_VERSION }}"
|
|
- run: "go install golang.org/x/tools/cmd/stringer"
|
|
|
|
- run: "go generate unifi/device.go"
|
|
- run: "git diff --compact-summary --exit-code"
|
|
|
|
lint:
|
|
runs-on: "ubuntu-latest"
|
|
steps:
|
|
- uses: "actions/checkout@v3"
|
|
- uses: "actions/cache@v2"
|
|
with:
|
|
path: "~/go/pkg/mod"
|
|
key: "${{ runner.os }}-gomod-${{ hashFiles('**/go.sum') }}"
|
|
|
|
- uses: "actions/setup-go@v2"
|
|
with:
|
|
go-version: "${{ env.GO_VERSION }}"
|
|
- run: "go get ./..."
|
|
- uses: "golangci/golangci-lint-action@v3"
|
|
|
|
test:
|
|
needs: "build"
|
|
runs-on: "ubuntu-latest"
|
|
steps:
|
|
- uses: "actions/checkout@v3"
|
|
- uses: "actions/cache@v2"
|
|
with:
|
|
path: "~/go/pkg/mod"
|
|
key: "${{ runner.os }}-gomod-${{ hashFiles('**/go.sum') }}"
|
|
|
|
- uses: "actions/setup-go@v2"
|
|
with:
|
|
go-version: "${{ env.GO_VERSION }}"
|
|
- run: "go test ./..."
|