A Jenkinsfile => Jenkinsfile +110 -0
@@ 0,0 1,110 @@
+pipeline {
+ agent {
+ node {
+ label 'jenkins-slave'
+ }
+
+ }
+ environment {
+ JOBS=15
+ }
+ stages {
+
+ stage('Initial checks') {
+ environment {
+ GITHUB_BASE_REF="${pullRequest.base}"
+ GITHUB_HEAD_REF="${pullRequest.headRef}"
+ }
+ steps {
+ echo "Commit Message check"
+ sh '''#!/bin/bash -e
+pushd ${WORKSPACE}
+./tools/check_commit_messages.py
+popd'''
+ echo "Copyright notice check"
+ sh '''#!/bin/bash -e
+pushd ${WORKSPACE}
+./config/license_header_check.sh --ci --check-only
+popd'''
+ echo "Style checking"
+ sh '''#!/bin/bash -e
+pushd ${WORKSPACE}
+./config/style_check_hook.sh --last
+popd'''
+ }
+ }
+ stage('Build') {
+ parallel {
+ stage('Build RT1051') {
+ agent {
+ node {
+ label 'jenkins-slave'
+ }
+ }
+ steps {
+ sh '''#!/bin/bash -e
+PATH="/usr/local/cmake-3.19.5-Linux-x86_64/bin:/usr/local/gcc-arm-none-eabi-10-2020-q4-major/bin:$PATH"
+export JOBS=${JOBS:-6}
+echo "JOBS=${JOBS}"
+echo "\'workspace dir:${WORKSPACE}\'"
+
+pushd "${WORKSPACE}"
+echo "./configure.sh rt1051 Release -G Ninja"
+
+./configure.sh rt1051 Release -G Ninja
+
+pushd build-rt1051-Release
+ninja -j ${JOBS}
+popd
+popd'''
+ }
+ }
+
+ stage('Build Linux') {
+ agent {
+ node {
+ label 'jenkins-slave'
+ }
+ }
+
+ steps {
+ echo "Build"
+ sh '''#!/bin/bash -e
+PATH="/usr/local/cmake-3.19.5-Linux-x86_64/bin:/usr/local/gcc-arm-none-eabi-10-2020-q4-major/bin:$PATH"
+export JOBS=${JOBS:-6}
+echo "JOBS=${JOBS}"
+echo "\'workspace dir:${WORKSPACE}\'"
+
+pushd "${WORKSPACE}"
+echo "./configure.sh linux Debug -G Ninja"
+
+./configure.sh linux Debug -G Ninja
+
+pushd build-linux-Debug
+ninja -j ${JOBS}
+ninja -j ${JOBS} unittests
+popd
+popd'''
+ echo "Check for Statics"
+ sh '''#!/bin/bash -e
+pushd "${WORKSPACE}"
+./tools/find_global_data.py build-linux-Debug/PurePhone.elf
+popd'''
+ echo "Run Unit Tests"
+ sh '''#!/bin/bash -e
+PATH="/usr/local/cmake-3.19.5-Linux-x86_64/bin:/usr/local/gcc-arm-none-eabi-10-2020-q4-major/bin:$PATH"
+export JOBS=${JOBS:-6}
+echo "JOBS=${JOBS}"
+echo "\'workspace dir:${WORKSPACE}\'"
+
+pushd "${WORKSPACE}"
+./tools/run_unittests.sh enabled_unittests
+./tools/check_unittests.sh
+popd'''
+ }
+ }
+ }
+ }
+
+ }
+}
A doc/CI.md => doc/CI.md +32 -0
@@ 0,0 1,32 @@
+# Continuous Integration
+
+We are using Jenkins as a CI system.
+Each internal PR is checked on the CI, and proper status is
+added to the PR.
+
+## Checks that are done
+Currently we run several checks:
+| Check | Description |
+| ---- | ----------- |
+|Commit Message check | Check if commit message has proper format (see [Development workflow](development_workflow.md)) |
+| Copyright notice check | checks if changed files have proper copyright notice |
+| Style checking | Runs clang-format with style described in `.clang-format` against committed code |
+| Build RT1051 | Compiles code for RT1051 |
+| Build Linux | Compiles code for Linux, runs Unit Tests, and looks for static variables|
+
+## future improvements
+
+- [] Common ccache for all builds
+- [] Add Clang-tidy and persistent reports
+- [] Daily builds moved to CI
+- [] Code Coverage for based on Daily builds
+
+## Jenkinsfile
+
+The current CI pipeline is described in `Jenkinsfile` that is in sources, if a developer needs to
+add some check, it is enough to update the file, the PR will be built with new rules.
+
+In the job description, we may define docker image to use and the parameters that should be set,
+but this may require more knowledge, the easiest way is to use `node.label`.
+Docker templates are defined directly in Jenkins UI, and this simplifies `Jenkinsfile`
+
M docker/Dockerfile.runner.in => docker/Dockerfile.runner.in +3 -1
@@ 9,7 9,9 @@ RUN sed -i'' 's/archive.ubuntu.com/us.archive.ubuntu.com/' /etc/apt/sources.list
RUN apt-get update
RUN apt-get full-upgrade -y
RUN apt-get install -y \
- @INSTALL_PACKAGES@
+ @INSTALL_PACKAGES@
+RUN apt-get -qy autoremove
+RUN apt-get -qy clean
RUN ln -fs /usr/bin/python3 /usr/bin/python
RUN locale-gen pl_PL.UTF-8 \
en_US.UTF-8 \
A docker/jenkins-docker/.ssh/authorized_keys => docker/jenkins-docker/.ssh/authorized_keys +1 -0
@@ 0,0 1,1 @@
+ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDzLY/Gtbzbb4avnbM6pUe/8oL1avb4RntcUGqz0WDVY mudiatOs@jenkins.os.mudita.com
A docker/jenkins-docker/Dockerfile => docker/jenkins-docker/Dockerfile +43 -0
@@ 0,0 1,43 @@
+FROM wearemudita/mudita_os_builder:1.10
+
+MAINTAINER radoslaw.wicik@mudita.com
+# Docker runner for MuditaOS builds
+
+USER root
+
+RUN export DEBIAN_FRONTEND=noninteractive
+
+RUN apt-get update
+RUN apt-get full-upgrade -y
+
+RUN apt-get install -y \
+ openssh-server \
+ openjdk-8-jdk
+
+RUN apt-get -qy clean
+
+#Docker drops audit-related capabilities, removing from pam requirements
+RUN sed -i 's|session required pam_loginuid.so|session optional pam_loginuid.so|g' /etc/pam.d/sshd
+
+RUN sed -i /etc/ssh/sshd_config \
+ -e 's/#PermitRootLogin.*/PermitRootLogin no/' \
+ -e 's/#RSAAuthentication.*/RSAAuthentication yes/' \
+ -e 's/#PasswordAuthentication.*/PasswordAuthentication no/' \
+ -e 's/#SyslogFacility.*/SyslogFacility AUTH/' \
+ -e 's/#LogLevel.*/LogLevel INFO/'
+
+RUN mkdir -p /var/run/sshd
+
+RUN adduser --quiet --gecos '' --disabled-password jenkins
+
+COPY .ssh/authorized_keys /home/jenkins/.ssh/authorized_keys
+COPY start-sshd /usr/local/bin/start-sshd
+RUN chown -R jenkins:jenkins /home/jenkins/.ssh
+
+#RUN chmod -x /cmd.sh && \
+# chmod -x /entrypoint.sh
+
+EXPOSE 22
+
+ENTRYPOINT ["/usr/local/bin/start-sshd"]
+#ENTRYPOINT ["/bin/sleep", "infinity"]
A docker/jenkins-docker/start-sshd => docker/jenkins-docker/start-sshd +7 -0
@@ 0,0 1,7 @@
+#!/bin/bash
+#Date: 2021-04-14 13:31:14
+echo "----"
+echo "$@"
+echo "---"
+[[ "$2" == "-D" ]] && shift 2
+exec /usr/sbin/sshd -D -e $@