-
Notifications
You must be signed in to change notification settings - Fork 1
83 lines (76 loc) · 2.34 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
name: Build
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
schedule:
- cron: '0 10 * * 1' # run "At 10:00 on Monday"
permissions:
contents: read
env:
GOPRIVATE: github.com/upsun/lib-sun
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.22'
check-latest: true
- name: Run config private repo
env:
TOKEN: ${{ secrets.MICK_GITHUB_TOKEN }}
run: git config --global url."https://user:${TOKEN}@github.com".insteadOf https://github.com
- name: Run Go Format
run: gofmt -s -w . && git diff --exit-code
- name: Run Go Tidy
run: go mod tidy && git diff --exit-code
- name: Run Go Vet
run: go vet ./...
- name: Run Go Mod
run: go mod download
- name: Run Go Mod Verify
run: go mod verify
- uses: golangci/golangci-lint-action@v6
with:
version: latest
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- name: Run config private repo
env:
TOKEN: ${{ secrets.MICK_GITHUB_TOKEN }}
run: git config --global url."https://user:${TOKEN}@github.com".insteadOf https://github.com
- name: Run tests
run: go test -v -count=1 -race -shuffle=on -coverprofile=coverage.txt ./...
- name: Go Benchmark
run: go test -v -shuffle=on -run=- -bench=. -benchtime=1x ./...
- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest
# - name: Run govulncheck
# run: govulncheck -test ./...
# - name: Upload Coverage
# uses: codecov/codecov-action@v3
# continue-on-error: true # we don't care if it fails
# with:
# token: ${{secrets.CODECOV_TOKEN}} # set in repository settings
# file: ./coverage.txt # file from the previous step
# fail_ci_if_error: false
build:
needs: [test, lint]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Run config private repo
env:
TOKEN: ${{ secrets.MICK_GITHUB_TOKEN }}
run: git config --global url."https://user:${TOKEN}@github.com".insteadOf https://github.com
- name: Build
run: go build -o /dev/null -v ./...