Skip to content

Commit 3853c26

Browse files
committed
ci(drivers_ci): use make through cmake
Avoid using directly `make` by replacing its invocations with `cmake` ones. Contextually, use the maximum level of parallelism with `--parallel $(nproc)`. Signed-off-by: Leonardo Di Giovanna <[email protected]>
1 parent 6960f8f commit 3853c26

File tree

1 file changed

+52
-26
lines changed

1 file changed

+52
-26
lines changed

.github/workflows/drivers_ci.yml

Lines changed: 52 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,18 @@ jobs:
7272
- name: Build scap-open and drivers 🏗️
7373
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
7474
run: |
75-
mkdir -p build
76-
cd build && cmake -DBUILD_WARNINGS_AS_ERRORS=On -DUSE_BUNDLED_DEPS=On -DBUILD_DRIVER=ON -DBUILD_LIBSCAP_MODERN_BPF=ON -DBUILD_BPF=On -DBUILD_LIBSCAP_GVISOR=${{ matrix.enable_gvisor }} -DCREATE_TEST_TARGETS=On -DENABLE_LIBSCAP_TESTS=On -DUSE_ASAN=On -DUSE_UBSAN=On ../
77-
make scap-open driver bpf libscap_test -j6
75+
cmake -B build -S . \
76+
-DBUILD_WARNINGS_AS_ERRORS=On \
77+
-DUSE_BUNDLED_DEPS=On \
78+
-DBUILD_DRIVER=ON \
79+
-DBUILD_LIBSCAP_MODERN_BPF=ON \
80+
-DBUILD_BPF=On \
81+
-DBUILD_LIBSCAP_GVISOR=${{ matrix.enable_gvisor }} \
82+
-DCREATE_TEST_TARGETS=On \
83+
-DENABLE_LIBSCAP_TESTS=On \
84+
-DUSE_ASAN=On \
85+
-DUSE_UBSAN=On
86+
cmake --build build --target scap-open driver bpf libscap_test --parallel $(nproc)
7887
7988
- name: Run scap-open with modern bpf 🏎️
8089
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
@@ -142,9 +151,15 @@ jobs:
142151
- name: Build drivers tests 🏗️
143152
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
144153
run: |
145-
mkdir -p build
146-
cd build && cmake -DBUILD_WARNINGS_AS_ERRORS=On -DUSE_BUNDLED_DEPS=ON -DENABLE_DRIVERS_TESTS=ON -DBUILD_LIBSCAP_MODERN_BPF=ON -DMODERN_BPF_DEBUG_MODE=ON -DBUILD_BPF=True -DBUILD_LIBSCAP_GVISOR=OFF ../
147-
make drivers_test driver bpf -j6
154+
cmake -B build -S . \
155+
-DBUILD_WARNINGS_AS_ERRORS=On \
156+
-DUSE_BUNDLED_DEPS=ON \
157+
-DENABLE_DRIVERS_TESTS=ON \
158+
-DBUILD_LIBSCAP_MODERN_BPF=ON \
159+
-DMODERN_BPF_DEBUG_MODE=ON \
160+
-DBUILD_BPF=True \
161+
-DBUILD_LIBSCAP_GVISOR=OFF
162+
cmake --build build --target drivers_test driver bpf --parallel $(nproc)
148163
149164
- name: Run drivers_test with modern bpf 🏎️
150165
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
@@ -186,14 +201,22 @@ jobs:
186201
envs: GIT_BRANCH,GITHUB_REPOSITORY,GITHUB_SERVER_URL
187202
command_timeout: 60m
188203
script: |
189-
sudo dnf install -y bpftool ca-certificates cmake make automake gcc gcc-c++ kernel-devel clang git pkg-config autoconf automake libbpf-devel
204+
sudo dnf install -y bpftool ca-certificates cmake make automake gcc gcc-c++ kernel-devel clang git pkg-config autoconf libbpf-devel
190205
# Remove, if present, any libs clone created by a previous job run.
191206
rm -rf libs
192207
git clone -b $GIT_BRANCH $GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git libs
193208
cd libs
194-
mkdir -p build
195-
cd build && cmake -DBUILD_WARNINGS_AS_ERRORS=On -DUSE_BUNDLED_DEPS=ON -DENABLE_DRIVERS_TESTS=ON -DBUILD_LIBSCAP_MODERN_BPF=ON -DMODERN_BPF_DEBUG_MODE=ON -DBUILD_BPF=True -DBUILD_LIBSCAP_GVISOR=OFF -DUSE_BUNDLED_LIBELF=OFF ../
196-
make drivers_test driver bpf -j6
209+
mkdir -p build && cd build
210+
cmake -B . -S .. \
211+
-DBUILD_WARNINGS_AS_ERRORS=On \
212+
-DUSE_BUNDLED_DEPS=ON \
213+
-DENABLE_DRIVERS_TESTS=ON \
214+
-DBUILD_LIBSCAP_MODERN_BPF=ON \
215+
-DMODERN_BPF_DEBUG_MODE=ON \
216+
-DBUILD_BPF=True \
217+
-DBUILD_LIBSCAP_GVISOR=OFF \
218+
-DUSE_BUNDLED_LIBELF=OFF
219+
cmake --build . --target drivers_test driver bpf --parallel $(nproc)
197220
sudo ./test/drivers/drivers_test -m
198221
rc_modern=$?
199222
sudo ./test/drivers/drivers_test -b
@@ -229,7 +252,14 @@ jobs:
229252
- name: Build drivers tests 🏗️
230253
if: needs.paths-filter.outputs.driver == 'true' || needs.paths-filter.outputs.libscap == 'true' || needs.paths-filter.outputs.libpman == 'true'
231254
run: |
232-
cmake -B build -S . -DBUILD_WARNINGS_AS_ERRORS=On -DUSE_BUNDLED_DEPS=ON -DENABLE_DRIVERS_TESTS=ON -DBUILD_LIBSCAP_MODERN_BPF=ON -DMODERN_BPF_DEBUG_MODE=ON -DBUILD_BPF=ON -DBUILD_LIBSCAP_GVISOR=OFF
255+
cmake -B build -S . \
256+
-DBUILD_WARNINGS_AS_ERRORS=On \
257+
-DUSE_BUNDLED_DEPS=ON \
258+
-DENABLE_DRIVERS_TESTS=ON \
259+
-DBUILD_LIBSCAP_MODERN_BPF=ON \
260+
-DMODERN_BPF_DEBUG_MODE=ON \
261+
-DBUILD_BPF=ON \
262+
-DBUILD_LIBSCAP_GVISOR=OFF
233263
cmake --build build --target drivers_test driver bpf --parallel $(nproc)
234264
235265
build-modern-bpf-skeleton:
@@ -242,16 +272,15 @@ jobs:
242272
# Always install deps before invoking checkout action, to properly perform a full clone.
243273
- name: Install build dependencies
244274
run: |
245-
dnf install -y bpftool ca-certificates cmake make automake gcc gcc-c++ kernel-devel clang git pkg-config autoconf automake libbpf-devel
275+
dnf install -y bpftool ca-certificates cmake make automake gcc gcc-c++ kernel-devel clang git pkg-config autoconf libbpf-devel
246276
247277
- name: Checkout
248278
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
249279

