net/enetfec: fix build with GCC 12
[dpdk.git] / .github / workflows / build.yml
index 7c4d6dc..c0d2829 100644 (file)
@@ -10,50 +10,75 @@ defaults:
     shell: bash --noprofile --norc -exo pipefail {0}
 
 jobs:
-  build:
+  ubuntu-vm-builds:
     name: ${{ join(matrix.config.*, '-') }}
     runs-on: ${{ matrix.config.os }}
     env:
       AARCH64: ${{ matrix.config.cross == 'aarch64' }}
       ABI_CHECKS: ${{ contains(matrix.config.checks, 'abi') }}
+      ASAN: ${{ contains(matrix.config.checks, 'asan') }}
       BUILD_32BIT: ${{ matrix.config.cross == 'i386' }}
       BUILD_DOCS: ${{ contains(matrix.config.checks, 'doc') }}
       CC: ccache ${{ matrix.config.compiler }}
       DEF_LIB: ${{ matrix.config.library }}
       LIBABIGAIL_VERSION: libabigail-1.8
-      REF_GIT_TAG: v21.05
+      MINGW: ${{ matrix.config.cross == 'mingw' }}
+      MINI: ${{ matrix.config.mini != '' }}
+      PPC64LE: ${{ matrix.config.cross == 'ppc64le' }}
+      REF_GIT_TAG: v22.03
+      RISCV64: ${{ matrix.config.cross == 'riscv64' }}
       RUN_TESTS: ${{ contains(matrix.config.checks, 'tests') }}
 
     strategy:
       fail-fast: false
       matrix:
         config:
-          - os: ubuntu-18.04
+          - os: ubuntu-20.04
             compiler: gcc
             library: static
-          - os: ubuntu-18.04
+          - os: ubuntu-20.04
+            compiler: gcc
+            library: shared
+            mini: mini
+          - os: ubuntu-20.04
             compiler: gcc
             library: shared
             checks: abi+doc+tests
-          - os: ubuntu-18.04
+          - os: ubuntu-20.04
             compiler: clang
             library: static
-          - os: ubuntu-18.04
+          - os: ubuntu-20.04
             compiler: clang
             library: shared
-            checks: doc+tests
-          - os: ubuntu-18.04
+            checks: asan+doc+tests
+          - os: ubuntu-20.04
             compiler: gcc
             library: static
             cross: i386
-          - os: ubuntu-18.04
+          - os: ubuntu-20.04
+            compiler: gcc
+            library: static
+            cross: mingw
+          - os: ubuntu-20.04
             compiler: gcc
             library: static
             cross: aarch64
-          - os: ubuntu-18.04
+          - os: ubuntu-20.04
             compiler: gcc
             library: shared
             cross: aarch64
+          - os: ubuntu-20.04
+            compiler: gcc
+            library: static
+            cross: ppc64le
+          - os: ubuntu-20.04
+            compiler: gcc
+            library: shared
+            cross: ppc64le
+          - os: ubuntu-20.04
+            compiler: gcc
+            library: shared
+            cross: riscv64
 
     steps:
     - name: Checkout sources
@@ -93,19 +118,30 @@ jobs:
       run: sudo apt install -y ccache libnuma-dev python3-setuptools
         python3-wheel python3-pip python3-pyelftools ninja-build libbsd-dev
         libpcap-dev libibverbs-dev libcrypto++-dev libfdt-dev libjansson-dev
+        libarchive-dev
     - name: Install libabigail build dependencies if no cache is available
       if: env.ABI_CHECKS == 'true' && steps.libabigail-cache.outputs.cache-hit != 'true'
       run: sudo apt install -y autoconf automake libtool pkg-config libxml2-dev
           libdw-dev
     - name: Install i386 cross compiling packages
       if: env.BUILD_32BIT == 'true'
-      run: sudo apt install -y gcc-multilib
+      run: sudo apt install -y gcc-multilib g++-multilib
     - name: Install aarch64 cross compiling packages
       if: env.AARCH64 == 'true'
       run: sudo apt install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross
         pkg-config-aarch64-linux-gnu
+    - name: Install mingw cross compiling packages
+      if: env.MINGW == 'true'
+      run: sudo apt install -y mingw-w64 mingw-w64-tools
+    - name: Install ppc64le cross compiling packages
+      if: env.PPC64LE == 'true'
+      run: sudo apt install -y gcc-powerpc64le-linux-gnu libc6-dev-ppc64el-cross
+        pkg-config-powerpc-linux-gnu
+    - name: Install riscv64 cross compiling packages
+      if: env.RISCV64 == 'true'
+      run: sudo apt install -y crossbuild-essential-riscv64
     - name: Install test tools packages
-      if: env.AARCH64 != 'true' || env.RUN_TESTS == 'true'
+      if: env.AARCH64 != 'true' || env.PPC64LE != 'true' || env.RISCV64 != 'true' || env.RUN_TESTS == 'true'
       run: sudo apt install -y gdb
     - name: Install doc generation packages
       if: env.BUILD_DOCS == 'true'
@@ -124,7 +160,145 @@ jobs:
       with:
         name: meson-logs-${{ join(matrix.config.*, '-') }}
         path: |
+          build/.ninja_log
+          build/gdb.log
+          build/meson-logs/meson-log.txt
           build/meson-logs/testlog.txt
