Files
go-unifi/.github/workflows/ci.yaml
Joshua Spence ff2854e943 Implement Stringer interface for DeviceState (#49)
* Implement `Stringer` interface for `DeviceState`

If device adoption fails the error message isn't very readable at the moment.

```
Error: unexpected state '10', wanted target '2'.
```

* Use `stringer`
2021-09-24 13:55:12 +10:00

70 lines
1.6 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@v2"
- 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@v2"
- 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 get golang.org/x/tools/cmd/stringer"
- run: "go generate ./..."
- run: "git diff --compact-summary --exit-code"
lint:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "golangci/golangci-lint-action@v2"
test:
needs: "build"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- 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 ./..."