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