app/flow-perf: fix build with GCC 12
[dpdk.git] / .github / workflows / build.yml
1 name: build
2
3 on:
4   push:
5   schedule:
6     - cron: '0 0 * * 1'
7
8 defaults:
9   run:
10     shell: bash --noprofile --norc -exo pipefail {0}
11
12 jobs:
13   ubuntu-vm-builds:
14     name: ${{ join(matrix.config.*, '-') }}
15     runs-on: ${{ matrix.config.os }}
16     env:
17       AARCH64: ${{ matrix.config.cross == 'aarch64' }}
18       ABI_CHECKS: ${{ contains(matrix.config.checks, 'abi') }}
19       ASAN: ${{ contains(matrix.config.checks, 'asan') }}
20       BUILD_32BIT: ${{ matrix.config.cross == 'i386' }}
21       BUILD_DOCS: ${{ contains(matrix.config.checks, 'doc') }}
22       CC: ccache ${{ matrix.config.compiler }}
23       DEF_LIB: ${{ matrix.config.library }}
24       LIBABIGAIL_VERSION: libabigail-1.8
25       MINGW: ${{ matrix.config.cross == 'mingw' }}
26       MINI: ${{ matrix.config.mini != '' }}
27       PPC64LE: ${{ matrix.config.cross == 'ppc64le' }}
28       REF_GIT_TAG: v22.03
29       RISCV64: ${{ matrix.config.cross == 'riscv64' }}
30       RUN_TESTS: ${{ contains(matrix.config.checks, 'tests') }}
31
32     strategy:
33       fail-fast: false
34       matrix:
35         config:
36           - os: ubuntu-20.04
37             compiler: gcc
38             library: static
39           - os: ubuntu-20.04
40             compiler: gcc
41             library: shared
42             mini: mini
43           - os: ubuntu-20.04
44             compiler: gcc
45             library: shared
46             checks: abi+doc+tests
47           - os: ubuntu-20.04
48             compiler: clang
49             library: static
50           - os: ubuntu-20.04
51             compiler: clang
52             library: shared
53             checks: asan+doc+tests
54           - os: ubuntu-20.04
55             compiler: gcc
56             library: static
57             cross: i386
58           - os: ubuntu-20.04
59             compiler: gcc
60             library: static
61             cross: mingw
62           - os: ubuntu-20.04
63             compiler: gcc
64             library: static
65             cross: aarch64
66           - os: ubuntu-20.04
67             compiler: gcc
68             library: shared
69             cross: aarch64
70           - os: ubuntu-20.04
71             compiler: gcc
72             library: static
73             cross: ppc64le
74           - os: ubuntu-20.04
75             compiler: gcc
76             library: shared
77             cross: ppc64le
78           - os: ubuntu-20.04
79             compiler: gcc
80             library: shared
81             cross: riscv64
82
83     steps:
84     - name: Checkout sources
85       uses: actions/checkout@v2
86     - name: Generate cache keys
87       id: get_ref_keys
88       run: |
89         echo -n '::set-output name=ccache::'
90         echo 'ccache-${{ matrix.config.os }}-${{ matrix.config.compiler }}-${{ matrix.config.cross }}-'$(date -u +%Y-w%W)
91         echo -n '::set-output name=libabigail::'
92         echo 'libabigail-${{ matrix.config.os }}'
93         echo -n '::set-output name=abi::'
94         echo 'abi-${{ matrix.config.os }}-${{ matrix.config.compiler }}-${{ matrix.config.cross }}-${{ env.LIBABIGAIL_VERSION }}-${{ env.REF_GIT_TAG }}'
95     - name: Retrieve ccache cache
96       uses: actions/cache@v2
97       with:
98         path: ~/.ccache
99         key: ${{ steps.get_ref_keys.outputs.ccache }}-${{ github.ref }}
100         restore-keys: |
101           ${{ steps.get_ref_keys.outputs.ccache }}-refs/heads/main
102     - name: Retrieve libabigail cache
103       id: libabigail-cache
104       uses: actions/cache@v2
105       if: env.ABI_CHECKS == 'true'
106       with:
107         path: libabigail
108         key: ${{ steps.get_ref_keys.outputs.libabigail }}
109     - name: Retrieve ABI reference cache
110       uses: actions/cache@v2
111       if: env.ABI_CHECKS == 'true'
112       with:
113         path: reference
114         key: ${{ steps.get_ref_keys.outputs.abi }}
115     - name: Update APT cache
116       run: sudo apt update || true
117     - name: Install packages
118       run: sudo apt install -y ccache libnuma-dev python3-setuptools
119         python3-wheel python3-pip python3-pyelftools ninja-build libbsd-dev
120         libpcap-dev libibverbs-dev libcrypto++-dev libfdt-dev libjansson-dev
121         libarchive-dev
122     - name: Install libabigail build dependencies if no cache is available
123       if: env.ABI_CHECKS == 'true' && steps.libabigail-cache.outputs.cache-hit != 'true'
124       run: sudo apt install -y autoconf automake libtool pkg-config libxml2-dev
125           libdw-dev
126     - name: Install i386 cross compiling packages
127       if: env.BUILD_32BIT == 'true'
128       run: sudo apt install -y gcc-multilib g++-multilib
129     - name: Install aarch64 cross compiling packages
130       if: env.AARCH64 == 'true'
131       run: sudo apt install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross
132         pkg-config-aarch64-linux-gnu
133     - name: Install mingw cross compiling packages
134       if: env.MINGW == 'true'
135       run: sudo apt install -y mingw-w64 mingw-w64-tools
136     - name: Install ppc64le cross compiling packages
137       if: env.PPC64LE == 'true'
138       run: sudo apt install -y gcc-powerpc64le-linux-gnu libc6-dev-ppc64el-cross
139         pkg-config-powerpc-linux-gnu
140     - name: Install riscv64 cross compiling packages
141       if: env.RISCV64 == 'true'
142       run: sudo apt install -y crossbuild-essential-riscv64
143     - name: Install test tools packages
144       if: env.AARCH64 != 'true' || env.PPC64LE != 'true' || env.RISCV64 != 'true' || env.RUN_TESTS == 'true'
145       run: sudo apt install -y gdb
146     - name: Install doc generation packages
147       if: env.BUILD_DOCS == 'true'
148       run: sudo apt install -y doxygen graphviz python3-sphinx
149         python3-sphinx-rtd-theme
150     - name: Run setup
151       run: |
152         .ci/linux-setup.sh
153         # Workaround on $HOME permissions as EAL checks them for plugin loading
154         chmod o-w $HOME
155     - name: Build and test
156       run: .ci/linux-build.sh
157     - name: Upload logs on failure
158       if: failure()
159       uses: actions/upload-artifact@v2
160       with:
161         name: meson-logs-${{ join(matrix.config.*, '-') }}
162         path: |
163           build/.ninja_log
164           build/gdb.log
165           build/meson-logs/meson-log.txt
166           build/meson-logs/testlog.txt
167
168   prepare-container-images:
169     name: ${{ join(matrix.config.*, '-') }}
170     runs-on: ubuntu-latest
171
172     strategy:
173       fail-fast: false
174       matrix:
175         config:
176           - image: fedora:35
177
178     steps:
179     - name: Generate various keys
180       id: get_keys
181       run: |
182         echo -n '::set-output name=image::'
183         echo 'image-${{ matrix.config.image }}-'$(date -u +%Y-%m-%d)
184     - name: Retrieve image cache
185       id: image_cache
186       uses: actions/cache@v2
187       with:
188         path: ~/.image
189         key: ${{ steps.get_keys.outputs.image }}
190     - name: Pull and prepare a fresh image
191       if: steps.image_cache.outputs.cache-hit != 'true'
192       run: |
193         docker pull registry.fedoraproject.org/${{ matrix.config.image }}
194         docker run -d -i --rm --name dpdk \
195           registry.fedoraproject.org/${{ matrix.config.image }} \
196           bash -li
197     - name: Update
198       if: steps.image_cache.outputs.cache-hit != 'true'
199       run: docker exec -i dpdk dnf update -y
200     - name: Install packages
201       if: steps.image_cache.outputs.cache-hit != 'true'
202       run: docker exec -i dpdk dnf install -y ccache numactl-devel
203         python3-setuptools python3-wheel python3-pip python3-pyelftools
204         ninja-build libatomic libbpf-devel libfdt-devel libpcap-devel
205         openssl-devel rdma-core-devel zlib-devel
206     - name: Save image in cache
207       if: steps.image_cache.outputs.cache-hit != 'true'
208       run: |
209         docker commit dpdk dpdk-local
210         mkdir -p ~/.image
211         docker save -o ~/.image/${{ matrix.config.image }}.tar dpdk-local
212     - name: Stop image
213       if: steps.image_cache.outputs.cache-hit != 'true'
214       run: docker kill dpdk
215
216   rpm-container-builds:
217     needs: prepare-container-images
218     name: ${{ join(matrix.config.*, '-') }}
219     runs-on: ubuntu-latest
220
221     strategy:
222       fail-fast: false
223       matrix:
224         config:
225           - image: fedora:35
226             compiler: gcc
227             library: static
228           - image: fedora:35
229             compiler: gcc
230             library: shared
231           - image: fedora:35
232             compiler: clang
233             library: static
234           - image: fedora:35
235             compiler: clang
236             library: shared
237
238     steps:
239     - name: Checkout sources
240       uses: actions/checkout@v2
241     - name: Generate various keys
242       id: get_keys
243       run: |
244         echo -n '::set-output name=ccache::'
245         echo 'ccache-${{ matrix.config.image }}-${{ matrix.config.compiler }}-'$(date -u +%Y-w%W)
246         echo -n '::set-output name=image::'
247         echo 'image-${{ matrix.config.image }}-'$(date -u +%Y-%m-%d)
248         echo -n '::set-output name=logs::'
249         echo 'meson-logs-${{ join(matrix.config.*, '-') }}' | tr -d ':'
250     - name: Retrieve image cache
251       id: image_cache
252       uses: actions/cache@v2
253       with:
254         path: ~/.image
255         key: ${{ steps.get_keys.outputs.image }}
256     - name: Fail if no image (not supposed to happen)
257       if: steps.image_cache.outputs.cache-hit != 'true'
258       run: |
259         echo 'Image ${{ matrix.config.image }} is not cached.'
260         false
261     - name: Retrieve ccache cache
262       uses: actions/cache@v2
263       with:
264         path: ~/.ccache
265         key: ${{ steps.get_keys.outputs.ccache }}-${{ github.ref }}
266         restore-keys: |
267           ${{ steps.get_keys.outputs.ccache }}-refs/heads/main
268     - name: Prepare working directory
269       run: |
270         mkdir -p ~/.ccache
271         > ~/env
272         echo CC=ccache ${{ matrix.config.compiler }} >> ~/env
273         echo DEF_LIB=${{ matrix.config.library }} >> ~/env
274     - name: Load the cached image
275       run: |
276         docker load -i ~/.image/${{ matrix.config.image }}.tar
277         docker run -d -i --rm --name dpdk \
278           --mount type=bind,src=$HOME/.ccache,dst=/root/.ccache \
279           --mount type=bind,src=$(pwd),dst=/root/dpdk \
280           --env-file ~/env \
281           -w /root/dpdk \
282           dpdk-local
283           bash -li
284     - name: Update
285       run: docker exec -i dpdk dnf update -y || true
286     - name: Install packages
287       run: docker exec -i dpdk dnf install -y ccache numactl-devel
288         python3-setuptools python3-wheel python3-pip python3-pyelftools
289         ninja-build libatomic libbpf-devel libfdt-devel libpcap-devel
290         openssl-devel rdma-core-devel zlib-devel ${{ matrix.config.compiler }}
291     - name: Run setup
292       run: docker exec -i dpdk .ci/linux-setup.sh
293     - name: Build
294       run: docker exec -i dpdk .ci/linux-build.sh
295     - name: Stop image
296       run: docker kill dpdk
297     - name: Upload logs on failure
298       if: failure()
299       uses: actions/upload-artifact@v2
300       with:
301         name: ${{ steps.get_keys.outputs.logs }}
302         path: |
303           build/.ninja_log
304           build/meson-logs/meson-log.txt