-
-
Notifications
You must be signed in to change notification settings - Fork 239
151 lines (122 loc) · 3.08 KB
/
build.yaml
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: build
on:
workflow_dispatch:
pull_request:
branches:
- master
- v*
push:
branches:
- master
- v*
tags:
- v*
jobs:
build:
strategy:
matrix:
go: [1.19, 1.x]
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
name: Go ${{ matrix.go }} ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v4.0.1
with:
go-version: ${{ matrix.go }}
cache: true
- name: Build
run: go get -v ./...
- name: Run tests
run: go test ./...
examples:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
name: Examples ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v4.0.1
with:
go-version: 1.x
cache: true
- name: Build
run: cd _examples && go get -v .
- name: Run tests
run: cd _examples && go test
formatting:
runs-on: ubuntu-latest
name: Formatting
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.x
- name: Check root
uses: Jerome1337/gofmt-action@v1.0.5
with:
gofmt-path: .
gofmt-flags: '-s -l'
- name: Check e2e
uses: Jerome1337/gofmt-action@v1.0.5
with:
gofmt-path: e2e
gofmt-flags: '-s -l'
- name: Check examples
uses: Jerome1337/gofmt-action@v1.0.5
with:
gofmt-path: _examples
gofmt-flags: '-s -l'
linters:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: root
dir: .
- name: examples
dir: _examples
name: Linters for ${{ matrix.name }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v4.0.1
with:
go-version: 1.x
cache: false
- name: Run linters
uses: golangci/golangci-lint-action@v3
timeout-minutes: 20
with:
version: v1.51.2
working-directory: ${{ matrix.dir }}
args: --timeout=20m
coverage:
runs-on: ubuntu-latest
needs: [build, examples, formatting, linters]
name: Coverage
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v4.0.1
with:
go-version: 1.x
cache: true
- name: Run tests
run: go test -covermode=count -coverprofile=coverage.out -coverpkg=. ./...
- name: Prepare coverage report
uses: jandelgado/gcov2lcov-action@v1.0.9
- name: Send coverage report
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage.lcov