Skip to content

Add MQTT status update subscription #194

Add MQTT status update subscription

Add MQTT status update subscription #194

name: CMake on multiple platforms
on:
workflow_dispatch:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
build_type: [RelWithDebInfo, MinSizeRel]
architecture: [aarch64-linux-gnu, arm-linux-gnueabihf, ""]
steps:
- uses: actions/checkout@v4
- name: Install generic dependencies
run: |
sudo apt clean && sudo apt update
sudo apt-get -y install --no-install-recommends \
cmake \
curl \
libc6-dev-i386 \
git \
libcurl4-openssl-dev \
libevent-dev \
libssl-dev \
libsqlite3-dev \
libsystemd-dev \
liburiparser-dev \
libyaml-dev \
libzip-dev \
pkg-config \
uuid-dev
- name: Install x86-64 dependencies / settings
if: matrix.architecture == ''
run: |
sudo apt-get -y install \
build-essential
echo "cmake_settings=" >> "$GITHUB_OUTPUT"
- name: Install arm64 dependencies / settings
if: matrix.architecture == 'aarch64-linux-gnu'
run: |
sudo apt-get -y install --no-install-recommends \
qemu-user-static \
g++-aarch64-linux-gnu \
binutils-aarch64-linux-gnu \
gcc-aarch64-linux-gnu
cat << EOF | tee -a ${{ matrix.architecture }}.cmake
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_C_COMPILER_TARGET ${{ matrix.architecture }})
set(CMAKE_CXX_COMPILER_TARGET ${{ matrix.architecture }})
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_CROSSCOMPILING_EMULATOR qemu-aarch64-static -L /usr/${{ matrix.architecture }}/)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
find_program(C_COMPILER_FULL_PATH NAMES aarch64-linux-gnu-gcc)
set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH})
find_program(CXX_COMPILER_FULL_PATH NAMES g++-${CMAKE_CXX_COMPILER_TARGET} ${CMAKE_CXX_COMPILER_TARGET}-g++)
if(CXX_COMPILER_FULL_PATH)
set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH})
endif()
EOF
echo "CMAKE_SETTINGS=-DCMAKE_TOOLCHAIN_FILE=${{ matrix.architecture }}.cmake" >> "$GITHUB_ENV"
- name: Install arm32 dependencies / settings
if: matrix.architecture == 'arm-linux-gnueabihf'
run: |
sudo apt-get -y install --no-install-recommends \
qemu-user-static \
libc-dev-armel-cross \
gcc-arm-linux-gnueabihf \
g++-arm-linux-gnueabihf \
binutils-arm-linux-gnueabihf
cat << EOF | tee -a ${{ matrix.architecture }}.cmake
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_C_COMPILER_TARGET "${{ matrix.architecture }}")
set(CMAKE_CXX_COMPILER_TARGET "${{ matrix.architecture }}")
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_CROSSCOMPILING_EMULATOR qemu-arm-static -L /usr/${{ matrix.architecture }}/)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
find_program(C_COMPILER_FULL_PATH NAMES ${{ matrix.architecture }}-gcc)
set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH})
find_program(CXX_COMPILER_FULL_PATH NAMES g++-${CMAKE_CXX_COMPILER_TARGET} ${CMAKE_CXX_COMPILER_TARGET}-g++)
if(CXX_COMPILER_FULL_PATH)
set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH})
endif()
EOF
echo "CMAKE_SETTINGS=-DCMAKE_TOOLCHAIN_FILE=${{ matrix.architecture }}.cmake" >> "$GITHUB_ENV"
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name:
Configure CMake ${{ matrix.build_type }} / ${{ matrix.architecture }}
run: >
cmake ${{ env.CMAKE_SETTINGS }} -B ${{
steps.strings.outputs.build-output-dir }}
-DCMAKE_INSTALL_PREFIX=/opt/aws-greengrass-lite -DGGL_LOG_LEVEL=DEBUG
-S ${{ github.workspace }}
- name: Build
run: |
make -C ${{ steps.strings.outputs.build-output-dir }} -j$(nproc)
- name: Package
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: cpack -G DEB
- name: Save package
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.architecture }}_${{ matrix.build_type }}.deb
path: ${{ steps.strings.outputs.build-output-dir }}/*.deb
retention-days: 1