ci: hook to GitHub Actions
[dpdk.git] / .github / workflows / build.yml
1 name: build
2
3 on:
4   push:
5   schedule:
6     - cron: '0 0 * * 1'
7
8 defaults:
9   run:
10     shell: bash --noprofile --norc -exo pipefail {0}
11
12 jobs:
13   build:
14     name: ${{ join(matrix.config.*, '-') }}
15     runs-on: ${{ matrix.config.os }}
16     env:
17       AARCH64: ${{ matrix.config.cross == 'aarch64' }}
18       BUILD_32BIT: ${{ matrix.config.cross == 'i386' }}
19       BUILD_DOCS: ${{ contains(matrix.config.checks, 'doc') }}
20       CC: ccache ${{ matrix.config.compiler }}
21       DEF_LIB: ${{ matrix.config.library }}
22       RUN_TESTS: ${{ contains(matrix.config.checks, 'tests') }}
23
24     strategy:
25       fail-fast: false
26       matrix:
27         config:
28           - os: ubuntu-18.04
29             compiler: gcc
30             library: static
31           - os: ubuntu-18.04
32             compiler: gcc
33             library: shared
34             checks: doc+tests
35           - os: ubuntu-18.04
36             compiler: clang
37             library: static
38           - os: ubuntu-18.04
39             compiler: clang
40             library: shared
41             checks: doc+tests
42           - os: ubuntu-18.04
43             compiler: gcc
44             library: static
45             cross: i386
46           - os: ubuntu-18.04
47             compiler: gcc
48             library: static
49             cross: aarch64
50           - os: ubuntu-18.04
51             compiler: gcc
52             library: shared
53             cross: aarch64
54
55     steps:
56     - name: Checkout sources
57       uses: actions/checkout@v2
58     - name: Generate cache keys
59       id: get_ref_keys
60       run: |
61         echo -n '::set-output name=ccache::'
62         echo 'ccache-${{ matrix.config.os }}-${{ matrix.config.compiler }}-${{ matrix.config.cross }}-'$(date -u +%Y-w%W)
63     - name: Retrieve ccache cache
64       uses: actions/cache@v2
65       with:
66         path: ~/.ccache
67         key: ${{ steps.get_ref_keys.outputs.ccache }}-${{ github.ref }}
68         restore-keys: |
69           ${{ steps.get_ref_keys.outputs.ccache }}-refs/heads/main
70     - name: Install packages
71       run: sudo apt install -y ccache libnuma-dev python3-setuptools
72         python3-wheel python3-pip ninja-build libbsd-dev libpcap-dev
73         libibverbs-dev libcrypto++-dev libfdt-dev libjansson-dev
74     - name: Install i386 cross compiling packages
75       if: env.BUILD_32BIT == 'true'
76       run: sudo apt install -y gcc-multilib
77     - name: Install aarch64 cross compiling packages
78       if: env.AARCH64 == 'true'
79       run: sudo apt install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross
80         pkg-config-aarch64-linux-gnu
81     - name: Install doc generation packages
82       if: env.BUILD_DOCS == 'true'
83       run: sudo apt install -y doxygen graphviz python3-sphinx
84         python3-sphinx-rtd-theme
85     - name: Run setup
86       run: |
87         .ci/linux-setup.sh
88         # Workaround on $HOME permissions as EAL checks them for plugin loading
89         chmod o-w $HOME
90     - name: Build and test
91       run: .ci/linux-build.sh
92     - name: Upload logs on failure
93       if: failure()
94       uses: actions/upload-artifact@v2
95       with:
96         name: meson-logs-${{ join(matrix.config.*, '-') }}
97         path: |
98           build/meson-logs/testlog.txt
99           build/.ninja_log
100           build/meson-logs/meson-log.txt