From 12942e0e6c56e965bef1b543fa63ab4a33da4428 Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Wed, 22 Mar 2023 17:55:16 +0100 Subject: [PATCH 1/5] GH-14: build: Add helper.mk to setup system It has been tested on debian but might work elsewhere (ie: WSL2 users) Testing on cloud should be enabled in separate commit Bug-SiliconLabs: UIC-3082 Bug-GitHub: https://github.com/rzr/UnifySDK/issues/3 Forwarded: https://github.com/SiliconLabs/UnifySDK/pull/14 Signed-off-by: Philippe Coval --- helper.mk | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100755 helper.mk diff --git a/helper.mk b/helper.mk new file mode 100755 index 0000000000..05468508fa --- /dev/null +++ b/helper.mk @@ -0,0 +1,130 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# ex: set tabstop=4 noexpandtab: +# -*- coding: utf-8 -* + +default: help zpc/default + @echo "$@: TODO: Support more than $^ by default" + @date -u + +SELF?=${CURDIR}/helper.mk + +CMAKE_GENERATOR?=Ninja +export CMAKE_GENERATOR + +build_dir?=build +sudo?=sudo + +packages?=cmake ninja-build build-essential python3-full ruby clang +packages+=git-lfs unp time file +packages+=nlohmann-json3-dev +# TODO: remove for offline build +packages+=curl wget python3-pip + +RUST_VERSION?=1.64.0 +export PATH := ${HOME}/.cargo/bin:${PATH} + +zpc_exe?=${build_dir}/applications/zpc/zpc +exes+=${zpc_exe} + +help: README.md + @cat $< + @echo "" + @echo "# Available rules at your own risk:" + @grep -o '^[^ ]*:' ${SELF} | grep -v '\$$' | grep -v '^#' | grep -v '^\.' + @echo "" + @echo "# Environment:" + @echo "# PATH=${PATH}" + @echo "" + +setup/debian: docker/target_dependencies.apt + cat /etc/debian_version + -${sudo} apt update + ${sudo} apt install -y $(shell cat $<) + ${sudo} apt install -y ${packages} + @echo "$@: TODO: Support debian stable rustc=1.63 https://tracker.debian.org/pkg/rustc" + +setup/rust: + @echo "$@: TODO: Support https://tracker.debian.org/pkg/rustup" + curl https://sh.rustup.rs -sSf | bash -s -- -y --default-toolchain ${RUST_VERSION} + cat $${HOME}/.cargo/env + @echo '$@: info: You might like to add ". $${HOME}/.cargo/env" to "$${HOME}/.bashrc"' + -which rustc + rustc --version + cargo --version + @echo "$@: TODO: Support stable version from https://releases.rs/ or older" + +setup/python: + @echo "$@: TODO: https://github.com/wbond/pybars3/issues/82" + pip3 --version || echo "warning: Please install pip" + pip3 install --break-system-packages pybars3 + +setup/debian/12: setup/debian setup/rust setup/python + date -u + +setup: setup/debian/12 + date -u + +git: .git/lfs + git lfs version || echo "$@: warning: Please install git-lfs" + git lfs status --porcelain || git lfs install + time git lfs pull + git lfs update || git lfs update --force + git lfs status --porcelain + +configure: ${build_dir}/CMakeCache.txt + file -E $< + +${build_dir}/CMakeCache.txt: CMakeLists.txt ${build_pre_list} + cmake -B ${build_dir} + +build: ${build_dir}/CMakeCache.txt + cmake --build ${ Date: Wed, 22 Mar 2023 17:55:10 +0100 Subject: [PATCH 2/5] GH-14: docker: Build into container using helper.mk To ensure reproductibility on host or cloud Bug-SiliconLabs: UIC-3082 Bug-GitHub: https://github.com/rzr/UnifySDK/issues/3 Forwarded: https://github.com/SiliconLabs/UnifySDK/pull/14 Signed-off-by: Philippe Coval --- Dockerfile | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..cd29fc2e39 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +#!/bin/echo docker build . -f +# -*- coding: utf-8 -*- + +FROM debian:12 + +ENV DEBIAN_FRONTEND noninteractive +ENV LC_ALL en_US.UTF-8 +ENV LANG ${LC_ALL} + +RUN echo "# log: Configuring locales" \ + && set -x \ + && apt-get update -y \ + && apt-get install -y locales \ + && echo "${LC_ALL} UTF-8" | tee /etc/locale.gen \ + && locale-gen ${LC_ALL} \ + && dpkg-reconfigure locales \ + && TZ=Etc/UTC apt-get -y install tzdata \ + && date -u + +ENV project UnifySDK +ENV workdir /usr/local/opt/${project} +ADD . ${workdir} + +WORKDIR ${workdir} + +RUN echo "# log: Setup system" \ + && set -x \ + && apt-get install -y make sudo \ + && ./helper.mk help setup/debian/12 \ + && date -u + +RUN echo "# log: Build" \ + && set -x \ + && ./helper.mk \ + && date -u From 7db49e7d43bebc977ac32102b2790cf995de4fe9 Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Mon, 30 Oct 2023 13:31:18 +0100 Subject: [PATCH 3/5] GH-14: Add github action support Note this is currently active in forked repos Bug-SiliconLabs: UIC-3082 Bug-GitHub: https://github.com/rzr/UnifySDK/issues/3 Forwarded: https://github.com/SiliconLabs/UnifySDK/pull/14 Signed-off-by: Philippe Coval --- .github/workflows/build.yml | 17 +++++++++++++++++ 1 file changed, 17 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 0000000000..7ceb54045b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,17 @@ +name: Docker Image CI + +on: + push: + branches: [ '*' ] + pull_request: + branches: [ '*' ] + +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 . From 886821588e6429457c2249202a56e65b668a70b9 Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Thu, 9 Nov 2023 10:49:22 +0100 Subject: [PATCH 4/5] GH-15: Enable CLA contribs Bug-SiliconLabs: UIC-3082 Bug-GitHub: https://github.com/rzr/UnifySDK/issues/3 Forwarded: https://github.com/SiliconLabs/UnifySDK/pull/15 Relate-to: https://github.com/SiliconLabs/UnifySDK/pull/14 Relate-to: https://github.com/rzr/UnifySDK/compare/main...rzr:UnifySDK:GH-14/UIC-3082/phcoval/node/main?expand=1 Signed-off-by: Philippe Coval --- .github/pull_request_template.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000000..9a82d1c830 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,16 @@ +## Change + + +## Checklist + + +- [ ] A [Contribution License Agreement][CLA] has been established between @SiliconLabs and author's company (matching email domain) + +[CLA]: https://en.wikipedia.org/wiki/Contributor_License_Agreement + + From 6c063913ee6dfbf55734606407f482064b3a55e1 Mon Sep 17 00:00:00 2001 From: Philippe Coval Date: Thu, 9 Nov 2023 11:35:10 +0100 Subject: [PATCH 5/5] build: Enable UPVL for zpc Signed-off-by: Philippe Coval --- helper.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helper.mk b/helper.mk index 05468508fa..4362926f20 100755 --- a/helper.mk +++ b/helper.mk @@ -116,7 +116,7 @@ zpc/configure: CMakeLists.txt -DBUILD_UPTI_CAP=OFF \ -DBUILD_UPTI_CAP=OFF \ -DBUILD_UPTI_WRITER=OFF \ - -DBUILD_UPVL=OFF \ + -DBUILD_UPVL=ON \ -DBUILD_ZIGBEED=OFF \ -DBUILD_ZIGPC=OFF