-
Notifications
You must be signed in to change notification settings - Fork 16
192 lines (171 loc) · 7.22 KB
/
build_and_test.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
name: "Networking Recipe CI Pipeline"
on:
push:
branches:
- main
- ipdk_v*
pull_request:
branches:
- main
- ipdk_v*
concurrency:
# if workflow for PR or push is already running stop it, and start new one
group: build_and_test-${{ github.ref }}
cancel-in-progress: true
permissions: read-all
jobs:
build_and_stratum_ut_dpdk_target:
timeout-minutes: 100
runs-on: ubuntu-20.04
steps:
- name: 'Check Out p4-dpdk repo'
uses: actions/checkout@v3
with:
repository: p4lang/p4-dpdk-target
submodules: 'recursive'
path: p4sde
- name: 'Install dependencies'
working-directory: ./p4sde/tools/setup
run: |
sudo apt update -y
sudo apt install python python3-setuptools python3-pip python3-wheel python3-cffi sudo libssl-dev git zip libatomic1 libnl-route-3-dev curl tree -y
pip3 install distro
python3 install_dep.py
cmake --version
sudo apt-get purge cmake
sudo rm -rf /usr/local/bin/cmake || true
sudo rm -rf ~/.local/bin/cmake || true
# removing cmake 3.25 and reinstalling 3.20, as build is failing with cmake 3.25
wget https://cmake.org/files/v3.20/cmake-3.20.2-linux-x86_64.sh -O ${GITHUB_WORKSPACE}/cmake-3.20.2-linux-x86_64.sh
chmod a+x ${GITHUB_WORKSPACE}/cmake-3.20.2-linux-x86_64.sh
sudo mkdir -p /opt/rh/cmake
cd ${GITHUB_WORKSPACE} && sudo sh cmake-3.20.2-linux-x86_64.sh --prefix=/opt/rh/cmake --skip-license
sudo ln -s /opt/rh/cmake/bin/cmake /usr/local/bin/cmake
cmake --version
- name: 'Check Out Networking Recipe'
uses: actions/checkout@v3
with:
submodules: 'recursive'
path: ipdk.recipe
- name: 'Compile P4 dpdk target'
run: |
export SDE=${GITHUB_WORKSPACE}
mkdir install deps
export SDE_INSTALL=${GITHUB_WORKSPACE}/install
cd ${GITHUB_WORKSPACE}/p4sde
./autogen.sh
./configure --prefix=$SDE_INSTALL
make -j6
make install
- name: 'Build,Configure and Execute infrap4d dependencies'
run: |
cmake --version
cd ${GITHUB_WORKSPACE}/ipdk.recipe
export IPDK_RECIPE=`pwd`
cd $IPDK_RECIPE/setup
cmake -B build -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/deps
cmake --build build -j6
- name: 'Install bazel and run Stratum unit tests'
run: |
cd /tmp
curl -o bazel-4.2.3-installer-linux-x86_64.sh https://github.com/bazelbuild/bazel/releases/download/4.2.3/bazel-4.2.3-installer-linux-x86_64.sh
chmod +x bazel-4.2.3-installer-linux-x86_64.sh
./bazel-4.2.3-installer-linux-x86_64.sh --user
export PATH="$PATH:$HOME/bin"
cd ${GITHUB_WORKSPACE}/ipdk.recipe/stratum/stratum
export DPDK_INSTALL=${GITHUB_WORKSPACE}/install
echo "DPDK" > ${GITHUB_WORKSPACE}/install/share/TARGET
xargs -a ${GITHUB_WORKSPACE}/ipdk.recipe/.github/dpdk-tests.txt bazel test --define target=dpdk
cd bazel-testlogs/stratum
zip stratum_ut_logs.zip `find . -name test.xml -print`
- name: 'Upload stratum-ut-result artifact'
uses: actions/upload-artifact@v3
with:
name: stratum-ut-result
path: ipdk.recipe/stratum/stratum/bazel-testlogs/stratum/stratum_ut_logs.zip
- name: 'Execute dpdk target build'
run: |
cd ${GITHUB_WORKSPACE}/ipdk.recipe
export SDE_INSTALL=${GITHUB_WORKSPACE}/install
export DEPEND_INSTALL=${GITHUB_WORKSPACE}/deps
./make-all.sh --target=dpdk --prefix=${GITHUB_WORKSPACE}/dpdk-target
build_and_krnlmon_ut_dpdk_target:
timeout-minutes: 60
runs-on: ubuntu-20.04
steps:
- name: 'Check Out p4-dpdk repo'
uses: actions/checkout@v3
with:
repository: p4lang/p4-dpdk-target
submodules: 'recursive'
path: p4sde
- name: 'Install dependencies'
working-directory: ./p4sde/tools/setup
run: |
sudo apt update -y
sudo apt install python python3-setuptools python3-pip python3-wheel python3-cffi sudo libssl-dev git zip libatomic1 libnl-route-3-dev curl tree -y
pip3 install distro
python3 install_dep.py
cmake --version
sudo apt-get purge cmake
sudo rm -rf /usr/local/bin/cmake || true
sudo rm -rf ~/.local/bin/cmake || true
# removing cmake 3.25 and reinstalling 3.20, as build is failing with cmake 3.25
wget https://cmake.org/files/v3.20/cmake-3.20.2-linux-x86_64.sh -O ${GITHUB_WORKSPACE}/cmake-3.20.2-linux-x86_64.sh
chmod a+x ${GITHUB_WORKSPACE}/cmake-3.20.2-linux-x86_64.sh
sudo mkdir -p /opt/rh/cmake
cd ${GITHUB_WORKSPACE} && sudo sh cmake-3.20.2-linux-x86_64.sh --prefix=/opt/rh/cmake --skip-license
sudo ln -s /opt/rh/cmake/bin/cmake /usr/local/bin/cmake
cmake --version
- name: 'Check Out Networking Recipe'
uses: actions/checkout@v3
with:
submodules: 'recursive'
path: ipdk.recipe
- name: 'Compile P4 dpdk target'
run: |
export SDE=${GITHUB_WORKSPACE}
mkdir install deps
export SDE_INSTALL=${GITHUB_WORKSPACE}/install
cd ${GITHUB_WORKSPACE}/p4sde
./autogen.sh
./configure --prefix=$SDE_INSTALL
make -j6
make install
- name: 'Build,Configure and Execute infrap4d dependencies'
run: |
cmake --version
cd ${GITHUB_WORKSPACE}/ipdk.recipe
export IPDK_RECIPE=`pwd`
cd $IPDK_RECIPE/setup
cmake -B build -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/deps
cmake --build build -j6
- name: 'Run Krnlmon Unit Tests for DPDK Target'
run: |
cd ${GITHUB_WORKSPACE}/ipdk.recipe
export IPDK_RECIPE=${GITHUB_WORKSPACE}/ipdk.recipe
export SDE_INSTALL=${GITHUB_WORKSPACE}/install
export DEPEND_INSTALL=${GITHUB_WORKSPACE}/deps
cmake -B build -DDPDK_TARGET=on -DWITH_OVSP4RT=off
cmake --build build -j4 --target krnlmon-test || true
cat build/Testing/Temporary/LastTest.log
zip krnlmon_ut_logs.zip build/Testing/Temporary/LastTest.log
- name: 'Upload krnlmon-ut-result artifact'
uses: actions/upload-artifact@v3
with:
name: krnlmon_ut_logs
path: ipdk.recipe/krnlmon_ut_logs.zip
py_bandit_test:
timeout-minutes: 10
runs-on: ubuntu-20.04
steps:
- name: 'Checkout Networking Recipe'
uses: actions/checkout@v3
with:
path: ipdk.recipe
- name: 'Run Bandit Test'
uses: tj-actions/[email protected]
with:
targets: | # or a single string "."
./ipdk.recipe/clients/p4rt-ctl/p4rt-ctl.in
options: "-v"