-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (40 loc) · 1.18 KB
/
Copy pathci.yml
File metadata and controls
51 lines (40 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# .github/workflows/ci.yml
#
# CI for spin: build, format check, mod tidy check, test, vet.
# Mirrors the local `task test` target.
name: ci
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Build
run: go build ./...
- name: Check formatting
run: test -z "$(go fmt ./...)" || (echo "Not formatted. Run go fmt ./... locally." && exit 1)
- name: Check go mod tidy
run: |
go mod tidy
test -z "$(git diff -- go.mod go.sum)" || (echo "go.mod/go.sum are stale. Run go mod tidy locally." && exit 1)
- name: Run tests
run: go test ./... -count=1
- name: Run go vet
run: go vet ./...
- name: Run staticcheck
run: |
go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck ./...
- name: Check install script
run: bash -n scripts/install.sh || (echo "install.sh syntax error" && exit 1)