Skip to content

Commit ae75162

Browse files
Fix: fix cicd builds
CiCd setup is broken due to the actions failing to build the project. Fix via switching building to the script.
1 parent b319ccc commit ae75162

File tree

9 files changed

+298
-57
lines changed

9 files changed

+298
-57
lines changed

.github/path_filters.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ build: &build
1818
- kahawai.json
1919
- meson.build
2020
- meson_options.txt
21+
- .github/workflows/ubuntu_build.yml
2122
- VERSION
2223

2324
windows_gtest: &windows_gtest
@@ -75,6 +76,7 @@ msys2_build: &msys2_build
7576

7677
afxdp_build: &afxdp_build
7778
- .github/workflows/afxdp_build.yml
79+
- script/build_ebpf_xdp.sh
7880
- *src
7981
- *build
8082

.github/scripts/setup_environment.sh

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
#!/bin/bash
2+
3+
# SPDX-License-Identifier: BSD-3-Clause
4+
# Copyright 2025 Intel Corporation
5+
6+
set -xe
7+
8+
# SET DEFAULT ARGUMENTS
9+
: "${SETUP_ENVIRONMENT:=1}"
10+
: "${BUILD_AND_INSTALL_DPDK:=1}"
11+
: "${BUILD_AND_INSTALL_ICE_DRIVER:=1}"
12+
: "${BUILD_AND_INSTALL_EBPF_XDP:=1}"
13+
14+
# CICD ONLY ARGUMENTS
15+
: "${BUILD_ICE_DRIVER:=0}"
16+
17+
function ubuntu_install_dependencies() {
18+
echo "1.1. Install the build dependency from OS software store"
19+
20+
# Mtl library dependencies
21+
apt-get update
22+
apt-get install -y \
23+
git \
24+
gcc \
25+
meson \
26+
python3 \
27+
python3-pip \
28+
pkg-config \
29+
libnuma-dev \
30+
libjson-c-dev \
31+
libpcap-dev \
32+
libgtest-dev \
33+
libssl-dev \
34+
systemtap-sdt-dev \
35+
llvm \
36+
clang \
37+
libsdl2-dev \
38+
libsdl2-ttf-dev
39+
40+
# CiCd only
41+
{
42+
apt install -y python3-venv sudo wget doxygen
43+
python3 -m venv /tmp/mtl-venv
44+
# As this is CICD only we can ignore shellcheck
45+
# shellcheck disable=SC1091
46+
. /tmp/mtl-venv/bin/activate
47+
git config --global user.email "[email protected]"
48+
git config --global user.name "Your Name"
49+
}
50+
# CiCd only end
51+
52+
pip install --upgrade pip
53+
pip install pyelftools ninja
54+
55+
# Ice driver dependencies
56+
sudo apt-get install -y "linux-headers-$(uname -r)"
57+
58+
# eBPF XDP dependencies
59+
sudo apt-get install -y \
60+
make \
61+
m4 \
62+
zlib1g-dev \
63+
libelf-dev \
64+
libcap-ng-dev \
65+
libcap2-bin \
66+
gcc-multilib
67+
# clang llvm
68+
}
69+
70+
if [ "$SETUP_ENVIRONMENT" == "1" ]; then
71+
echo "Environment setup."
72+
73+
if [ -f /etc/os-release ]; then
74+
# shellcheck disable=SC1091
75+
. /etc/os-release
76+
case "$ID" in
77+
ubuntu)
78+
echo "Detected OS: Ubuntu"
79+
ubuntu_install_dependencies
80+
;;
81+
centos)
82+
echo "Detected OS: CentOS"
83+
echo "For now unsuported OS, please use Ubuntu"
84+
exit 2
85+
;;
86+
rhel)
87+
echo "Detected OS: RHEL"
88+
echo "For now unsuported OS, please use Ubuntu"
89+
exit 2
90+
;;
91+
rockos|rocky)
92+
echo "Detected OS: Rocky Linux"
93+
echo "For now unsuported OS, please use Ubuntu"
94+
exit 2
95+
;;
96+
*)
97+
echo "OS not recognized: $ID"
98+
echo "For now unsuported OS, please use Ubuntu"
99+
exit 2
100+
;;
101+
esac
102+
else
103+
echo "/etc/os-release not found. Cannot determine OS."
104+
exit 2
105+
fi
106+
fi
107+
108+
if [ "${BUILD_AND_INSTALL_EBPF_XDP}" == "1" ]; then
109+
echo "1.2. Install the build dependency from OS software store"
110+
bash "$(dirname "$0")/../../script/build_ebpf_xdp.sh"
111+
fi
112+
113+
if [ "${BUILD_AND_INSTALL_DPDK}" == "1" ]; then
114+
echo "2. DPDK build and install"
115+
bash "$(dirname "$0")/../../script/build_dpdk.sh"
116+
fi
117+
118+
if [ "${BUILD_ICE_DRIVER}" == "1" ]; then
119+
echo "3. ICE driver build"
120+
# shellcheck disable=SC1091
121+
. "$(dirname "$0")/../../script/build_ice_driver.sh"
122+
if [ -z "$script_folder" ] || [ -z "$ice_driver_ver" ] || [ -z "$download_mirror" ]; then
123+
exit 3
124+
fi
125+
cd "${script_folder}"
126+
127+
echo "Building e810 driver version: $ice_driver_ver form mirror $download_mirror"
128+
129+
wget "https://downloadmirror.intel.com/${download_mirror}/ice-${ice_driver_ver}.tar.gz"
130+
tar xvzf ice-1.16.3.tar.gz
131+
cd ice-1.16.3
132+
133+
git init
134+
git add .
135+
git commit -m "init version ${ice_driver_ver}"
136+
git am ../../patches/ice_drv/"${ice_driver_ver}"/*.patch
137+
138+
cd src
139+
make
140+
fi
141+
142+
if [ "${BUILD_AND_INSTALL_ICE_DRIVER}" == "1" ]; then
143+
echo "3. ICE driver build and install"
144+
bash "$(dirname "$0")/../../script/build_ice_driver.sh"
145+
fi
146+
147+

.github/workflows/base_build.yml renamed to .github/workflows/ubuntu_build.yml

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Base Build
1+
name: Ubuntu build
22

33
on:
44
# allow manually trigger
@@ -14,26 +14,30 @@ on:
1414

1515
permissions:
1616
contents: read
17-
env:
18-
DPDK_VERSION: 25.03
17+
1918
jobs:
2019
changes:
2120
runs-on: ubuntu-latest
2221
permissions:
2322
pull-requests: read
2423
outputs:
25-
changed: ${{ steps.filter.outputs.ubuntu_build == 'true' }}
24+
base: ${{ steps.filter.outputs.ubuntu_build == 'true' }}
25+
afxdp_build: ${{ steps.filter.outputs.afxdp_build == 'true' }}
2626
steps:
2727
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28-
2928
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v2
3029
id: filter
3130
with:
3231
filters: .github/path_filters.yml
32+
env:
33+
SETUP_ENVIRONMENT: 0
34+
BUILD_AND_INSTALL_EBPF_XDP: 0
35+
BUILD_AND_INSTALL_DPDK: 0
36+
BUILD_ICE_DRIVER: 0 # Only for CICD action builds
37+
BUILD_AND_INSTALL_ICE_DRIVER: 0
3338

3439
build:
3540
needs: changes
36-
if: ${{ github.repository == 'OpenVisualCloud/Media-Transport-Library' && needs.changes.outputs.changed == 'true' }}
3741
runs-on: ${{ matrix.os }}
3842
timeout-minutes: 60
3943
container:
@@ -45,42 +49,36 @@ jobs:
4549
steps:
4650
- name: Harden Runner
4751
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
52+
uses: actions/checkout@v4
4853
with:
4954
egress-policy: audit
5055

51-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
52-
- uses: DoozyX/[email protected]
53-
with:
54-
clangFormatVersion: '14'
55-
source: '.'
56-
extensions: 'hpp,h,cpp,c,cc'
57-
58-
- name: checkout dpdk repo
59-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
60-
with:
61-
repository: 'DPDK/dpdk'
62-
ref: v${{ env.DPDK_VERSION }}
63-
path: dpdk
56+
- name: "Setup: install OS build dependencies"
57+
if: ${{ github.repository == 'OpenVisualCloud/Media-Transport-Library' && needs.changes.outputs.base == 'true' }}
58+
env:
59+
SETUP_ENVIRONMENT: 1
60+
run: |
61+
.github/scripts/setup_environment.sh
6462
65-
- name: Install the build dependency
63+
- name: "Setup: install eBPF XDP"
64+
if: ${{ github.repository == 'OpenVisualCloud/Media-Transport-Library' && needs.changes.outputs.afxdp_build == 'true' }}
65+
env:
66+
BUILD_AND_INSTALL_EBPF_XDP: 1
6667
run: |
67-
apt-get update -y
68-
apt-get install -y sudo git gcc meson python3 python3-pyelftools pkg-config libnuma-dev libjson-c-dev libpcap-dev libgtest-dev libsdl2-dev libsdl2-ttf-dev libssl-dev systemtap-sdt-dev llvm clang
69-
apt-get install -y doxygen
70-
apt-get install -y make m4 clang llvm zlib1g-dev libelf-dev libcap-ng-dev libcap2-bin gcc-multilib
68+
.github/scripts/setup_environment.sh
69+
continue-on-error: true
7170

72-
- name: Build DPDK from source
73-
working-directory: dpdk
71+
- name: "Setup: install DPDK"
72+
env:
73+
BUILD_AND_INSTALL_DPDK: 1
7474
run: |
75-
meson build
76-
ninja -C build
77-
cd build
78-
sudo ninja install
79-
- name: Git config
80-
working-directory: "${{ github.workspace }}"
75+
.github/scripts/setup_environment.sh
76+
77+
- name: "Setup: build ICE driver"
78+
env:
79+
BUILD_ICE_DRIVER: 1
8180
run: |
82-
git config --global user.email "[email protected]"
83-
git config --global user.name "Your Name"
81+
.github/scripts/setup_environment.sh
8482
8583
- name: Build
8684
working-directory: "${{ github.workspace }}"

.github/workflows/ubuntu_build_skip_gtest.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ jobs:
2525
changed: ${{ steps.filter.outputs.linux_gtest == 'true' }}
2626
steps:
2727
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28-
2928
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v2
3029
id: filter
3130
with:

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ mtl_system_status_*
8383
*.mp4
8484
*.pcm
8585
*.wav
86+
script/ice-*
87+
script/dpdk
88+
script/xdp-tools
8689

8790
#Generated documentation
8891
doc/_build
@@ -93,3 +96,4 @@ gpu_direct/tests/fff.h
9396
gpu_direct/subprojects/*
9497
!gpu_direct/subprojects/gtest.wrap
9598
_temp*
99+

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> [!TIP]
44
> [Full Documentation](https://openvisualcloud.github.io/Media-Transport-Library/README.html) for [Media Transport Library](https://openvisualcloud.github.io/Media-Transport-Library/README.html).
5-
[![Base build](https://github.com/OpenVisualCloud/Media-Transport-Library/actions/workflows/base_build.yml/badge.svg)](https://github.com/OpenVisualCloud/Media-Transport-Library/actions/workflows/base_build.yml)
5+
[![Ubuntu build](https://github.com/OpenVisualCloud/Media-Transport-Library/actions/workflows/ubuntu_build.yml/badge.svg)](https://github.com/OpenVisualCloud/Media-Transport-Library/actions/workflows/ubuntu_build.yml)
66
[![Test](https://github.com/OpenVisualCloud/Media-Transport-Library/actions/workflows/ubuntu_build_with_gtest.yml/badge.svg)](https://github.com/OpenVisualCloud/Media-Transport-Library/actions/workflows/ubuntu_build_with_gtest.yml)
77
[![OpenSSF
88
Scorecard](https://api.securityscorecards.dev/projects/github.com/OpenVisualCloud/Media-Transport-Library/badge)](https://api.securityscorecards.dev/projects/github.com/OpenVisualCloud/Media-Transport-Library)

script/build_dpdk.sh

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
set -e
77

8-
script_name=$(basename "$0")
9-
script_path=$(readlink -qe "$0")
8+
script_name=$(basename "${BASH_SOURCE[0]}")
9+
script_path=$(readlink -qe "${BASH_SOURCE[0]}")
1010
script_folder=${script_path/$script_name/}
1111
cd "${script_folder}"
1212

@@ -17,22 +17,26 @@ else
1717
dpdk_ver=25.03
1818
fi
1919

20-
echo "DPDK version: $dpdk_ver"
21-
22-
if [ ! -d "dpdk" ]; then
23-
# check out dpdk code
24-
echo "Clone DPDK source code"
25-
git clone https://github.com/DPDK/dpdk.git
26-
fi
27-
cd dpdk
28-
git checkout v"$dpdk_ver"
29-
git switch -c v"$dpdk_ver"
30-
31-
# apply the patches
32-
git am ../../patches/dpdk/"$dpdk_ver"/*.patch
33-
34-
# build and install dpdk now
35-
meson build
36-
ninja -C build
37-
cd build
38-
sudo ninja install
20+
(return 0 2>/dev/null) && sourced=1 || sourced=0
21+
22+
if [ "$sourced" -eq 0 ]; then
23+
echo "DPDK version: $dpdk_ver"
24+
25+
if [ ! -d "dpdk" ]; then
26+
# check out dpdk code
27+
echo "Clone DPDK source code"
28+
git clone https://github.com/DPDK/dpdk.git
29+
fi
30+
cd dpdk
31+
git checkout v"$dpdk_ver"
32+
git switch -c v"$dpdk_ver"
33+
34+
# apply the patches
35+
git am ../../patches/dpdk/"$dpdk_ver"/*.patch
36+
37+
# build and install dpdk now
38+
meson build
39+
ninja -C build
40+
cd build
41+
sudo ninja install
42+
fi

script/build_ebpf_xdp.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
# SPDX-License-Identifier: BSD-3-Clause
4+
# Copyright 2025 Intel Corporation
5+
6+
set -e
7+
8+
script_name=$(basename "${BASH_SOURCE[0]}")
9+
script_path=$(readlink -qe "${BASH_SOURCE[0]}")
10+
script_folder=${script_path/$script_name/}
11+
cd "${script_folder}"
12+
13+
(return 0 2>/dev/null) && sourced=1 || sourced=0
14+
15+
if [ "$sourced" -eq 0 ]; then
16+
cd "${script_folder}"
17+
18+
if [ ! -d "xdp-tools" ]; then
19+
echo "Clone XDP source code"
20+
git clone --recurse-submodules https://github.com/xdp-project/xdp-tools.git
21+
fi
22+
23+
cd xdp-tools
24+
./configure
25+
make
26+
sudo make install
27+
cd lib/libbpf/src
28+
make
29+
sudo make install
30+
fi

0 commit comments

Comments
 (0)