Skip to content

Commit

Permalink
add Jenkins integration (thanks to @BerndDoser)
Browse files Browse the repository at this point in the history
  • Loading branch information
amkozlov committed Aug 10, 2022
1 parent 849e85a commit 816f9d1
Show file tree
Hide file tree
Showing 13 changed files with 631 additions and 6 deletions.
39 changes: 39 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.187.0/containers/cpp/.devcontainer/base.Dockerfile

# [Choice] Debian / Ubuntu version: debian-10, debian-9, ubuntu-20.04, ubuntu-18.04
ARG VARIANT="buster"
FROM mcr.microsoft.com/vscode/devcontainers/cpp:0-${VARIANT}

RUN apt-get update \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends \
bison \
cmake \
flex \
libgmp3-dev \
libgtest-dev \
libopenmpi-dev \
ninja-build \
openmpi-bin \
openmpi-common \
python3-dev \
python3-pip \
python3-pip \
python3-setuptools \
vim \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN pip install \
beautifulsoup4 \
cmake \
lxml

RUN git clone https://github.com/jeetsukumaran/DendroPy.git \
&& cd DendroPy \
&& python3 setup.py install \
&& cd .. \
&& rm -rf DendroPy

RUN useradd --uid 1026 -m user
USER user
30 changes: 30 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.187.0/containers/cpp
{
"name": "C++",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick an Debian / Ubuntu OS version: debian-10, debian-9, ubuntu-20.04, ubuntu-18.04
"args": { "VARIANT": "ubuntu-20.04" }
},
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"],

// Set *default* container specific settings.json values on container create.
"settings": {},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-vscode.cpptools",
"twxs.cmake",
"ms-vscode.cmake-tools"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": []

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "user"
}
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cmake.configureSettings": {
"USE_MPI": "ON"
}
}
184 changes: 184 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
#!groovy

pipeline {

agent {
label 'cme-eastwatch'
}

options {
timeout(time: 1, unit: 'HOURS')
}

parameters {
string(name: 'BUILD_DIR_CLANG', defaultValue: 'build-clang-12')
string(name: 'BUILD_DIR_GCC', defaultValue: 'build-gcc-11')
string(name: 'BUILD_DIR_GCC_OPENMPI', defaultValue: 'build-gcc-11-openmpi')
}

stages {
stage('Submodules') {
agent {
dockerfile {
reuseNode true
filename 'dockerfile-clang-12'
dir 'ci'
}
}
steps {
sh '''
git submodule update --init --recursive
git submodule add https://github.com/amkozlov/ngtest.git
'''
}
}
stage('Build') {
parallel {
stage('clang-12') {
agent {
dockerfile {
reuseNode true
filename 'dockerfile-clang-12'
dir 'ci'
}
}
steps {
sh """
rm -fr ${params.BUILD_DIR_CLANG} && mkdir -p ${params.BUILD_DIR_CLANG} && cd ${params.BUILD_DIR_CLANG}
cmake -DCMAKE_BUILD_TYPE=Release .. 2>&1 |tee cmake.out
make 2>&1 |tee make.out
"""
}
post {
always {
recordIssues enabledForFailure: true, aggregatingResults: false,
tool: clang(id: 'clang-12', pattern: "${params.BUILD_DIR_CLANG}/make.out")
}
}
}
stage('gcc-11') {
agent {
dockerfile {
reuseNode true
filename 'dockerfile-gcc-11'
dir 'ci'
}
}
steps {
sh """
rm -fr ${params.BUILD_DIR_GCC} && mkdir -p ${params.BUILD_DIR_GCC} && cd ${params.BUILD_DIR_GCC}
cmake -DCMAKE_BUILD_TYPE=Release .. 2>&1 |tee cmake.out
make 2>&1 |tee make.out
"""
}
post {
always {
recordIssues enabledForFailure: true, aggregatingResults: false,
tool: clang(id: 'gcc-11', pattern: "${params.BUILD_DIR_GCC}/make.out")
}
}
}
stage('gcc-11-openmpi') {
agent {
dockerfile {
reuseNode true
filename 'dockerfile-gcc-11'
dir 'ci'
}
}
steps {
sh """
rm -fr ${params.BUILD_DIR_GCC_OPENMPI} && mkdir -p ${params.BUILD_DIR_GCC_OPENMPI} && cd ${params.BUILD_DIR_GCC_OPENMPI}
cmake -DCMAKE_BUILD_TYPE=Release -DUSE_MPI=ON .. 2>&1 |tee cmake.out
make 2>&1 |tee make.out
"""
}
post {
always {
recordIssues enabledForFailure: true, aggregatingResults: false,
tool: clang(id: "${STAGE_NAME}", pattern: "${params.BUILD_DIR_GCC_OPENMPI}/make.out")
}
}
}
}
}
stage('Unit tests') {
parallel {
stage('clang-12') {
agent {
dockerfile {
reuseNode true
filename 'dockerfile-clang-12'
dir 'ci'
}
}
steps {
sh "cd ${params.BUILD_DIR_CLANG} && make test"
}
post {
always {
step([
$class: 'XUnitPublisher',
thresholds: [[$class: 'FailedThreshold', unstableThreshold: '1']],
tools: [[$class: 'GoogleTestType', pattern: "${params.BUILD_DIR_CLANG}/test/*.xml"]]
])
}
}
}
stage('gcc-11') {
agent {
dockerfile {
reuseNode true
filename 'dockerfile-gcc-11'
dir 'ci'
}
}
steps {
sh "cd ${params.BUILD_DIR_GCC} && make test"
}
post {
always {
step([
$class: 'XUnitPublisher',
thresholds: [[$class: 'FailedThreshold', unstableThreshold: '1']],
tools: [[$class: 'GoogleTestType', pattern: "${params.BUILD_DIR_GCC}/test/*.xml"]]
])
}
}
}
}
}
stage('Regression tests') {
agent {
dockerfile {
reuseNode true
filename 'dockerfile-clang-12'
dir 'ci'
}
}
steps {
sh """
ngtest/runtest.py ${params.BUILD_DIR_CLANG}/bin/raxml-ng
cd ci && ./generate_html.py ../ngtest/out/1.1.0-master/T1W1
"""
}
post {
always {
publishHTML(target : [
allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'ci',
reportFiles: 'benchmark.html',
reportName: 'Benchmark',
reportTitles: 'Benchmark'])
}
}
}
}
post {
failure {
mail to: '[email protected]', subject: "FAILURE: ${currentBuild.fullDisplayName}", body: "Failed."
}
}
}
96 changes: 96 additions & 0 deletions Jenkinsfile-large-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#!groovy

