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