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