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