Debian Codegraph @

.github/workflows/ci.yaml

raw symbols SCIP
1 name: ci
2 on:
3 push:
4 branches:
5 - main
6 pull_request:
7 schedule:
8 - cron: '0 2 * * *' # Run every day, at 2AM UTC.
9 env:
10 GOPATH: ${{ github.workspace }}
11 WORKING_DIR: ./src/github.com/google/pprof/
12 jobs:
13 test-mac:
14 runs-on: ${{ matrix.os }}
15 defaults:
16 run:
17 working-directory: ${{ env.WORKING_DIR }}
18 strategy:
19 fail-fast: false
20 matrix:
21 go: ['1.24', '1.25', 'tip']
22 # Supported macOS versions can be found in
23 # https://github.com/actions/virtual-environments#available-environments.
24 os: ['macos-14', 'macos-15']
25 # Supported Xcode versions can be found in:
26 # - https://github.com/actions/virtual-environments/blob/main/images/macos/macos-14-Readme.md#xcode
27 # - https://github.com/actions/virtual-environments/blob/main/images/macos/macos-15-Readme.md#xcode
28 xcode-version: ['26.0', '16.4', '16.3', '16.2', '16.1', '16.0', '15.4', '15.3', '15.2', '15.1', '15.0.1']
29 exclude:
30 - os: 'macos-14'
31 xcode-version: '26.0'
32 - os: 'macos-14'
33 xcode-version: '16.4'
34 - os: 'macos-14'
35 xcode-version: '16.3'
36 - os: 'macos-14'
37 xcode-version: '16.0'
38 - os: 'macos-15'
39 xcode-version: '15.4'
40 - os: 'macos-15'
41 xcode-version: '15.3'
42 - os: 'macos-15'
43 xcode-version: '15.2'
44 - os: 'macos-15'
45 xcode-version: '15.1'
46 - os: 'macos-15'
47 xcode-version: '15.0.1'
48
49 steps:
50 - name: Checkout the repo
51 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
52 with:
53 path: ${{ env.WORKING_DIR }}
54
55 - name: Update Go version using setup-go
56 uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
57 if: matrix.go != 'tip'
58 with:
59 # Include cache directives to allow proper caching. Without them, we
60 # get setup-go "Restore cache failed" warnings.
61 go-version: ${{ matrix.go }}
62 cache: true
63 cache-dependency-path: '**/go.sum'
64
65 - name: Install Go bootstrap compiler
66 uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
67 if: matrix.go == 'tip'
68 with:
69 # Bootstrapping go tip requires 1.24
70 # Include cache directives to allow proper caching. Without them, we
71 # get setup-go "Restore cache failed" warnings.
72 go-version: 1.24
73 cache: true
74 cache-dependency-path: '**/go.sum'
75
76 - name: Update Go version manually
77 if: matrix.go == 'tip'
78 working-directory: ${{ github.workspace }}
79 run: |
80 git clone https://go.googlesource.com/go $HOME/gotip
81 cd $HOME/gotip/src
82 ./make.bash
83 echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV
84 echo "RUN_STATICCHECK=false" >> $GITHUB_ENV
85 echo "RUN_GOLANGCI_LINTER=false" >> $GITHUB_ENV
86 echo "$HOME/gotip/bin:$PATH" >> $GITHUB_PATH
87
88 - name: Set up Xcode
89 uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
90 with:
91 xcode-version: ${{ matrix.xcode-version }}
92
93 - name: Fetch dependencies
94 run: |
95 brew install graphviz
96 # Do not let tools interfere with the main module's go.mod.
97 cd && go mod init tools
98 go install honnef.co/go/tools/cmd/[email protected]
99 go install github.com/golangci/golangci-lint/v2/cmd/[email protected]
100 # Add PATH for installed tools.
101 echo "$GOPATH/bin:$PATH" >> $GITHUB_PATH
102
103 - name: Run the script
104 run: |
105 go version
106 ./test.sh
107
108 - name: Code coverage
109 uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
110 with:
111 files: ${{ env.WORKING_DIR }}/coverage.txt
112 fail_ci_if_error: true
113 token: ${{ secrets.CODECOV_TOKEN }}
114
115 test-linux:
116 runs-on: ${{ matrix.os }}
117 defaults:
118 run:
119 working-directory: ${{ env.WORKING_DIR }}
120 strategy:
121 fail-fast: false
122 matrix:
123 go: ['1.24', '1.25', 'tip']
124 os: ['ubuntu-24.04', 'ubuntu-22.04']
125 steps:
126 - name: Checkout the repo
127 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
128 with:
129 path: ${{ env.WORKING_DIR }}
130
131 - name: Update Go version using setup-go
132 uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
133 if: matrix.go != 'tip'
134 with:
135 # Include cache directives to allow proper caching. Without them, we
136 # get setup-go "Restore cache failed" warnings.
137 go-version: ${{ matrix.go }}
138 cache: true
139 cache-dependency-path: '**/go.sum'
140
141 - name: Install Go bootstrap compiler
142 uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
143 if: matrix.go == 'tip'
144 with:
145 # Bootstrapping go tip requires 1.24
146 # Include cache directives to allow proper caching. Without them, we
147 # get setup-go "Restore cache failed" warnings.
148 go-version: 1.24
149 cache: true
150 cache-dependency-path: '**/go.sum'
151
152 - name: Update Go version manually
153 if: matrix.go == 'tip'
154 working-directory: ${{ github.workspace }}
155 run: |
156 git clone https://go.googlesource.com/go $HOME/gotip
157 cd $HOME/gotip/src
158 ./make.bash
159 echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV
160 echo "RUN_STATICCHECK=false" >> $GITHUB_ENV
161 echo "RUN_GOLANGCI_LINTER=false" >> $GITHUB_ENV
162 echo "$HOME/gotip/bin" >> $GITHUB_PATH
163
164 - name: Check chrome for browser tests
165 run: |
166 google-chrome --version
167 which google-chrome
168
169 - name: Add LLVM 14.0 repository to ensure llvm-symbolizer 14.0.0+ on Ubuntu 20.04
170 if: matrix.os == 'ubuntu-20.04'
171 run: |
172 wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
173 sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main"
174 sudo apt-get update
175
176 - name: Install llvm-symbolizer
177 run: |
178 if [ "${{ matrix.os }}" = "ubuntu-20.04" ]; then
179 sudo apt-get install -y llvm-14 clang-14
180 sudo update-alternatives --install /usr/bin/llvm-symbolizer llvm-symbolizer /usr/bin/llvm-symbolizer-14 100
181 else
182 sudo apt-get update
183 sudo apt-get install -y llvm clang
184 fi
185
186 - name: Fetch dependencies
187 run: |
188 sudo apt-get install graphviz
189 # Do not let tools interfere with the main module's go.mod.
190 cd && go mod init tools
191 go install honnef.co/go/tools/cmd/[email protected]
192 go install github.com/golangci/golangci-lint/v2/cmd/[email protected]
193 # Add PATH for installed tools.
194 echo "$GOPATH/bin:$PATH" >> $GITHUB_PATH
195
196 - name: Check llvm-symbolizer installation
197 run: |
198 llvm-symbolizer --version
199
200 - name: Run the script
201 run: |
202 go version
203 ./test.sh
204
205 - name: Code coverage
206 uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
207 with:
208 files: ${{ env.WORKING_DIR }}/coverage.txt
209 fail_ci_if_error: true
210 token: ${{ secrets.CODECOV_TOKEN }}
211
212 test-windows:
213 runs-on: windows-2022
214 strategy:
215 fail-fast: false
216 matrix:
217 go: ['1.24', '1.25']
218 steps:
219 - name: Checkout the repo
220 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
221 with:
222 path: ${{ env.WORKING_DIR }}
223
224 - name: Update Go version using setup-go
225 uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
226 with:
227 # Include cache directives to allow proper caching. Without them, we
228 # get setup-go "Restore cache failed" warnings.
229 go-version: ${{ matrix.go }}
230 cache: true
231 cache-dependency-path: '**/go.sum'
232
233 - name: Fetch Windows dependency
234 uses: crazy-max/ghaction-chocolatey@2526f467ccbd337d307fe179959cabbeca0bc8c0 # v3.4.0
235 with:
236 args: install graphviz llvm
237
238 - name: Run the test
239 run: |
240 go version
241 # This is a workaround to make graphviz installed through choco work.
242 # It generates a config file to tell dot what layout engine and
243 # format types are available. See
244 # https://github.com/google/pprof/issues/585 for more details.
245 dot -c
246 go env
247 go build github.com/google/pprof
248 go test -v ./...
249 working-directory: ${{ env.WORKING_DIR }}
250
251 check:
252 if: always()
253 runs-on: ubuntu-latest
254 needs:
255 - test-mac
256 - test-linux
257 - test-windows
258 steps:
259 - name: Decide whether the needed jobs succeeded or failed
260 uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
261 with:
262 jobs: ${{ toJSON(needs) }}