-
Notifications
You must be signed in to change notification settings - Fork 13
97 lines (79 loc) · 2.46 KB
/
go.yml
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
---
name: Go
on:
pull_request:
types:
- unlabeled # if GitHub Actions stuck, add and remove "not ready" label to force rebuild
- opened
- reopened
- synchronize
push:
branches:
- main
schedule:
- cron: "12 3 * * *"
env:
GOPATH: /home/runner/go
GOCACHE: /home/runner/go/cache
GOLANGCI_LINT_CACHE: /home/runner/go/cache/lint
GOMODCACHE: /home/runner/go/mod
GOPROXY: https://proxy.golang.org
GOTOOLCHAIN: local
jobs:
tests:
name: Tests
runs-on: ubuntu-22.04
timeout-minutes: 10
# Do not run this job in parallel for any PR change or branch push.
concurrency:
group: ${{ github.workflow }}-tests-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
if: github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'not ready')
steps:
# TODO https://github.com/FerretDB/github-actions/issues/211
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: FerretDB/github-actions/setup-go@main
with:
cache-key: tests
- name: Install Task
run: go generate -x
working-directory: tools
- name: Run init
run: bin/task init
- name: Run tests
run: bin/task test
env:
GOFLAGS: ${{ runner.debug == '1' && '-v' || '' }}
# we don't want them on CI
- name: Clean test and fuzz caches
if: always()
run: go clean -testcache -fuzzcache
- name: Check dirty
run: |
git status
git diff --exit-code
linters:
name: Linters
runs-on: ubuntu-22.04
timeout-minutes: 5
# Do not run this job in parallel for any PR change or branch push.
concurrency:
group: ${{ github.workflow }}-linters-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
if: github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'not ready')
steps:
# TODO https://github.com/FerretDB/github-actions/issues/211
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # for `golangci-lint run --new` to work
- name: Setup Go
uses: FerretDB/github-actions/setup-go@main
with:
cache-key: linters
- name: Run linters
uses: FerretDB/github-actions/linters@main
- name: Format and lint documentation
run: bin/task docs-fmt