-
Notifications
You must be signed in to change notification settings - Fork 246
76 lines (73 loc) · 2.04 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
# Maintained in https://github.com/coreos/repo-templates
# Do not edit downstream.
name: Go
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
# don't waste job slots on superseded code
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test
strategy:
matrix:
go-version: [1.20.x, 1.21.x]
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Check out repository
uses: actions/checkout@v3
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install libblkid-dev
- name: Check modules
run: go mod verify
- name: Build
run: ./build
- name: Test
run: ./test
- name: Run linter
uses: golangci/golangci-lint-action@v3
with:
version: v1.52.2
args: -E=gofmt --timeout=30m0s
regenerate:
name: Regenerate
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: 1.21.x
- name: Install schematyper
run: |
# "go install github.com/idubinskiy/schematyper:latest" fails with
# current Go. Use fix from fork. We can't "go install" directly from
# the fork; it complains about mismatched package paths.
# https://github.com/idubinskiy/schematyper/pull/22
git clone -b gomod https://github.com/bgilbert/schematyper
cd schematyper
go install .
- name: Regenerate
run: ./generate
- name: Check whether generated output is current
run: |
if [ -n "$(git status --porcelain config docs)" ]; then
echo "Found local changes after regenerating:"
git --no-pager diff --color=always config docs
echo "Rerun './generate'."
exit 1
fi