-
Notifications
You must be signed in to change notification settings - Fork 181
133 lines (116 loc) · 3.48 KB
/
ci.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
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
name: CI
on:
- push
- pull_request
env:
GO_VERSION: "oldstable"
GOTESTSUM_VERSION: "latest"
jobs:
lint:
name: Lint
runs-on: windows-2019
steps:
- name: Checkout
uses: actions/checkout@v4
with:
show-progress: false
- name: Install go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.53
args: >-
--verbose
--timeout=5m
--config=.golangci.yml
--max-issues-per-linter=0
--max-same-issues=0
--modules-download-mode=readonly
go-generate:
name: Go Generate
runs-on: windows-2019
steps:
- name: Checkout
uses: actions/checkout@v4
with:
show-progress: false
- name: Install go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
# don't really need to cache Go packages, since go generate doesn't require much.
# otherwise, the cache used in the `test` stage will be (basically) empty.
cache: false
- name: Run go generate
shell: pwsh
run: |
Write-Output "::group::go generate"
go generate -x ./...
Write-Output "::endgroup::"
if ($LASTEXITCODE -ne 0) {
Write-Output "::error title=Go Generate::Error running go generate."
exit $LASTEXITCODE
}
- name: Diff
shell: pwsh
run: |
git add -N .
Write-Output "::group::git diff"
git diff --stat --exit-code
Write-Output "::endgroup::"
if ($LASTEXITCODE -ne 0) {
Write-Output "::error ::Generated files are not up to date. Please run ``go generate ./...``."
exit $LASTEXITCODE
}
test:
name: Run Tests
needs:
- go-generate
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2019, windows-2022, ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
show-progress: false
- name: Install go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
# avoid needing to download packages during test runs
- name: Pre-fill Module Cache
run: go mod download -x
- name: Install gotestsum
run: go install gotest.tools/gotestsum@${{ env.GOTESTSUM_VERSION }}
- name: Test repo
run: gotestsum --format standard-verbose --debug -- -gcflags=all=-d=checkptr -race -v ./...
# !NOTE:
# Fuzzing cannot be run across multiple packages, (ie, `go -fuzz "^Fuzz" ./...` fails).
# If new fuzzing tests are added, exec additional runs for each package.
- name: Fuzz root package
run: gotestsum --format standard-verbose --debug -- -run "^#" -fuzztime 1m -fuzz "^Fuzz"
build:
name: Build Repo
needs:
- test
runs-on: "windows-2019"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
show-progress: false
- name: Install go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- run: go build ./pkg/etw/sample/
- run: go build ./tools/etw-provider-gen/
- run: go build ./tools/mkwinsyscall/
- run: go build ./wim/validate/