-
Notifications
You must be signed in to change notification settings - Fork 0
295 lines (288 loc) · 11.2 KB
/
build.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
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
name: CI
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened, labeled]
branches: ["**"]
workflow_call:
jobs:
lint:
name: Lint
if: ${{ github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.action != 'labeled') || (github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == 'publish-dev-test') }}
runs-on: ubuntu-24.04
strategy:
fail-fast: true
max-parallel: 2
matrix:
go: ["stable"]
steps:
- name: Install dependencies
run: sudo apt-get install -y llvm clang dwz cmake curl unzip
- name: Install Zydis
shell: bash
run: |
cd /tmp
git clone --depth 1 --branch v3.1.0 --recursive https://github.com/zyantific/zydis.git
cd zydis
rm -rf build
mkdir build
cd build
cmake -DZYDIS_BUILD_EXAMPLES=OFF ..
make -j$(nproc)
sudo make install
cd zycore
sudo make install
- name: Check out
uses: actions/checkout@v4
- name: Set up Go ${{matrix.go}}
uses: actions/setup-go@v5
with:
go-version: ${{matrix.go}}
check-latest: true
cache-dependency-path: |
go.sum
id: go
- name: Install gRPC dependencies
env:
PB_URL: "https://github.com/protocolbuffers/protobuf/releases/download/v24.4/"
PB_FILE: "protoc-24.4-linux-x86_64.zip"
INSTALL_DIR: "/usr/local"
run: |
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
curl -LO "$PB_URL/$PB_FILE"
sudo unzip "$PB_FILE" -d "$INSTALL_DIR" 'bin/*' 'include/*'
sudo chmod +xr "$INSTALL_DIR/bin/protoc"
sudo find "$INSTALL_DIR/include" -type d -exec chmod +x {} \;
sudo find "$INSTALL_DIR/include" -type f -exec chmod +r {} \;
rm "$PB_FILE"
- name: Linter
run: |
go version
make lint TARGET_ARCH=amd64
test:
name: Test
if: ${{ github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.action != 'labeled') || (github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == 'publish-dev-test') }}
strategy:
fail-fast: true
max-parallel: 2
matrix:
go: ["stable"]
# Tests fail on arm64, so we only run them on x86_64
os: ["ubuntu-24.04"]
runs-on: ${{ matrix.os }}
steps:
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends gcc make llvm clang-16 dwz cmake curl unzip
- name: Check out
uses: actions/checkout@v4
- name: Set up Go ${{matrix.go}}
uses: actions/setup-go@v5
with:
go-version: ${{matrix.go}}
check-latest: true
cache-dependency-path: |
go.sum
id: go
- name: Install gRPC dependencies
env:
PB_URL: "https://github.com/protocolbuffers/protobuf/releases/download/v24.4/"
PB_FILE: "protoc-24.4-linux-%arch%.zip"
INSTALL_DIR: "/usr/local"
run: |
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
ARCH=$(uname -m | sed 's/aarch64/aarch_64/')
PB_FILE=$(echo $PB_FILE | sed "s/%arch%/$ARCH/g")
curl -LO "$PB_URL/$PB_FILE"
sudo unzip "$PB_FILE" -d "$INSTALL_DIR" 'bin/*' 'include/*'
sudo chmod +xr "$INSTALL_DIR/bin/protoc"
sudo find "$INSTALL_DIR/include" -type d -exec chmod +x {} \;
sudo find "$INSTALL_DIR/include" -type f -exec chmod +r {} \;
rm "$PB_FILE"
- name: Build
run: |
echo $PATH
make
- name: Tests
run: |
make test
build-integration-test-binaries:
name: Build integration test binaries
if: ${{ github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.action != 'labeled') || (github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == 'publish-dev-test') }}
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get install -y llvm clang-16 dwz cmake curl unzip
- name: Install Zydis
shell: bash
run: |
cd /tmp
git clone --depth 1 --branch v3.1.0 --recursive https://github.com/zyantific/zydis.git
cd zydis
rm -rf build
mkdir build
cd build
cmake -DZYDIS_BUILD_EXAMPLES=OFF ..
make -j$(nproc)
sudo make install
cd zycore
sudo make install
- name: Prepare integration test binaries for qemu tests
run: |
make integration-test-binaries
- name: Upload integration test binaries
uses: actions/upload-artifact@v4
with:
name: integration-test-binaries
path: support/*.test
integration-tests:
name: Integration tests (kernel v${{ matrix.kernel-version }})
runs-on: ubuntu-24.04
needs: build-integration-test-binaries
if: ${{ github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.action != 'labeled') || (github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == 'publish-dev-test') }}
strategy:
matrix:
kernel-version: [ "4.19.314", "5.4.276", "5.10.217", "5.15.159", "6.1.91", "6.6.31", "6.8.10", "6.9.1" ]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install qemu-system-x86
go install github.com/florianl/[email protected]
sudo mv ~/go/bin/bluebox /usr/local/bin/.
- name: Fetch integration test binaries
uses: actions/download-artifact@v4
with: { name: integration-test-binaries }
- name: Fetch precompiled kernels
run: |
install -d ci-kernels
echo "FROM ghcr.io/cilium/ci-kernels:${{ matrix.kernel-version }}" | docker buildx build --quiet --pull --output="ci-kernels" -
mv ci-kernels/boot/ ci-kernels/${{ matrix.kernel-version }}/
- name: Test on kernel ${{ matrix.kernel-version }}
run: |
chmod a+rx *.test
support/run-tests.sh ${{ matrix.kernel-version }}
build:
env:
RELEASE_VERSION: ${{ (github.ref_name == 'main' && 'dev') || (github.event_name != 'pull_request' && github.ref_name) || github.head_ref }}
name: Build
needs: [ test, lint, integration-tests ]
if: ${{ github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.action != 'labeled') || (github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == 'publish-dev-test') }}
strategy:
fail-fast: true
max-parallel: 2
matrix:
go: ["stable"]
os: ["arm-4core-linux-ubuntu24.04", "ubuntu-24.04"]
runs-on: ${{ matrix.os }}
steps:
- name: Set version
run: echo "VERSION=${RELEASE_VERSION}+`echo ${GITHUB_SHA::7}`.${{ github.run_id }}" >> $GITHUB_ENV
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends gcc make llvm clang-16 dwz cmake curl unzip
- name: Install Zydis
shell: bash
run: |
cd /tmp
git clone --depth 1 --branch v3.1.0 --recursive https://github.com/zyantific/zydis.git
cd zydis
rm -rf build
mkdir build
cd build
cmake -DZYDIS_BUILD_EXAMPLES=OFF ..
make -j$(nproc)
sudo make install
cd zycore
sudo make install
- name: Check out
uses: actions/checkout@v4
- name: Set up Go ${{matrix.go}}
uses: actions/setup-go@v5
with:
go-version: ${{matrix.go}}
check-latest: true
cache-dependency-path: |
go.sum
id: go
- name: Install gRPC dependencies
env:
PB_URL: "https://github.com/protocolbuffers/protobuf/releases/download/v24.4/"
PB_FILE: "protoc-24.4-linux-%arch%.zip"
INSTALL_DIR: "/usr/local"
run: |
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
ARCH=$(uname -m | sed 's/aarch64/aarch_64/')
PB_FILE=$(echo $PB_FILE | sed "s/%arch%/$ARCH/g")
curl -LO "$PB_URL/$PB_FILE"
sudo unzip "$PB_FILE" -d "$INSTALL_DIR" 'bin/*' 'include/*'
sudo chmod +xr "$INSTALL_DIR/bin/protoc"
sudo find "$INSTALL_DIR/include" -type d -exec chmod +x {} \;
sudo find "$INSTALL_DIR/include" -type f -exec chmod +r {} \;
rm "$PB_FILE"
- name: Build
run: |
echo $PATH
make
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: agent-${{ matrix.os == 'arm-4core-linux-ubuntu24.04' && 'aarch64' || 'x86_64' }}
path: otel-profiling-agent
publish:
env:
RELEASE_VERSION: ${{ github.event_name == 'pull_request' && 'dev-test' || 'dev' }}
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'publish-dev-test') )}}
name: Publish pre-release
needs: [build]
runs-on: ubuntu-24.04
permissions:
contents: write
packages: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Create assets
run: |
tar czf otel-profiling-agent-${RELEASE_VERSION}-aarch64.tar.gz -C agent-aarch64 .
tar czf otel-profiling-agent-${RELEASE_VERSION}-x86_64.tar.gz -C agent-x86_64 .
sha256sum otel-profiling-agent-${RELEASE_VERSION}-aarch64.tar.gz otel-profiling-agent-${RELEASE_VERSION}-x86_64.tar.gz > sha256sums.txt
- name: Create or move previous dev tag
continue-on-error: true
uses: actions/github-script@v7
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ env.RELEASE_VERSION }}',
sha: context.sha
}).catch(err => {
if (err.status !== 422) throw err;
github.rest.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'tags/${{ env.RELEASE_VERSION }}',
sha: context.sha
})
});
- name: Create pre-release
uses: ncipollo/release-action@v1
with:
artifacts: "otel-profiling-agent-${{ env.RELEASE_VERSION }}-*.tar.gz,sha256sums.txt"
allowUpdates: true
removeArtifacts: true
omitBody: true
omitDraftDuringUpdate: true
prerelease: true
draft: false
tag: ${{ env.RELEASE_VERSION }}