Skip to content

Commit 5c954aa

Browse files
committed
fix(ci): consolidate sanitizers/not sanitizers jobs
Signed-off-by: Luca Guerra <[email protected]>
1 parent 78491b4 commit 5c954aa

File tree

2 files changed

+125
-37
lines changed

2 files changed

+125
-37
lines changed

.github/workflows/ci.yml

+5-14
Original file line numberDiff line numberDiff line change
@@ -19,42 +19,33 @@ jobs:
1919
fetch-version:
2020
uses: ./.github/workflows/reusable_fetch_version.yaml
2121

22-
build-dev-packages-sanitizers-x86_64:
23-
needs: [fetch-version]
24-
uses: ./.github/workflows/reusable_build_packages.yaml
25-
with:
26-
arch: x86_64
27-
version: ${{ needs.fetch-version.outputs.version }}
28-
build_type: Debug
29-
sanitizers: true
30-
3122
build-dev-packages-x86_64:
3223
needs: [fetch-version]
3324
uses: ./.github/workflows/reusable_build_packages.yaml
3425
with:
3526
arch: x86_64
3627
version: ${{ needs.fetch-version.outputs.version }}
37-
build_type: Release
28+
enable_debug: true
29+
enable_sanitizers: true
3830

3931
build-dev-packages-arm64:
4032
needs: [fetch-version]
4133
uses: ./.github/workflows/reusable_build_packages.yaml
4234
with:
4335
arch: aarch64
4436
version: ${{ needs.fetch-version.outputs.version }}
45-
build_type: Debug
46-
sanitizers: false
37+
enable_debug: true
4738

4839
test-dev-packages:
49-
needs: [fetch-version, build-dev-packages-sanitizers-x86_64]
40+
needs: [fetch-version, build-dev-packages-x86_64]
5041
uses: ./.github/workflows/reusable_test_packages.yaml
5142
strategy:
5243
fail-fast: false
5344
matrix:
5445
static: ["static", ""]
5546
with:
5647
arch: x86_64
57-
sanitizers: true
48+
sanitizers: ${{ matrix.static != '' && false || true }}
5849
static: ${{ matrix.static != '' && true || false }}
5950
version: ${{ needs.fetch-version.outputs.version }}
6051

.github/workflows/reusable_build_packages.yaml

+120-23
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ on:
1010
description: The Falco version to use when building packages
1111
required: true
1212
type: string
13-
build_type:
14-
description: The build type
13+
enable_debug:
14+
description: Also create a debug build
1515
required: false
16-
type: string
17-
default: 'Release'
18-
sanitizers:
19-
description: enable sanitizer support
16+
type: boolean
17+
default: false
18+
enable_sanitizers:
19+
description: Also create a sanitizer build
2020
required: false
2121
type: boolean
2222
default: false
@@ -51,7 +51,7 @@ jobs:
5151
path: skeleton-build/skel_dir/bpf_probe.skel.h
5252
retention-days: 1
5353

