From af5b6db5a08aa43dde2a7d04e576858b5a2534f3 Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Thu, 10 Oct 2024 10:58:51 +0200 Subject: [PATCH 1/3] build: Add helper file for CI or developers Enable to setup a reference system for building, it can be used for various automation (eg: github actions) Most of changes are isolated in this simple makefile that more or less script what has been described in readme file Signed-off-by: Philippe Coval --- helper.mk | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 helper.mk diff --git a/helper.mk b/helper.mk new file mode 100755 index 00000000..c690d384 --- /dev/null +++ b/helper.mk @@ -0,0 +1,39 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# ex: set tabstop=4 noexpandtab: +# -*- coding: utf-8 -* +# +# SPDX-License-Identifier: LicenseRef-MSLA +# SPDX-Copyright-Text: (c) 2024 Silicon Laboratories Inc. (www.silabs.com) + +tmpdir?=${CURDIR}/tmp + +sudo?=sudo + +export CMAKE_PREFIX_PATH=${tmpdir}/usr/local/cmake + +debian_packages?=build-essential \ + git cmake sudo rustc pkg-config \ + libnl-route-3-dev libdbus-1-dev + +mbedtls_url?=https://github.com/ARMmbed/mbedtls +mbedtls_rev?=v3.0.0 + + +build: + cmake . + cmake --build . + make install DESTDIR="${tmpdir}" + +mbedtls: + git clone --branch=${mbedtls_rev} --recursive --depth=1 ${mbedtls_url} + +prepare: mbedtls + cd $< \ + && cmake . \ + && cmake --build . \ + && make install DESTDIR="${tmpdir}" + +setup: + ${sudo} apt-get install -y ${debian_packages} + From 9718aa5e77d959a0af452d9af17cd83745ce768c Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Tue, 5 Nov 2024 15:38:25 +0100 Subject: [PATCH 2/3] docker: Support docker for CI or dx Just run the native helper script in docker, it is not optimized for bandwidth but minimize duplication of changes. Signed-off-by: Philippe Coval --- Dockerfile | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..6eb00d59 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +#!/bin/echo run with: docker build . -f +# SPDX-License-Identifier: LicenseRef-MSLA +# SPDX-Copyright-Text: (c) 2024 Silicon Laboratories Inc. (www.silabs.com) + +FROM debian:12 + +RUN echo "# log: Setup system" \ + && set -x \ + && apt-get update -y \ + && apt-get install -y sudo make \ + && date -u + +ENV project wisun-br-linux +ENV workdir /usr/local/src/${project} +WORKDIR ${workdir} +COPY helper.mk ${workdir} +RUN echo "# log: Setup ${project}" \ + && set -x \ + && ./helper.mk setup \ + && date -u + +COPY . ${workdir} +WORKDIR ${workdir} +RUN echo "# log: Build ${project}" \ + && set -x \ + && ./helper.mk prepare build \ + && date -u From b7ae1fab8cf76351de53d19cfa58148d8459d4fd Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Tue, 5 Nov 2024 16:16:55 +0100 Subject: [PATCH 3/3] github: Add action for checking PR in developers forks Enable github actions that build any branches using docker along helper script. To reduces the dependency on github and avoid bringing more ambiguity or complexity most tasks are isolated at lowerlevel (in helper for cmake). More checks to come next, unit tests, lint etc. Relate-to: https://github.com/rzr/wisun-br-linux/actions/runs/11687474586/job/32545660605 Signed-off-by: Philippe Coval --- .github/workflows/build.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..3755d758 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,19 @@ +# YAML -*- mode: yaml; tab-width: 2; indent-tabs-mode: nil; coding: utf-8 -*- +# SPDX-License-Identifier: LicenseRef-MSLA +# SPDX-Copyright-Text: (c) 2024 Silicon Laboratories Inc. (www.silabs.com) +--- +name: Docker Image CI + +on: # yamllint disable-line rule:truthy + push: + pull_request: + +jobs: + build: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4.1.1 + with: + fetch-depth: 0 + - name: Build Docker image from sources + run: docker build .