Skip to content

Commit

Permalink
Merge pull request SiliconLabs#2 from rzr/SiliconLabsGH-9/UIC-3082/ph…
Browse files Browse the repository at this point in the history
…coval/main

SiliconLabsGH-14: Enable CI
  • Loading branch information
rzr committed Nov 9, 2023
2 parents 306a0b1 + 7db49e7 commit 6c34ff9
Show file tree
Hide file tree
Showing 3 changed files with 182 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .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 .
35 changes: 35 additions & 0 deletions 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
130 changes: 130 additions & 0 deletions 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 ${<D} \
|| cat ${build_dir}/CMakeFiles/CMakeOutput.log
cmake --build ${<D}
.PHONY: build

${build_dir}/%: build
file -E "$<"

${exe}: build
file -E $<

all: ${exes}
file -E $<

test: ${build_dir}
ctest --test-dir ${<}

all/default: configure build test
@date -u

zpc/configure: CMakeLists.txt
cmake \
-B ${build_dir} \
-DBUILD_AOXPC=OFF \
-DBUILD_CPCD=OFF \
-DBUILD_DEV_GUI=OFF \
-DBUILD_EMD=OFF \
-DBUILD_EPC=OFF \
-DBUILD_GMS=OFF \
-DBUILD_IMAGE_PROVIDER=OFF \
-DBUILD_NAL=OFF \
-DBUILD_OTBR=OFF \
-DBUILD_POSITIONING=OFF \
-DBUILD_TESTING=ON \
-DBUILD_UPTI_CAP=OFF \
-DBUILD_UPTI_CAP=OFF \
-DBUILD_UPTI_WRITER=OFF \
-DBUILD_UPVL=OFF \
-DBUILD_ZIGBEED=OFF \
-DBUILD_ZIGPC=OFF

zpc/build: zpc/configure build
@date -u

zpc/test: ${build_dir}/applications/zpc/components/zwave_command_classes/test/
ctest --test-dir ${<}

zpc/default: zpc/configure zpc/build
@date -u

0 comments on commit 6c34ff9

Please sign in to comment.