+
+  prepare-container-images:
+    name: ${{ join(matrix.config.*, '-') }}
+    runs-on: ubuntu-latest
+
+    strategy:
+      fail-fast: false
+      matrix:
+        config:
+          - image: fedora:35
+
+    steps:
+    - name: Generate various keys
+      id: get_keys
+      run: |
+        echo -n '::set-output name=image::'
+        echo 'image-${{ matrix.config.image }}-'$(date -u +%Y-%m-%d)
+    - name: Retrieve image cache
+      id: image_cache
+      uses: actions/cache@v2
+      with:
+        path: ~/.image
+        key: ${{ steps.get_keys.outputs.image }}
+    - name: Pull and prepare a fresh image
+      if: steps.image_cache.outputs.cache-hit != 'true'
+      run: |
+        docker pull registry.fedoraproject.org/${{ matrix.config.image }}
+        docker run -d -i --rm --name dpdk \
+          registry.fedoraproject.org/${{ matrix.config.image }} \
+          bash -li
+    - name: Update
+      if: steps.image_cache.outputs.cache-hit != 'true'
+      run: docker exec -i dpdk dnf update -y
+    - name: Install packages
+      if: steps.image_cache.outputs.cache-hit != 'true'
+      run: docker exec -i dpdk dnf install -y ccache numactl-devel
+        python3-setuptools python3-wheel python3-pip python3-pyelftools
+        ninja-build libatomic libbpf-devel libfdt-devel libpcap-devel
+        openssl-devel rdma-core-devel zlib-devel
+    - name: Save image in cache
+      if: steps.image_cache.outputs.cache-hit != 'true'
+      run: |
+        docker commit dpdk dpdk-local
+        mkdir -p ~/.image
+        docker save -o ~/.image/${{ matrix.config.image }}.tar dpdk-local
+    - name: Stop image
+      if: steps.image_cache.outputs.cache-hit != 'true'
+      run: docker kill dpdk
+
+  rpm-container-builds:
+    needs: prepare-container-images
+    name: ${{ join(matrix.config.*, '-') }}
+    runs-on: ubuntu-latest
+
+    strategy:
+      fail-fast: false
+      matrix:
+        config:
+          - image: fedora:35
+            compiler: gcc
+            library: static
+          - image: fedora:35
+            compiler: gcc
+            library: shared
+          - image: fedora:35
+            compiler: clang
+            library: static
+          - image: fedora:35
+            compiler: clang
+            library: shared
+
+    steps:
+    - name: Checkout sources
+      uses: actions/checkout@v2
+    - name: Generate various keys
+      id: get_keys
+      run: |
+        echo -n '::set-output name=ccache::'
+        echo 'ccache-${{ matrix.config.image }}-${{ matrix.config.compiler }}-'$(date -u +%Y-w%W)
+        echo -n '::set-output name=image::'
+        echo 'image-${{ matrix.config.image }}-'$(date -u +%Y-%m-%d)
+        echo -n '::set-output name=logs::'
+        echo 'meson-logs-${{ join(matrix.config.*, '-') }}' | tr -d ':'
+    - name: Retrieve image cache
+      id: image_cache
+      uses: actions/cache@v2
+      with:
+        path: ~/.image
+        key: ${{ steps.get_keys.outputs.image }}
+    - name: Fail if no image (not supposed to happen)
+      if: steps.image_cache.outputs.cache-hit != 'true'
+      run: |
+        echo 'Image ${{ matrix.config.image }} is not cached.'
+        false
+    - name: Retrieve ccache cache
+      uses: actions/cache@v2
+      with:
+        path: ~/.ccache
+        key: ${{ steps.get_keys.outputs.ccache }}-${{ github.ref }}
+        restore-keys: |
+          ${{ steps.get_keys.outputs.ccache }}-refs/heads/main
+    - name: Prepare working directory
+      run: |
+        mkdir -p ~/.ccache
+        > ~/env
+        echo CC=ccache ${{ matrix.config.compiler }} >> ~/env
+        echo DEF_LIB=${{ matrix.config.library }} >> ~/env
+    - name: Load the cached image
+      run: |
+        docker load -i ~/.image/${{ matrix.config.image }}.tar
+        docker run -d -i --rm --name dpdk \
+          --mount type=bind,src=$HOME/.ccache,dst=/root/.ccache \
+          --mount type=bind,src=$(pwd),dst=/root/dpdk \
+          --env-file ~/env \
+          -w /root/dpdk \
+          dpdk-local
+          bash -li
+    - name: Update
+      run: docker exec -i dpdk dnf update -y || true
+    - name: Install packages
+      run: docker exec -i dpdk dnf install -y ccache numactl-devel
+        python3-setuptools python3-wheel python3-pip python3-pyelftools
+        ninja-build libatomic libbpf-devel libfdt-devel libpcap-devel
+        openssl-devel rdma-core-devel zlib-devel ${{ matrix.config.compiler }}
+    - name: Run setup
+      run: docker exec -i dpdk .ci/linux-setup.sh
+    - name: Build
+      run: docker exec -i dpdk .ci/linux-build.sh
+    - name: Stop image
+      run: docker kill dpdk
+    - name: Upload logs on failure
+      if: failure()
+      uses: actions/upload-artifact@v2
+      with:
+        name: ${{ steps.get_keys.outputs.logs }}
+        path: |
           build/.ninja_log
           build/meson-logs/meson-log.txt
-          build/gdb.log