Skip to content

Commit

Permalink
[eclipse-wakaamaGH-494] ci: Build and test on multiple architectures
Browse files Browse the repository at this point in the history
This also fixes the CMake build on big endian architectures.

This is more complex than it should be because...
- Ubuntu 20.04 does not support many architectures, Debian does (e.g.
  ARMv5, MIPSel)
- CMake versions before 3.19 are affected by
  https://gitlab.kitware.com/cmake/cmake/-/issues/20568

Signed-off-by: Reto Schneider <[email protected]>
  • Loading branch information
rettichschnidi committed Apr 7, 2021
1 parent 8c53f18 commit 3d2b300
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/multiarch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Foreign architectures

on: [push, pull_request]

jobs:
multiarch:
runs-on: ubuntu-20.04
env:
cmake_version: 3.20.0
strategy:
fail-fast: false
matrix:
arch: ["armv6", "armv7", "aarch64", "s390x", "ppc64le"]
steps:
- name: Checkout code including full history and submodules
uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 0
- name: Build and test
uses: uraimo/[email protected]
id: runcmd
with:
arch: ${{ matrix.arch }}
distro: buster
githubToken: ${{ github.token }}
install: |
apt update
apt -qy --no-install-recommends install libcunit1-dev ninja-build unzip wget build-essential
# Workaround because of https://gitlab.kitware.com/cmake/cmake/-/issues/20568
# Please remove once CMake 3.19 or newer is available in the repository
apt -qy --no-install-recommends install dirmngr gpg gpg-agent
echo deb-src http://archive.raspbian.org/raspbian buster main contrib non-free >> /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9165938D90FDDD2E
apt update
apt -qy --no-install-recommends build-dep cmake
wget https://github.com/Kitware/CMake/releases/download/v${{ env.cmake_version }}/cmake-${{ env.cmake_version }}.tar.gz
tar xf cmake-${{ env.cmake_version }}.tar.gz
cd cmake-${{ env.cmake_version }}
./bootstrap -- -DCMAKE_USE_OPENSSL=OFF -DBUILD_TESTING=OFF
make -j $(nproc)
make install
cd ..
rm -r cmake-${{ env.cmake_version }} cmake-${{ env.cmake_version }}.tar.gz
run: |
tools/ci/run_ci.sh --build --run-tests
3 changes: 3 additions & 0 deletions core/wakaama.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ if(NOT DEFINED LWM2M_LITTLE_ENDIAN)
set(LWM2M_LITTLE_ENDIAN TRUE)
endif()
endif()

if (LWM2M_LITTLE_ENDIAN)
set(WAKAAMA_DEFINITIONS ${WAKAAMA_DEFINITIONS} -DLWM2M_LITTLE_ENDIAN)
else()
set(WAKAAMA_DEFINITIONS ${WAKAAMA_DEFINITIONS} -DLWM2M_BIG_ENDIAN)
endif()

# Set the LWM2M version
Expand Down

0 comments on commit 3d2b300

Please sign in to comment.