54-
build-packages:
54+
build-packages-release:
5555
# See https://github.com/actions/runner/issues/409#issuecomment-1158849936
5656
runs-on: ${{ (inputs.arch == 'aarch64' && 'oracle-aarch64-4cpu-16gb') || 'ubuntu-latest' }}
5757
needs: [build-modern-bpf-skeleton]
@@ -78,14 +78,13 @@ jobs:
7878
# Jemalloc and ASAN don't play very well together.
7979
run: |
8080
cmake -B build -S . \
81-
-DCMAKE_BUILD_TYPE=${{ inputs.build_type }} \
81+
-DCMAKE_BUILD_TYPE=Release \
8282
-DUSE_BUNDLED_DEPS=On \
8383
-DFALCO_ETC_DIR=/etc/falco \
8484
-DMODERN_BPF_SKEL_DIR=/tmp \
8585
-DBUILD_DRIVER=Off \
8686
-DBUILD_BPF=Off \
87-
-DUSE_ASAN=${{ (inputs.sanitizers == true && inputs.arch == 'x86_64' && 'ON') || 'OFF' }} \
88-
-DUSE_JEMALLOC=${{ (inputs.sanitizers == true && inputs.arch == 'x86_64' && 'OFF') || 'ON' }} \
87+
-DUSE_JEMALLOC=ON \
8988
-DFALCO_VERSION=${{ inputs.version }}
9089
9190
- name: Build project
@@ -99,25 +98,123 @@ jobs:
9998
- name: Upload Falco tar.gz package
10099
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
101100
with:
102-
name: falco-${{ inputs.version }}-${{ inputs.arch }}${{ inputs.sanitizers == true && '-sanitizers' || '' }}.tar.gz
101+
name: falco-${{ inputs.version }}-${{ inputs.arch }}.tar.gz
103102
path: |
104103
${{ github.workspace }}/build/falco-*.tar.gz
105104
106105
- name: Upload Falco deb package
107106
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
108107
with:
109-
name: falco-${{ inputs.version }}-${{ inputs.arch }}${{ inputs.sanitizers == true && '-sanitizers' || '' }}.deb
108+
name: falco-${{ inputs.version }}-${{ inputs.arch }}.deb
110109
path: |
111110
${{ github.workspace }}/build/falco-*.deb
112111
113112
- name: Upload Falco rpm package
114113
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
115114
with:
116-
name: falco-${{ inputs.version }}-${{ inputs.arch }}${{ inputs.sanitizers == true && '-sanitizers' || '' }}.rpm
115+
name: falco-${{ inputs.version }}-${{ inputs.arch }}.rpm
117116
path: |
118-
${{ github.workspace }}/build/falco-*.rpm
117+
${{ github.workspace }}/build/falco-*.rpm
118+
119+
build-packages-debug:
120+
# See https://github.com/actions/runner/issues/409#issuecomment-1158849936
121+
runs-on: ${{ (inputs.arch == 'aarch64' && 'oracle-aarch64-4cpu-16gb') || 'ubuntu-latest' }}
122+
if: ${{ inputs.enable_debug == true }}
123+
needs: [build-modern-bpf-skeleton]
124+
steps:
125+
# Always install deps before invoking checkout action, to properly perform a full clone.
126+
- name: Install build deps
127+
run: |
128+
sudo apt update && sudo apt install -y --no-install-recommends ca-certificates cmake curl wget build-essential git pkg-config autoconf automake libtool libelf-dev m4 rpm
129+
130+
- name: Checkout
131+
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
132+
133+
- name: Download skeleton
134+
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
135+
with:
136+
name: bpf_probe_${{ inputs.arch }}.skel.h
137+
path: /tmp
138+
139+
- name: Install zig
140+
if: inputs.sanitizers == false
141+
uses: falcosecurity/libs/.github/actions/install-zig@master
142+
143+
- name: Prepare project
144+
run: |
145+
cmake -B build -S . \
146+
-DCMAKE_BUILD_TYPE=Debug \
147+
-DUSE_BUNDLED_DEPS=On \
148+
-DFALCO_ETC_DIR=/etc/falco \
149+
-DMODERN_BPF_SKEL_DIR=/tmp \
150+
-DBUILD_DRIVER=Off \
151+
-DBUILD_BPF=Off \
152+
-DUSE_JEMALLOC=On \
153+
-DFALCO_VERSION=${{ inputs.version }}
154+
155+
- name: Build project
156+
run: |
157+
cmake --build build --target falco -j6
158+
159+
- name: Build packages
160+
run: |
161+
cmake --build build --target package
162+
163+
- name: Upload Falco tar.gz package
164+
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
165+
with:
166+
name: falco-${{ inputs.version }}-${{ inputs.arch }}-debug.tar.gz
167+
path: |
168+
${{ github.workspace }}/build/falco-*.tar.gz
169+
170+
build-packages-sanitizers:
171+
# See https://github.com/actions/runner/issues/409#issuecomment-1158849936
172+
runs-on: ${{ (inputs.arch == 'aarch64' && 'oracle-aarch64-4cpu-16gb') || 'ubuntu-latest' }}
173+
if: ${{ inputs.enable_sanitizers == true }}
174+
needs: [build-modern-bpf-skeleton]
175+
steps:
176+
# Always install deps before invoking checkout action, to properly perform a full clone.
177+
- name: Install build deps
178+
run: |
179+
sudo apt update && sudo apt install -y --no-install-recommends ca-certificates cmake curl wget build-essential git pkg-config autoconf automake libtool libelf-dev m4 rpm
180+
181+
- name: Checkout
182+
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
183+
184+
- name: Download skeleton
185+
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
186+
with:
187+
name: bpf_probe_${{ inputs.arch }}.skel.h
188+
path: /tmp
189+
190+
- name: Prepare project
191+
run: |
192+
cmake -B build -S . \
193+
-DCMAKE_BUILD_TYPE=Debug \
194+
-DUSE_BUNDLED_DEPS=On \
195+
-DFALCO_ETC_DIR=/etc/falco \
196+
-DMODERN_BPF_SKEL_DIR=/tmp \
197+
-DBUILD_DRIVER=Off \
198+
-DBUILD_BPF=Off \
199+
-DUSE_JEMALLOC=Off \
200+
-DUSE_ASAN=On \
201+
-DFALCO_VERSION=${{ inputs.version }}
202+
203+
- name: Build project
204+
run: |
205+
cmake --build build --target falco -j6
206+
207+
- name: Build packages
208+
run: |
209+
cmake --build build --target package
210+
211+
- name: Upload Falco tar.gz package
212+
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
213+
with:
214+
name: falco-${{ inputs.version }}-${{ inputs.arch }}-sanitizers.tar.gz
215+
path: |
216+
${{ github.workspace }}/build/falco-*.tar.gz
119217
120-
121218
build-musl-package:
122219
# x86_64 only for now
123220
if: ${{ inputs.arch == 'x86_64' }}
@@ -141,7 +238,7 @@ jobs:
141238
- name: Prepare project
142239
run: |
143240
cmake -B build -S . \
144-
-DCMAKE_BUILD_TYPE=${{ inputs.build_type }} \
241+
-DCMAKE_BUILD_TYPE=Release \
145242
-DCPACK_GENERATOR=TGZ \
146243
-DBUILD_BPF=Off -DBUILD_DRIVER=Off \
147244
-DUSE_BUNDLED_DEPS=On -DBUILD_LIBSCAP_MODERN_BPF=ON -DMUSL_OPTIMIZED_BUILD=On -DFALCO_ETC_DIR=/etc/falco -DFALCO_VERSION=${{ inputs.version }}
@@ -192,7 +289,7 @@ jobs:
192289
-DBUILD_BPF=Off \
193290
-DBUILD_DRIVER=Off \
194291
-DBUILD_FALCO_MODERN_BPF=Off \
195-
-DCMAKE_BUILD_TYPE=${{ inputs.build_type }} \
292+
-DCMAKE_BUILD_TYPE=Release \
196293
-DUSE_BUNDLED_DEPS=On \
197294
-DFALCO_ETC_DIR=/etc/falco \
198295
-DBUILD_FALCO_UNIT_TESTS=On \
@@ -232,28 +329,28 @@ jobs:
232329
# NOTE: Backslash doesn't work as line continuation on Windows.
233330
- name: Prepare project
234331
run: |
235-
cmake -B build -S . -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DMINIMAL_BUILD=On -DUSE_BUNDLED_DEPS=On -DBUILD_FALCO_UNIT_TESTS=On -DFALCO_VERSION=${{ inputs.version }}
332+
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DMINIMAL_BUILD=On -DUSE_BUNDLED_DEPS=On -DBUILD_FALCO_UNIT_TESTS=On -DFALCO_VERSION=${{ inputs.version }}
236333
237334
- name: Build project
238335
run: |
239-
cmake --build build --target package --config ${{ inputs.build_type }}
336+
cmake --build build --target package --config Release
240337
241338
- name: Run unit Tests
242339
run: |
243-
build/unit_tests/${{ inputs.build_type }}/falco_unit_tests.exe
340+
build/unit_tests/Release/falco_unit_tests.exe
244341
245342
- name: Upload Falco win32 installer
246343
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
247344
with:
248-
name: falco-installer-${{ inputs.version }}-win32.exe
345+
name: falco-installer-Release-win32.exe
249346
path: build/falco-*.exe
250347

251348
- name: Upload Falco win32 package
252349
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
253350
with:
254-
name: falco-${{ inputs.version }}-win32.exe
351+
name: falco-Release-win32.exe
255352
path: |
256-
${{ github.workspace }}/build/userspace/falco/${{ inputs.build_type }}/falco.exe
353+
${{ github.workspace }}/build/userspace/falco/Release/falco.exe
257354
258355
build-macos-package:
259356
if: ${{ inputs.arch == 'x86_64' }}

0 commit comments

Comments
 (0)