Skip to content

Commit

Permalink
Jenkinfile seed (#6)
Browse files Browse the repository at this point in the history
Integrated Jenkins CI
  • Loading branch information
keithm-xmos authored Oct 9, 2020
1 parent 2516746 commit 0850315
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM continuumio/miniconda3:4.8.2

# This Dockerfile is for use by the XMOS CI system
# It provides a minimal environment needed to execute the Jenkinsfile
# Most of the dependecies here are handled conda so we only include:
# - conda setup
# - xmos tools setup

# fix conda perms
RUN chmod -R 777 /opt/conda \
&& mkdir -p /.conda \
&& chmod -R 777 /.conda

# install tools lib dependencies
RUN apt-get update && apt-get install -y \
libncurses5 libncurses5-dev \
tcl environment-modules \
&& apt-get clean autoclean
# install get_tools.py script
# requires connection to XMOS network at build and run time
# if not possible, find another way to install the tools
RUN mkdir -m 777 /XMOS && cd /XMOS \
&& wget -q https://github0.xmos.com/raw/xmos-int/get_tools/master/get_tools.py \
&& chmod a+x get_tools.py \
&& echo "export MODULES_SILENT_SHELL_DEBUG=1\nexport MODULEPATH=/XMOS/modulefiles:/XMOS/template_modulefiles\nexport PATH=$PATH:/XMOS" \
>> /etc/profile.d/xmos_tools.sh \
&& chmod a+x /etc/profile.d/xmos_tools.sh

# install compiler
RUN apt-get install -y build-essential

# set login shell
SHELL ["/bin/bash", "-l", "-c"]
85 changes: 85 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
@Library('[email protected]') _

getApproval()

pipeline {
agent {
dockerfile {
args ""
}
}

parameters { // Available to modify on the job page within Jenkins if starting a build
string( // use to try different tools versions
name: 'TOOLS_VERSION',
defaultValue: '15.0.2',
description: 'The tools version to build with (check /projects/tools/ReleasesTools/)'
)
booleanParam( // use to check results of rolling all conda deps forward
name: 'UPDATE_ALL',
defaultValue: false,
description: 'Update all conda packages before building'
)
}

options { // plenty of things could go here
//buildDiscarder(logRotator(numToKeepStr: '10'))
timestamps()
}

environment {
XMOS_AIOT_SDK_PATH = "${env.WORKSPACE}"
}

stages {
stage("Setup") {
// Clone and install build dependencies
steps {
// clean auto default checkout
sh "rm -rf *"
// clone
checkout([
$class: 'GitSCM',
branches: scm.branches,
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'SubmoduleOption',
threads: 8,
timeout: 20,
shallow: false,
parentCredentials: true,
recursiveSubmodules: true],
[$class: 'CleanCheckout']],
userRemoteConfigs: [[credentialsId: 'xmos-bot',
url: '[email protected]:xmos/aiot_sdk']]
])
// create venv
sh "conda env create -q -p aiot_sdk_venv -f environment.yml"
// Install xmos tools version
sh "/XMOS/get_tools.py " + params.TOOLS_VERSION
}
}
stage("Update all packages") {
// Roll all conda packages forward beyond their pinned versions
when { expression { return params.UPDATE_ALL } }
steps {
sh "conda update --all -y -q -p aiot_sdk_venv"
}
}
stage("Build examples") {
steps {
sh """pushd /XMOS/tools/${params.TOOLS_VERSION}/XMOS/xTIMEcomposer/${params.TOOLS_VERSION} && . SetEnv && popd &&
. activate ./aiot_sdk_venv && ./build_examples.sh"""
}
}
stage("Build distribution") {
steps {
sh """. activate ./aiot_sdk_venv && ./build_dist.sh"""
}
}
}
post {
cleanup {
cleanWs()
}
}
}
10 changes: 10 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
channels:
- mvdbeek
- bioconda
- conda-forge
- anaconda
- defaults
dependencies:
- cmake=3.14.0
- make=4.2.1
- ncurses=6.1

0 comments on commit 0850315

Please sign in to comment.