Cleanup
This commit is contained in:
parent
37d0af4a7a
commit
8892de6422
143
Jenkinsfile
vendored
143
Jenkinsfile
vendored
@ -2,48 +2,107 @@
|
||||
// see https://jenkins.io/doc/book/pipeline/syntax/
|
||||
|
||||
pipeline {
|
||||
environment {
|
||||
MVN_SET = credentials('maven_settings')
|
||||
}
|
||||
agent { docker { image 'maven:3.6.3' } }
|
||||
triggers {
|
||||
pollSCM "* * * * *"
|
||||
}
|
||||
options {
|
||||
timestamps()
|
||||
ansiColor("xterm")
|
||||
}
|
||||
parameters {
|
||||
booleanParam(name: "RELEASE",
|
||||
description: "Build a release from current commit.",
|
||||
defaultValue: false)
|
||||
}
|
||||
stages {
|
||||
environment {
|
||||
MVN_SET = credentials('maven_settings')
|
||||
JAVA_TOOL_OPTIONS = '-Duser.home=/var/maven'
|
||||
}
|
||||
agent any
|
||||
triggers {
|
||||
pollSCM "* * * * *"
|
||||
}
|
||||
options {
|
||||
timestamps()
|
||||
ansiColor("xterm")
|
||||
}
|
||||
parameters {
|
||||
booleanParam(name: "RELEASE",
|
||||
description: "Build a release from current commit.",
|
||||
defaultValue: false)
|
||||
}
|
||||
stages {
|
||||
stage("Setup workspace") {
|
||||
agent none
|
||||
steps {
|
||||
sh "mkdir -p \"/var/jenkins_cache/.m2\""
|
||||
sh "chown 1000:1000 -R \"/var/jenkins_cache/.m2\""
|
||||
sh "mkdir -p \"/var/jenkins_cache/.ccache\""
|
||||
sh "chown 1000:1000 -R \"/var/jenkins_cache/.ccache\""
|
||||
sh "mkdir -p \"${workspace}/tdlight-java/src/main\""
|
||||
sh "chown 1000:1000 -R \"${workspace}\""
|
||||
sh "chmod 771 -R \"${workspace}\""
|
||||
}
|
||||
}
|
||||
|
||||
stage("Compile C++") {
|
||||
agent {
|
||||
dockerfile {
|
||||
dir 'jenkins/docker'
|
||||
filename 'dockerfile'
|
||||
additionalBuildArgs '--build-arg version=1.0.0 --build-arg UID=1000 --build-arg GID=1000 --build-arg UNAME=jenkins'
|
||||
args "-v \"${workspace}/src/main:/home/jenkins/output:rw\" -v \"/var/jenkins_cache/.m2:/home/jenkins/.m2:rw\" -v \"/var/jenkins_cache/.ccache:/home/jenkins/.ccache:rw\" -v \"${workspace}:/home/jenkins/work:rw\""
|
||||
reuseNode false
|
||||
}
|
||||
}
|
||||
steps {
|
||||
sh "./jenkins/scripts/compile.sh"
|
||||
}
|
||||
}
|
||||
|
||||
stage("Build & Deploy SNAPSHOT") {
|
||||
steps {
|
||||
sh "mvn -s $MVN_SET -B deploy"
|
||||
}
|
||||
}
|
||||
stage("Build & Deploy SNAPSHOT") {
|
||||
agent {
|
||||
docker {
|
||||
image 'maven:3.6.3'
|
||||
args '-v $HOME:/var/maven'
|
||||
reuseNode true
|
||||
}
|
||||
}
|
||||
steps {
|
||||
sh "mvn -s $MVN_SET -B deploy"
|
||||
}
|
||||
}
|
||||
|
||||
stage("Release") {
|
||||
when {
|
||||
expression { params.RELEASE }
|
||||
}
|
||||
steps {
|
||||
sh "mvn -s $MVN_SET -B release:prepare"
|
||||
sh "mvn -s $MVN_SET -B release:perform"
|
||||
}
|
||||
}
|
||||
stage('Deliver') {
|
||||
steps {
|
||||
sh './jenkins/scripts/deliver.sh'
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
deleteDir()
|
||||
}
|
||||
}
|
||||
stage("Release") {
|
||||
agent {
|
||||
docker {
|
||||
image 'maven:3.6.3'
|
||||
args '-v $HOME:/var/maven'
|
||||
reuseNode true
|
||||
}
|
||||
}
|
||||
when {
|
||||
expression { params.RELEASE }
|
||||
}
|
||||
steps {
|
||||
sh "mvn -s $MVN_SET -B release:prepare"
|
||||
sh "mvn -s $MVN_SET -B release:perform"
|
||||
}
|
||||
}
|
||||
stage('Deliver') {
|
||||
agent {
|
||||
docker {
|
||||
image 'maven:3.6.3'
|
||||
args '-v $HOME:/var/maven'
|
||||
reuseNode true
|
||||
}
|
||||
}
|
||||
steps {
|
||||
sh './jenkins/scripts/deliver.sh'
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
dir("${workspace}/tdlight-java") {
|
||||
deleteDir()
|
||||
}
|
||||
/* clean up tmp directory */
|
||||
dir("${workspace}@tmp") {
|
||||
deleteDir()
|
||||
}
|
||||
/* clean up script directory */
|
||||
dir("${workspace}@script") {
|
||||
deleteDir()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
60
jenkins/docker/dockerfile
Normal file
60
jenkins/docker/dockerfile
Normal file
@ -0,0 +1,60 @@
|
||||
FROM debian:stable-slim
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
RUN apt-get update && apt-get upgrade -y
|
||||
|
||||
RUN apt-get install wget -y
|
||||
|
||||
RUN wget https://cdn.azul.com/zulu/bin/zulu15.27.17-ca-jdk15.0.0-linux_amd64.deb -O /tmp/install.deb 2>/dev/null
|
||||
|
||||
RUN mkdir -p /usr/share/man/man1
|
||||
|
||||
RUN apt-get install /tmp/install.deb -y
|
||||
|
||||
RUN rm /tmp/install.deb
|
||||
|
||||
RUN apt-get install maven -y
|
||||
|
||||
RUN apt-get install gcc gperf cmake ccache -y
|
||||
|
||||
RUN apt-get install libssl-dev liblz4-dev libgflags-dev zlib1g-dev -y
|
||||
|
||||
RUN apt-get install build-essential -y
|
||||
|
||||
RUN apt-get install python3 -y
|
||||
|
||||
RUN apt-get install libreadline-dev git -y
|
||||
|
||||
#RUN ./build.sh
|
||||
|
||||
#ENTRYPOINT [ "/bin/bash" ]
|
||||
|
||||
ARG UNAME=debian
|
||||
ARG UID=1000
|
||||
ARG GID=1000
|
||||
RUN groupadd -g $GID -o $UNAME
|
||||
RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME
|
||||
USER $UNAME
|
||||
|
||||
RUN mkdir /home/$UNAME/work
|
||||
|
||||
RUN mkdir /home/$UNAME/output
|
||||
|
||||
WORKDIR /home/$UNAME/work
|
||||
|
||||
ENV CCACHE_DIR=/home/$UNAME/.ccache
|
||||
|
||||
ENV JAVA_HOME=/usr/lib/jvm/zulu-15-amd64
|
||||
|
||||
ENV JAVA_INCLUDE_PATH=/usr/lib/jvm/zulu-15-amd64/include
|
||||
|
||||
ENV TRAVIS_CPU_ARCH=amd64
|
||||
|
||||
ENV TRAVIS_OS_NAME=linux
|
||||
|
||||
ENV TRAVIS_BUILD_DIR=/home/$UNAME/work/tdlight-java
|
||||
|
||||
ENV TRAVIS_OUTPUT_DIR=/home/$UNAME/output
|
||||
|
||||
CMD ["bash"]
|
37
jenkins/scripts/compile.sh
Executable file
37
jenkins/scripts/compile.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#!/bin/bash -e
|
||||
# ====== Setup environment variables
|
||||
source ./jenkins/scripts/setup_variables.sh
|
||||
|
||||
# ====== Setup workspace
|
||||
bash ./jenkins/scripts/setup_workspace.sh
|
||||
|
||||
# ====== Build Td
|
||||
# Prepare build
|
||||
cd $TD_BUILD_DIR
|
||||
nice -n 5 cmake -DCMAKE_BUILD_TYPE=Release -DTD_ENABLE_JNI=ON -DCMAKE_INSTALL_PREFIX:PATH=${TD_BIN_DIR} ${TD_SRC_DIR}
|
||||
|
||||
# Split sources
|
||||
nice -n 5 cmake --build $TD_BUILD_DIR --target prepare_cross_compiling -- -j${TRAVIS_CPU_CORES}
|
||||
cd $TD_SRC_DIR
|
||||
nice -n 5 php SplitSource.php
|
||||
|
||||
# Build
|
||||
cd $TD_BUILD_DIR
|
||||
nice -n 5 cmake --build $TD_BUILD_DIR --target install --config Release -- -j${TRAVIS_CPU_CORES}
|
||||
|
||||
cd $TD_SRC_DIR
|
||||
nice -n 5 php SplitSource.php --undo
|
||||
|
||||
# ====== Build TdNatives
|
||||
cd $TDNATIVES_CPP_BUILD_DIR
|
||||
nice -n 5 cmake -DCMAKE_BUILD_TYPE=Release -DTD_BIN_DIR=${TD_BIN_DIR} -DTDNATIVES_BIN_DIR=${TDNATIVES_BIN_DIR} -DTDNATIVES_DOCS_BIN_DIR=${TDNATIVES_DOCS_BIN_DIR} -DTd_DIR=${TD_BIN_DIR}/lib/cmake/Td -DJAVA_SRC_DIR=${JAVA_SRC_DIR} -DTDNATIVES_CPP_SRC_DIR:PATH=$TDNATIVES_CPP_SRC_DIR $TDNATIVES_CPP_SRC_DIR
|
||||
nice -n 5 cmake --build $TDNATIVES_CPP_BUILD_DIR --target install --config Release -- -j${TRAVIS_CPU_CORES}
|
||||
|
||||
# ====== Print results stats
|
||||
echo "CCACHE statistics:"
|
||||
ccache -s
|
||||
|
||||
# ====== Copy output
|
||||
cd $TDNATIVES_CPP_BUILD_DIR
|
||||
mkdir -p $TDLIB_RESOURCES_OUTPUT_DIR
|
||||
mv $TDNATIVES_BIN_DIR/$SRC_TDJNI_LIBNAME $TDLIB_RESOURCES_OUTPUT_DIR/$DEST_TDJNI_LIBNAME
|
57
jenkins/scripts/setup_variables.sh
Executable file
57
jenkins/scripts/setup_variables.sh
Executable file
@ -0,0 +1,57 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# ====== Variables
|
||||
export TD_SRC_DIR=$TRAVIS_BUILD_DIR/dependencies/tdlib
|
||||
export TD_BIN_DIR=$TRAVIS_BUILD_DIR/bin-td
|
||||
export TDNATIVES_BIN_DIR=$TRAVIS_BUILD_DIR/bin-tdlib
|
||||
export TDNATIVES_CPP_SRC_DIR=$TRAVIS_BUILD_DIR/src/tdlib-cpp
|
||||
export TDNATIVES_DOCS_BIN_DIR=$TRAVIS_BUILD_DIR/bin-docs
|
||||
export TD_BUILD_DIR=$TRAVIS_BUILD_DIR/build-td
|
||||
export TDNATIVES_CPP_BUILD_DIR=$TRAVIS_BUILD_DIR/build-tdlib
|
||||
export JAVA_SRC_DIR=$TRAVIS_BUILD_DIR/src/tdlib-java
|
||||
export TDLIB_SERIALIZER_DIR=$TRAVIS_BUILD_DIR/dependencies/tdlib-serializer
|
||||
export MAVEN_OPTS="--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/javax.crypto=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED"
|
||||
TRAVIS_CPU_ARCH_STANDARD="$(tr '[:upper:]' '[:lower:]'<<<"${TRAVIS_CPU_ARCH}")"
|
||||
export TRAVIS_CPU_ARCH_STANDARD;
|
||||
export TRAVIS_CPU_CORES="2"
|
||||
TRAVIS_OS_NAME_STANDARD="$(tr '[:upper:]' '[:lower:]'<<<"${TRAVIS_OS_NAME}")"
|
||||
export TRAVIS_OS_NAME_STANDARD
|
||||
export TRAVIS_OS_NAME_SHORT=$TRAVIS_OS_NAME_STANDARD
|
||||
export SRC_TDJNI_LIBNAME="libtdjni.so"
|
||||
export DEST_TDJNI_LIBNAME="tdjni.so"
|
||||
|
||||
# ====== OS Variables
|
||||
TRAVIS_CPU_ARCH_JAVA="$(tr '[:upper:]' '[:lower:]'<<<"${TRAVIS_CPU_ARCH}")"
|
||||
export TRAVIS_CPU_ARCH_JAVA
|
||||
export TDLIB_RESOURCES_OUTPUT_DIR="$TRAVIS_OUTPUT_DIR/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD"
|
||||
|
||||
# ====== Print variables
|
||||
echo "TD_SRC_DIR=${TD_SRC_DIR}"
|
||||
echo "TD_BIN_DIR=${TD_BIN_DIR}"
|
||||
echo "TDNATIVES_BIN_DIR=${TDNATIVES_BIN_DIR}"
|
||||
echo "TDNATIVES_CPP_SRC_DIR=${TDNATIVES_CPP_SRC_DIR}"
|
||||
echo "TDNATIVES_DOCS_BIN_DIR=${TDNATIVES_DOCS_BIN_DIR}"
|
||||
echo "TD_BUILD_DIR=${TD_BUILD_DIR}"
|
||||
echo "TDNATIVES_CPP_BUILD_DIR=${TDNATIVES_CPP_BUILD_DIR}"
|
||||
echo "JAVA_SRC_DIR=${JAVA_SRC_DIR}"
|
||||
echo "TDLIB_SERIALIZER_DIR=${TDLIB_SERIALIZER_DIR}"
|
||||
echo "PATH=${PATH}"
|
||||
echo "JAVA_HOME=${JAVA_HOME}"
|
||||
echo "JAVA_INCLUDE_PATH=${JAVA_INCLUDE_PATH}"
|
||||
echo "JAVA_INCLUDE_PATH2=${JAVA_INCLUDE_PATH2}"
|
||||
echo "JAVA_AWT_INCLUDE_PATH=${JAVA_AWT_INCLUDE_PATH}"
|
||||
echo "VCPKG_DIR=${VCPKG_DIR}"
|
||||
echo "MAVEN_OPTS=${MAVEN_OPTS}"
|
||||
echo "TRAVIS_CPU_ARCH=${TRAVIS_CPU_ARCH}"
|
||||
echo "TRAVIS_CPU_ARCH_JAVA=${TRAVIS_CPU_ARCH_JAVA}"
|
||||
echo "TRAVIS_CPU_ARCH_STANDARD=${TRAVIS_CPU_ARCH_STANDARD}"
|
||||
echo "TRAVIS_OS_NAME=${TRAVIS_OS_NAME}"
|
||||
echo "TRAVIS_OS_NAME_STANDARD=${TRAVIS_OS_NAME_STANDARD}"
|
||||
echo "TRAVIS_OS_NAME_SHORT=${TRAVIS_OS_NAME_SHORT}"
|
||||
echo "SRC_TDJNI_LIBNAME=${SRC_TDJNI_LIBNAME}"
|
||||
echo "DEST_TDJNI_LIBNAME=${DEST_TDJNI_LIBNAME}"
|
||||
echo "TDLIB_RESOURCES_OUTPUT_DIR=${TDLIB_RESOURCES_OUTPUT_DIR}"
|
||||
echo "CURRENT DIRECTORY* ($(pwd)):"
|
||||
ls -alch "$(pwd)"
|
||||
echo "WORK DIRECTORY CONTENT* (${TRAVIS_BUILD_DIR}):"
|
||||
ls -alch "$TRAVIS_BUILD_DIR"
|
10
jenkins/scripts/setup_workspace.sh
Executable file
10
jenkins/scripts/setup_workspace.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash -e
|
||||
# ====== Setup environment variables
|
||||
source ./jenkins/scripts/setup_variables.sh
|
||||
|
||||
# ====== Environment setup
|
||||
[ -d $TD_BUILD_DIR ] || mkdir $TD_BUILD_DIR
|
||||
[ -d $TDNATIVES_CPP_BUILD_DIR ] || mkdir $TDNATIVES_CPP_BUILD_DIR
|
||||
|
||||
echo "CCACHE statistics:"
|
||||
ccache -s
|
Loading…
x
Reference in New Issue
Block a user