pipeline {

agent {
label 'cme-eastwatch'
}

stages {
stage('Checkout') {
steps {
// Get some code from a GitHub repository
git branch: 'ci',
url: 'https://github.com/BerndDoser/raxml-ng.git'
sh '''
git submodule update --init --recursive
git submodule add https://github.com/amkozlov/ngtest.git
'''
}
}
stage('Build') {
agent {
dockerfile {
reuseNode true
filename 'dockerfile-gcc-11'
dir 'ci'
}
}
steps {
sh '''
rm -fr build && mkdir -p build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DUSE_MPI=ON .. 2>&1 |tee cmake.out
make 2>&1 |tee make.out
'''
}
}
stage('Benchmark matrix') {
matrix {
axes {
axis {
name 'PARALLEL'
values '-np 1 build/bin/raxml-ng-mpi --threads 1',
'-np 3 build/bin/raxml-ng-mpi --threads 2 --workers 1',
'-np 3 build/bin/raxml-ng-mpi --threads 2 --workers 3'
}
}
stages {
stage('Benchmark') {
agent {
dockerfile {
reuseNode true
filename 'dockerfile-gcc-11'
dir 'ci'
}
}
options {
lock('synchronous-matrix')
}
environment {
LOCATION = sh (returnStdout: true, script: "ci/get_parallel_prefix.sh \"$PARALLEL\"").trim()
}
steps {
sh """
mkdir -p out/${LOCATION}
mpirun ${PARALLEL} --all --msa ngtest/data/dna8.fa --model GTR+G --brlen linked \
--prefix out/${LOCATION}/test --redo --seed 1
"""
}
}
}
}
}
stage('Publish benchmarks') {
steps {
sh "cd ci && ./generate_html.py ../out"
}
post {
always {
publishHTML(target : [
allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: 'ci',
reportFiles: 'benchmark.html',
reportName: 'Benchmark',
reportTitles: 'Benchmark'])
}
}
}
}
post {
failure {
mail to: '[email protected]', subject: "FAILURE: ${currentBuild.fullDisplayName}", body: "Failed."
}
}
}
33 changes: 33 additions & 0 deletions ci/dockerfile-clang-12
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM silkeh/clang:12

LABEL maintainer="Bernd Doser <[email protected]>"

RUN apt-get update \
&& apt-get install -y \
bison \
cmake \
flex \
libgmp3-dev \
libgtest-dev \
libopenmpi-dev \
openmpi-bin \
openmpi-common \
python3 \
python3-dev \
python3-pip \
python3-setuptools \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN git clone https://github.com/jeetsukumaran/DendroPy.git \
&& cd DendroPy \
&& python3 setup.py install \
&& cd .. \
&& rm -rf DendroPy

RUN pip install \
beautifulsoup4 \
lxml

ENV CC clang
ENV CXX clang++
Loading

0 comments on commit 816f9d1

Please sign in to comment.