diff --git a/.github/actions/build-base/Dockerfile b/.github/actions/build-base/Dockerfile index 4ac87e244..e4de0a417 100644 --- a/.github/actions/build-base/Dockerfile +++ b/.github/actions/build-base/Dockerfile @@ -1,13 +1,35 @@ FROM debian:10 RUN apt-get update && apt-get install -y \ + binutils-mingw-w64-i686 \ + build-essential \ + check \ cmake \ + debhelper \ + fakeroot \ g++ \ + g++-multilib \ gcc \ + gcc-mingw-w64-i686 \ + gcc-mingw-w64-x86-64 \ git \ + graphviz \ + latexmk \ make \ + mingw-w64 \ musl-dev \ + pkg-config \ python \ - py-pip \ + python-pip \ + python-sphinx \ + python3 \ + python3-pip \ + python3-sphinx \ + texinfo \ + texlive-fonts-recommended \ + texlive-generic-extra \ + texlive-latex-extra \ + valgrind \ + wget \ && rm -rf /var/cache/apk/* LABEL "com.github.actions.name"="open62541 build base" @@ -18,3 +40,43 @@ LABEL "com.github.actions.color"="purple" LABEL "repository"="http://github.com/open62541/open62541" LABEL "homepage"="http://open62541.org" LABEL "maintainer"="Pro " + +# Install specific tcc version +RUN mkdir tcc_install && \ + cd tcc_install && \ + wget -nv https://mirror.netcologne.de/savannah/tinycc/tcc-0.9.27.tar.bz2 && \ + tar xf tcc-0.9.27.tar.bz2 && \ + cd tcc-0.9.27 && \ + ./configure && \ + make && \ + make install && \ + cd ../.. && \ + rm -rf tcc_install + +# Install specific mbedtls version +RUN mkdir mbedtls_install && \ + cd mbedtls_install && \ + wget -nv https://github.com/ARMmbed/mbedtls/archive/mbedtls-2.7.1.tar.gz && \ + tar xf mbedtls-2.7.1.tar.gz && \ + cd mbedtls-mbedtls-2.7.1 && \ + cmake -DENABLE_TESTING=Off -DCMAKE_INSTALL_PREFIX=$LOCAL_PKG . && \ + make -j && \ + make install && \ + cd ../.. && \ + rm -rf mbedtls_install + +# Install required python packages + +RUN pip install --user cpp-coveralls +# Pin docutils to version smaller 0.15. Otherwise we run into https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839299 +RUN pip install --user 'docutils<=0.14' +RUN pip install --user sphinx_rtd_theme +RUN pip install --user cpplint + +RUN pip3 install --user cpp-coveralls +# Pin docutils to version smaller 0.15. Otherwise we run into https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839299 +RUN pip3 install --user 'docutils<=0.14' +RUN pip3 install --user sphinx_rtd_theme +RUN pip3 install --user cpplint + +RUN export PATH=/root/.local/bin:$PATH diff --git a/.github/actions/build_debian_package.sh b/.github/actions/build_debian_package.sh new file mode 100755 index 000000000..b38a1d562 --- /dev/null +++ b/.github/actions/build_debian_package.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +set -eu + +echo -e "== Building the Debian package ==" +dpkg-buildpackage -b +if [ $? -ne 0 ] ; then exit 1 ; fi +cp ../open62541*.deb . +# Copy for github release script +cp ../open62541*.deb ../.. diff --git a/.github/actions/build_full_ns0.sh b/.github/actions/build_full_ns0.sh index 75763497d..c9f2e4e38 100755 --- a/.github/actions/build_full_ns0.sh +++ b/.github/actions/build_full_ns0.sh @@ -2,8 +2,10 @@ set -eu -echo -e "\r\n== Unit tests (full NS0) ==" -mkdir -p build && cd build +build_dir=build-full-ns0-$PYTHON + +echo -e "== Build (full NS0) ==" +mkdir -p $build_dir && cd $build_dir # Valgrind cannot handle the full NS0 because the generated file is too big. Thus run NS0 full without valgrind cmake \ diff --git a/.github/main.workflow b/.github/main.workflow index e903f2b93..51b9fbbc5 100644 --- a/.github/main.workflow +++ b/.github/main.workflow @@ -1,27 +1,44 @@ workflow "Build and Deploy" { - on = "push" - resolves = ["Build"] + on = "push" + resolves = ["Build"] } -action "Init Submodules" { - needs = "Init Submodules" - uses = "./.github/actions/build-base" - runs = ["git submodule sync && git submodule update --init --recursive"] +action "Init: Submodules" { + uses = "./.github/actions/build-base" + runs = "sh -c" + args = ["git submodule sync && git submodule update --init --recursive"] } -action "Build Full NS0" { - needs = "Init Submodules" - uses = "./.github/actions/build-base" - runs = ["./.github/actions/build_full_ns0.sh"] +action "Build: Full NS0 (Python2)" { + needs = "Init: Submodules" + uses = "./.github/actions/build-base" + runs = "sh -c" + args = ["export PYTHON=python2 && ./.github/actions/build_full_ns0.sh"] } -action "Unit Test Full NS0" { - needs = "Build Full NS0" - uses = "./.github/actions/build-base" - runs = ["cd build && make test"] +action "Build: Full NS0" { + needs = "Init: Submodules" + uses = "./.github/actions/build-base" + runs = "sh -c" + args = ["export PYTHON=python3 && ./.github/actions/build_full_ns0.sh"] +} + +action "Test: Full NS0" { + needs = ["Build: Full NS0 (Python2)", "Build: Full NS0"] + uses = "./.github/actions/build-base" + runs = "sh -c" + args = ["cd build-full-ns0-python3 && make test"] +} + +action "Test: Debian Packaging" { + needs = "Init: Submodules" + uses = "./.github/actions/build-base" + runs = "sh -c" + args = ["export PYTHON=python2 && ./.github/actions/build_debian_package.sh"] } action "Build" { - needs = ["Unit Test Full NS0"] + uses = "./.github/actions/build-base" + needs = ["Test: Full NS0"] }