add Jenkinsfile to test each PR and branch commits

This includes a basic test that attempts to compile the rustfmt crate.
Ensures that the workspace is always removed at the end of the build. It
utilizes available caches to speed up the build process and parallelizes
the build across i386, x86_64, arm32, and arm64 targets.

Signed-off-by: Derek Straka <derek@asterius.io>
This commit is contained in:
Derek Straka
2016-10-28 13:34:49 -05:00
committed by Doug Goldstein
parent 9dc57a12be
commit 02b0de534d
5 changed files with 58 additions and 2 deletions

36
Jenkinsfile vendored Normal file
View File

@@ -0,0 +1,36 @@
def targets = [ 'qemux86', 'qemux86-64', 'qemuarm', 'qemuarm64' ]
def machine_builds = [:]
for (int i = 0; i < targets.size(); i++) {
def machine = targets.get(i)
machine_builds["$machine"] = {
node {
try {
stage('Checkout') {
checkout scm
}
stage('Setup Environment') {
sh "./scripts/setup-env.sh"
}
stage('Yocto Fetch') {
sh "GIT_LOCAL_REF_DIR=/srv/git-cache/ ./scripts/fetch.sh master"
}
stage('Build') {
sh "MACHINE=${machine} ./scripts/build.sh"
}
} catch (e) {
echo "Caught: ${e}"
throw e
} finally {
stage('Cleanup Environment') {
sh "./scripts/cleanup-env.sh"
deleteDir()
}
}
}
}
}
parallel machine_builds

View File

@@ -220,6 +220,10 @@ BB_DISKMON_DIRS = "\
#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \
#file://.* file:///some/local/dir/sstate/PATH"
SSTATE_MIRRORS ?= "file://.* http://build-cache.asterius.io/sstate/PATH;downloadfilename=PATH \n"
SOURCE_MIRROR_URL ?= "http://build-cache.asterius.io/downloads/"
INHERIT += "own-mirrors rm_work"
#
# Qemu configuration

5
scripts/cleanup-env.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/bash -e
sudo umount build
exit 0

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash -x
# the repos we want to check out, must setup variables below
# NOTE: poky must remain first
@@ -33,7 +33,11 @@ update_repo() {
git fetch origin || die "unable to fetch ${uri}"
else
echo "Cloning '${path}'"
git clone ${uri} ${path} || die "unable to clone ${uri}"
if [ -z "${GIT_LOCAL_REF_DIR}" ]; then
git clone ${uri} ${path} || die "unable to clone ${uri}"
else
git clone --reference ${GIT_LOCAL_REF_DIR}/`basename ${path}` ${uri} ${path}
fi
pushd ${path} > /dev/null
fi

7
scripts/setup-env.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/bin/bash -e
mkdir -p build
sudo mount -t tmpfs -o size=64G,mode=755,uid=${UID} tmpfs build
exit 0