-
Notifications
You must be signed in to change notification settings - Fork 141
37 lines (34 loc) · 959 Bytes
/
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
name: Go
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.23"
- name: Check Formatting
run: |
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
gofmt -s -l .
echo "Please format Go code by running: go fmt ./..."
exit 1
fi
- name: Go import lint
run: |
go install golang.org/x/tools/cmd/goimports@latest
if [ "$(goimports -d . | wc -l)" -gt 0 ]; then
goimports -d .
echo "Please format Go code by running: goimports -w ./"
exit 1
fi
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./... -coverprofile=coverage.out -covermode=atomic
- name: Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}