xref: /dpdk/.github/workflows/build.yml (revision 29fd052d)
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  build:
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      BUILD_32BIT: ${{ matrix.config.cross == 'i386' }}
20      BUILD_DOCS: ${{ contains(matrix.config.checks, 'doc') }}
21      CC: ccache ${{ matrix.config.compiler }}
22      DEF_LIB: ${{ matrix.config.library }}
23      LIBABIGAIL_VERSION: libabigail-1.8
24      MINI: ${{ matrix.config.mini != '' }}
25      PPC64LE: ${{ matrix.config.cross == 'ppc64le' }}
26      REF_GIT_TAG: v21.11
27      RUN_TESTS: ${{ contains(matrix.config.checks, 'tests') }}
28
29    strategy:
30      fail-fast: false
31      matrix:
32        config:
33          - os: ubuntu-18.04
34            compiler: gcc
35            library: static
36          - os: ubuntu-18.04
37            compiler: gcc
38            library: shared
39            mini: mini
40          - os: ubuntu-18.04
41            compiler: gcc
42            library: shared
43            checks: abi+doc+tests
44          - os: ubuntu-18.04
45            compiler: clang
46            library: static
47          - os: ubuntu-18.04
48            compiler: clang
49            library: shared
50            checks: doc+tests
51          - os: ubuntu-18.04
52            compiler: gcc
53            library: static
54            cross: i386
55          # Note: common/cnxk is disabled for Ubuntu 18.04
56          # https://bugs.dpdk.org/show_bug.cgi?id=697
57          - os: ubuntu-18.04
58            compiler: gcc
59            library: static
60            cross: aarch64
61          - os: ubuntu-18.04
62            compiler: gcc
63            library: shared
64            cross: aarch64
65          - os: ubuntu-18.04
66            compiler: gcc
67            library: static
68            cross: ppc64le
69          - os: ubuntu-18.04
70            compiler: gcc
71            library: shared
72            cross: ppc64le
73
74    steps:
75    - name: Checkout sources
76      uses: actions/checkout@v2
77    - name: Generate cache keys
78      id: get_ref_keys
79      run: |
80        echo -n '::set-output name=ccache::'
81        echo 'ccache-${{ matrix.config.os }}-${{ matrix.config.compiler }}-${{ matrix.config.cross }}-'$(date -u +%Y-w%W)
82        echo -n '::set-output name=libabigail::'
83        echo 'libabigail-${{ matrix.config.os }}'
84        echo -n '::set-output name=abi::'
85        echo 'abi-${{ matrix.config.os }}-${{ matrix.config.compiler }}-${{ matrix.config.cross }}-${{ env.LIBABIGAIL_VERSION }}-${{ env.REF_GIT_TAG }}'
86    - name: Retrieve ccache cache
87      uses: actions/cache@v2
88      with:
89        path: ~/.ccache
90        key: ${{ steps.get_ref_keys.outputs.ccache }}-${{ github.ref }}
91        restore-keys: |
92          ${{ steps.get_ref_keys.outputs.ccache }}-refs/heads/main
93    - name: Retrieve libabigail cache
94      id: libabigail-cache
95      uses: actions/cache@v2
96      if: env.ABI_CHECKS == 'true'
97      with:
98        path: libabigail
99        key: ${{ steps.get_ref_keys.outputs.libabigail }}
100    - name: Retrieve ABI reference cache
101      uses: actions/cache@v2
102      if: env.ABI_CHECKS == 'true'
103      with:
104        path: reference
105        key: ${{ steps.get_ref_keys.outputs.abi }}
106    - name: Update APT cache
107      run: sudo apt update || true
108    - name: Install packages
109      run: sudo apt install -y ccache libnuma-dev python3-setuptools
110        python3-wheel python3-pip python3-pyelftools ninja-build libbsd-dev
111        libpcap-dev libibverbs-dev libcrypto++-dev libfdt-dev libjansson-dev
112        libarchive-dev
113    - name: Install libabigail build dependencies if no cache is available
114      if: env.ABI_CHECKS == 'true' && steps.libabigail-cache.outputs.cache-hit != 'true'
115      run: sudo apt install -y autoconf automake libtool pkg-config libxml2-dev
116          libdw-dev
117    - name: Install i386 cross compiling packages
118      if: env.BUILD_32BIT == 'true'
119      run: sudo apt install -y gcc-multilib g++-multilib
120    - name: Install aarch64 cross compiling packages
121      if: env.AARCH64 == 'true'
122      run: sudo apt install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross
123        pkg-config-aarch64-linux-gnu
124    - name: Install ppc64le cross compiling packages
125      if: env.PPC64LE == 'true'
126      run: sudo apt install -y gcc-powerpc64le-linux-gnu libc6-dev-ppc64el-cross
127        pkg-config-powerpc-linux-gnu
128    - name: Install test tools packages
129      if: env.AARCH64 != 'true' || env.PPC64LE != 'true' || env.RUN_TESTS == 'true'
130      run: sudo apt install -y gdb
131    - name: Install doc generation packages
132      if: env.BUILD_DOCS == 'true'
133      run: sudo apt install -y doxygen graphviz python3-sphinx
134        python3-sphinx-rtd-theme
135    - name: Run setup
136      run: |
137        .ci/linux-setup.sh
138        # Workaround on $HOME permissions as EAL checks them for plugin loading
139        chmod o-w $HOME
140    - name: Build and test
141      run: .ci/linux-build.sh
142    - name: Upload logs on failure
143      if: failure()
144      uses: actions/upload-artifact@v2
145      with:
146        name: meson-logs-${{ join(matrix.config.*, '-') }}
147        path: |
148          build/meson-logs/testlog.txt
149          build/.ninja_log
150          build/meson-logs/meson-log.txt
151          build/gdb.log
152