-
Notifications
You must be signed in to change notification settings - Fork 617
204 lines (186 loc) · 6.77 KB
/
ci.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
name: ci
on:
push:
branches:
- main
pull_request:
schedule:
- cron: '0 2 * * *' # Run every day, at 2AM UTC.
env:
GOPATH: ${{ github.workspace }}
WORKING_DIR: ./src/github.com/google/pprof/
jobs:
test-mac:
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ${{ env.WORKING_DIR }}
strategy:
fail-fast: false
matrix:
go: ['1.19', '1.20', 'tip']
# Supported macOS versions can be found in
# https://github.com/actions/virtual-environments#available-environments.
os: ['macos-11', 'macos-12']
# Supported Xcode versions for macOS 11 can be found in
# https://github.com/actions/virtual-environments/blob/main/images/macos/macos-11-Readme.md#xcode
# Supported Xcode versions for macOS 12 can be found in
# https://github.com/actions/virtual-environments/blob/main/images/macos/macos-12-Readme.md#xcode
xcode-version: ['14.2', '14.1', '14.0.1', '13.4.1', '13.3.1', '13.2.1', '13.1', '13.0', '12.5.1', '12.4', '11.7']
exclude:
- os: 'macos-11'
xcode-version: '13.3.1'
- os: 'macos-11'
xcode-version: '13.4.1'
- os: 'macos-11'
xcode-version: '14.0.1'
- os: 'macos-11'
xcode-version: '14.1'
- os: 'macos-11'
xcode-version: '14.2'
- os: 'macos-12'
xcode-version: '11.7'
- os: 'macos-12'
xcode-version: '12.4'
- os: 'macos-12'
xcode-version: '12.5.1'
- os: 'macos-12'
xcode-version: '13.0'
steps:
- name: Update Go version using setup-go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
if: matrix.go != 'tip'
with:
go-version: ${{ matrix.go }}
- name: Update Go version manually
if: matrix.go == 'tip'
working-directory: ${{ github.workspace }}
run: |
git clone https://go.googlesource.com/go $HOME/gotip
cd $HOME/gotip/src
./make.bash
echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV
echo "RUN_STATICCHECK=false" >> $GITHUB_ENV
echo "RUN_GOLANGCI_LINTER=false" >> $GITHUB_ENV
echo "$HOME/gotip/bin:$PATH" >> $GITHUB_PATH
- name: Checkout the repo
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
path: ${{ env.WORKING_DIR }}
- name: Set up Xcode
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
with:
xcode-version: ${{ matrix.xcode-version }}
- name: Fetch dependencies
run: |
brew install graphviz
# Do not let tools interfere with the main module's go.mod.
cd && go mod init tools
# TODO: Update to a specific version when https://github.com/dominikh/go-tools/issues/1362 is fixed.
go install honnef.co/go/tools/cmd/staticcheck@master
go install github.com/golangci/golangci-lint/cmd/[email protected]
# Add PATH for installed tools.
echo "$GOPATH/bin:$PATH" >> $GITHUB_PATH
- name: Run the script
run: |
go version
./test.sh
- name: Code coverage
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
file: ${{ env.WORKING_DIR }}/coverage.txt
test-linux:
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ${{ env.WORKING_DIR }}
strategy:
fail-fast: false
matrix:
go: ['1.19', '1.20', 'tip']
os: ['ubuntu-22.04', 'ubuntu-20.04']
steps:
- name: Update Go version using setup-go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
if: matrix.go != 'tip'
with:
go-version: ${{ matrix.go }}
- name: Update Go version manually
if: matrix.go == 'tip'
working-directory: ${{ github.workspace }}
run: |
git clone https://go.googlesource.com/go $HOME/gotip
cd $HOME/gotip/src
./make.bash
echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV
echo "RUN_STATICCHECK=false" >> $GITHUB_ENV
echo "RUN_GOLANGCI_LINTER=false" >> $GITHUB_ENV
echo "$HOME/gotip/bin" >> $GITHUB_PATH
- name: Checkout the repo
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
path: ${{ env.WORKING_DIR }}
- name: Check chrome for browser tests
run: |
google-chrome --version
- name: Fetch dependencies
run: |
sudo apt-get install graphviz
# Do not let tools interfere with the main module's go.mod.
cd && go mod init tools
# TODO: Update to a specific version when https://github.com/dominikh/go-tools/issues/1362 is fixed.
go install honnef.co/go/tools/cmd/staticcheck@master
go install github.com/golangci/golangci-lint/cmd/[email protected]
# Add PATH for installed tools.
echo "$GOPATH/bin:$PATH" >> $GITHUB_PATH
- name: Run the script
run: |
go version
./test.sh
- name: Code coverage
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
file: ${{ env.WORKING_DIR }}/coverage.txt
test-windows:
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
go: ['1.19', '1.20']
steps:
- name: Update Go version using setup-go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: ${{ matrix.go }}
- name: Checkout the repo
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
path: ${{ env.WORKING_DIR }}
- name: Fetch Windows dependency
uses: crazy-max/ghaction-chocolatey@0e015857dd851f84fcb7fb53380eb5c4c8202333 # v3.0.0
with:
args: install graphviz llvm
- name: Run the test
run: |
go version
# This is a workaround to make graphviz installed through choco work.
# It generates a config file to tell dot what layout engine and
# format types are available. See
# https://github.com/google/pprof/issues/585 for more details.
dot -c
go env
go build github.com/google/pprof
go test -v ./...
working-directory: ${{ env.WORKING_DIR }}
check:
if: always()
runs-on: ubuntu-latest
needs:
- test-mac
- test-linux
- test-windows
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
with:
jobs: ${{ toJSON(needs) }}