mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-11 06:46:03 +00:00
Added jenkinsfile
This commit is contained in:
parent
70e0a33f98
commit
014191a663
32
Dockerfile
32
Dockerfile
@ -1,8 +1,34 @@
|
|||||||
FROM ubuntu:xenial
|
FROM ubuntu:xenial
|
||||||
|
|
||||||
RUN apt-get update && \
|
# Install the JDK
|
||||||
apt-get install -y curl && \
|
# We are going to need some 32 bit binaries because aapt requires it
|
||||||
|
# file is need by the script that creates NDK toolchains
|
||||||
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
RUN dpkg --add-architecture i386 && \
|
||||||
|
apt-get update -qq && \
|
||||||
|
apt-get install -y file git curl wget zip unzip bsdmainutils strace lsof \
|
||||||
|
build-essential libc6:i386 software-properties-common \
|
||||||
|
libstdc++6:i386 libgcc1:i386 libncurses5:i386 libz1:i386 \
|
||||||
|
s3cmd libconfig++9v5 python build-essential && \
|
||||||
curl -sL https://deb.nodesource.com/setup_4.x | bash - && \
|
curl -sL https://deb.nodesource.com/setup_4.x | bash - && \
|
||||||
apt-get install -y nodejs gcc-4.9 python build-essential
|
apt-get install -y nodejs && \
|
||||||
|
echo oracle-java6-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
|
||||||
|
add-apt-repository -y ppa:webupd8team/java && \
|
||||||
|
apt-get update -qq && \
|
||||||
|
apt-get install -y oracle-java8-installer && \
|
||||||
|
rm -rf /var/cache/oracle-jdk8-installer && \
|
||||||
|
apt-get clean
|
||||||
|
|
||||||
ENV NPM_CONFIG_UNSAFE_PERM true
|
ENV NPM_CONFIG_UNSAFE_PERM true
|
||||||
|
|
||||||
|
# Locales
|
||||||
|
RUN locale-gen en_US.UTF-8
|
||||||
|
ENV LANG "en_US.UTF-8"
|
||||||
|
ENV LANGUAGE "en_US.UTF-8"
|
||||||
|
ENV LC_ALL "en_US.UTF-8"
|
||||||
|
|
||||||
|
# ENV PATH ${PATH}:${NDK_HOME}
|
||||||
|
|
||||||
|
# Install writable dir
|
||||||
|
RUN mkdir /tmp/opt && chmod 777 /tmp/opt
|
||||||
|
|
||||||
|
126
Jenkinsfile
vendored
Normal file
126
Jenkinsfile
vendored
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
#!groovy
|
||||||
|
import groovy.json.JsonOutput
|
||||||
|
|
||||||
|
repoName = 'realm-js' // This is a global variable
|
||||||
|
|
||||||
|
def getSourceArchive() {
|
||||||
|
checkout scm
|
||||||
|
sh 'git clean -ffdx -e .????????'
|
||||||
|
sshagent(['realm-ci-ssh']) {
|
||||||
|
sh 'git submodule update --init --recursive'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def readGitTag() {
|
||||||
|
sh "git describe --exact-match --tags HEAD | tail -n 1 > tag.txt 2>&1 || true"
|
||||||
|
def tag = readFile('tag.txt').trim()
|
||||||
|
return tag
|
||||||
|
}
|
||||||
|
|
||||||
|
def readGitSha() {
|
||||||
|
sh "git rev-parse HEAD | cut -b1-8 > sha.txt"
|
||||||
|
def sha = readFile('sha.txt').readLines().last().trim()
|
||||||
|
return sha
|
||||||
|
}
|
||||||
|
|
||||||
|
def getVersion(){
|
||||||
|
def dependencies = readProperties file: 'dependencies.list'
|
||||||
|
def gitTag = readGitTag()
|
||||||
|
def gitSha = readGitSha()
|
||||||
|
if (gitTag == "") {
|
||||||
|
return "${dependencies.VERSION}-g${gitSha}"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return dependencies.VERSION
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def setBuildName(newBuildName) {
|
||||||
|
currentBuild.displayName = "${currentBuild.displayName} - ${newBuildName}"
|
||||||
|
}
|
||||||
|
|
||||||
|
def gitTag
|
||||||
|
def gitSha
|
||||||
|
def dependencies
|
||||||
|
def version
|
||||||
|
|
||||||
|
stage('check') {
|
||||||
|
node('docker') {
|
||||||
|
getSourceArchive()
|
||||||
|
|
||||||
|
dependencies = readProperties file: 'dependencies.list'
|
||||||
|
|
||||||
|
gitTag = readGitTag()
|
||||||
|
gitSha = readGitSha()
|
||||||
|
version = getVersion()
|
||||||
|
echo "tag: ${gitTag}"
|
||||||
|
if (gitTag == "") {
|
||||||
|
echo "No tag given for this build"
|
||||||
|
setBuildName("${gitSha}")
|
||||||
|
} else {
|
||||||
|
if (gitTag != "v${dependencies.VERSION}") {
|
||||||
|
echo "Git tag '${gitTag}' does not match v${dependencies.VERSION}"
|
||||||
|
} else {
|
||||||
|
echo "Building release: '${gitTag}'"
|
||||||
|
setBuildName("Tag ${gitTag}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo "version: ${version}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def doDockerBuild(target, postStep = null) {
|
||||||
|
return {
|
||||||
|
timeout(50) { // minutes
|
||||||
|
node('docker') {
|
||||||
|
getSourceArchive()
|
||||||
|
sh "bash scripts/docker-test.sh ${target}"
|
||||||
|
if(postStep) {
|
||||||
|
postStep.call()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def doBuild(nodeSpec, target, postStep = null) {
|
||||||
|
return {
|
||||||
|
timeout(50) { // minutes
|
||||||
|
node(nodeSpec) {
|
||||||
|
getSourceArchive()
|
||||||
|
sh "bash scripts/test.sh ${target}"
|
||||||
|
if(postStep) {
|
||||||
|
postStep.call()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('build') {
|
||||||
|
parallel(
|
||||||
|
eslint: doDockerBuild('eslint-ci', {
|
||||||
|
step([$class: 'CheckStylePublisher', canComputeNew: false, canRunOnFailed: true, defaultEncoding: '', healthy: '', pattern: 'eslint.xml', unHealthy: ''])
|
||||||
|
}),
|
||||||
|
jsdoc: doDockerBuild('jsdoc', {
|
||||||
|
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, keepAll: false, reportDir: 'docs/output', reportFiles: 'index.html', reportName: 'Docs'])
|
||||||
|
}),
|
||||||
|
linux_node_debug: doDockerBuild('node Debug'),
|
||||||
|
linux_node_release: doDockerBuild('node Release'),
|
||||||
|
linux_test_runners: doDockerBuild('test-runners'),
|
||||||
|
macos_node_debug: doBuild('osx_vegas', 'node Debug'),
|
||||||
|
macos_node_release: doBuild('osx_vegas', 'node Release'),
|
||||||
|
macos_realmjs_debug: doBuild('osx_vegas', 'realmjs Debug'),
|
||||||
|
macos_realmjs_release: doBuild('osx_vegas', 'realmjs Release'),
|
||||||
|
macos_react_tests_debug: doBuild('osx_vegas', 'react-tests Debug'),
|
||||||
|
macos_react_tests_release: doBuild('osx_vegas', 'react-tests Release', {
|
||||||
|
junit 'build/reports/junit.xml'
|
||||||
|
}),
|
||||||
|
macos_react_example_debug: doBuild('osx_vegas', 'react-example Debug'),
|
||||||
|
macos_react_example_release: doBuild('osx_vegas', 'react-example Release'),
|
||||||
|
android_react_tests: doBuild('FastLinux', 'react-tests-android', {
|
||||||
|
sh "cat tests/react-test-app/tests.xml"
|
||||||
|
junit 'tests/react-test-app/tests.xml'
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
17
scripts/docker-wrapper.sh
Executable file
17
scripts/docker-wrapper.sh
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# This is a wrapper script which uses docker. It allows you to run commands
|
||||||
|
# in a docker environment.
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cmd=${@:-/bin/bash}
|
||||||
|
|
||||||
|
./scripts/docker_build_wrapper.sh ci/realm-js:build .
|
||||||
|
|
||||||
|
exec docker run --rm \
|
||||||
|
-u $(id -u) \
|
||||||
|
-e HOME=/tmp \
|
||||||
|
-v $(pwd):/source \
|
||||||
|
-w /source \
|
||||||
|
ci/realm-js:build \
|
||||||
|
${cmd}
|
@ -112,6 +112,11 @@ case "$TARGET" in
|
|||||||
npm install
|
npm install
|
||||||
npm run lint .
|
npm run lint .
|
||||||
;;
|
;;
|
||||||
|
"eslint-ci")
|
||||||
|
[[ $CONFIGURATION == 'Debug' ]] && exit 0
|
||||||
|
npm install
|
||||||
|
./node_modules/.bin/eslint -f checkstyle . > eslint.xml || true
|
||||||
|
;;
|
||||||
"jsdoc")
|
"jsdoc")
|
||||||
[[ $CONFIGURATION == 'Debug' ]] && exit 0
|
[[ $CONFIGURATION == 'Debug' ]] && exit 0
|
||||||
npm install
|
npm install
|
||||||
|
Loading…
x
Reference in New Issue
Block a user