250280
- name: Build modern BPF skeleton
251281
run: |
252-
mkdir skeleton-build && cd skeleton-build
253-
cmake -DUSE_BUNDLED_DEPS=ON -DBUILD_LIBSCAP_MODERN_BPF=ON -DCREATE_TEST_TARGETS=Off ..
254-
make ProbeSkeleton -j6
282+
cmake -B skeleton-build -S . -DUSE_BUNDLED_DEPS=ON -DBUILD_LIBSCAP_MODERN_BPF=ON -DCREATE_TEST_TARGETS=Off
283+
cmake --build skeleton-build --target ProbeSkeleton --parallel $(nproc)
255284
256285
- name: Upload skeleton
257286
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
@@ -286,20 +315,17 @@ jobs:
286315

287316
- name: Prepare project
288317
run: |
289-
mkdir build && cd build
290-
cmake \
291-
-DCMAKE_BUILD_TYPE=Release \
292-
-DUSE_BUNDLED_DEPS=On \
293-
-DBUILD_LIBSCAP_MODERN_BPF=ON \
294-
-DMODERN_BPF_SKEL_DIR=/tmp \
295-
-DBUILD_DRIVER=Off \
296-
-DBUILD_BPF=Off \
297-
..
318+
cmake -B build -S . \
319+
-DCMAKE_BUILD_TYPE=Release \
320+
-DUSE_BUNDLED_DEPS=On \
321+
-DBUILD_LIBSCAP_MODERN_BPF=ON \
322+
-DMODERN_BPF_SKEL_DIR=/tmp \
323+
-DBUILD_DRIVER=Off \
324+
-DBUILD_BPF=Off
298325
299326
- name: Build project
300327
run: |
301-
cd build
302-
make scap-open -j6
328+
cmake --build build --target scap-open --parallel $(nproc)
303329
304330
# Only runs on pull request since on master branch it is already triggered by pages CI.
305331
kernel-tests-dev:

0 commit comments

Comments
 (0)