1
0
Fork 0

added stages

This commit is contained in:
Christian Kühnel 2020-01-16 17:48:07 +01:00
parent b35a00dc57
commit 371ff6041f

View file

@ -13,8 +13,10 @@
// limitations under the License.
pipeline {
agent none
triggers {
pollSCM '*/5 * * * *'
pollSCM 'H/5 * * * *'
}
environment {
MY_BUILD_ID = "${JOB_BASE_NAME}-${BUILD_NUMBER}"
@ -23,117 +25,119 @@ pipeline {
RESULT_DIR = "${WORKSPACE}\\results"
LLVM_DIR = "${WORKSPACE}\\llvm-project"
}
stage("build and test on Windows and Linux"){
parallel {
stage("Linux"){
agent { label "linux"}
stages {
stage("git checkout"){
steps {
git url: 'https://github.com/llvm/llvm-project.git', branch: 'release/10.x'
sh 'git clean -fdx'
dir("llvm-premerge-checks")
{
git url: 'https://github.com/google/llvm-premerge-checks.git'
}
sh 'rm -rf build || true'
sh 'mkdir -p build'
sh 'mkdir -p "${TARGET_DIR}"'
}
}
stage('CMake') {
steps {
sh "${SCRIPT_DIR}/run_cmake.sh"
}
}
stage('ninja all') {
steps {
sh "${SCRIPT_DIR}/run_ninja.sh all"
}
}
stage('ninja check-all') {
steps {
sh "${SCRIPT_DIR}/run_ninja.sh check-all"
}
}
}
post {
always {
echo "Console log is available at https://results.new.llvm-merge-guard.org/${MY_BUILD_ID}"
dir("${env.TARGET_DIR}") {
// copy console log to result folder
sh "wget -qO console-log.txt http://jenkins-ui.jenkins.svc.cluster.local:8080/job/${JOB_BASE_NAME}/${BUILD_NUMBER}/consoleText"
// TODO: move all file copy operations here
// junit 'build/*.xml'
}
}
}
}
stage("Windows"){
agent { label "windows"}
stages {
stage("git checkout"){
steps {
echo "getting llvm-premerge-checks... "
dir("llvm-premerge-checks")
{
git url: 'https://github.com/google/llvm-premerge-checks.git'
}
echo "getting llvm-project... "
dir("llvm-project")
{
stages {
stage("build and test on Windows and Linux"){
parallel {
stage("Linux"){
agent { label "linux"}
stages {
stage("git checkout"){
steps {
git url: 'https://github.com/llvm/llvm-project.git', branch: 'release/10.x'
sh 'git clean -fdx'
dir("llvm-premerge-checks")
{
git url: 'https://github.com/google/llvm-premerge-checks.git'
}
sh 'rm -rf build || true'
sh 'mkdir -p build'
sh 'mkdir -p "${TARGET_DIR}"'
}
powershell "New-Item -ItemType Directory -Force -Path ${RESULT_DIR}"
}
}
stage('CMake') {
steps {
dir("${LLVM_DIR}"){
powershell "${SCRIPT_DIR}/run_cmake.ps1"
}
stage('CMake') {
steps {
sh "${SCRIPT_DIR}/run_cmake.sh"
}
}
stage('ninja all') {
steps {
sh "${SCRIPT_DIR}/run_ninja.sh all"
}
}
stage('ninja check-all') {
steps {
sh "${SCRIPT_DIR}/run_ninja.sh check-all"
}
}
}
stage('ninja all') {
steps {
dir("${LLVM_DIR}"){
powershell "${SCRIPT_DIR}/run_ninja.ps1 all"
post {
always {
echo "Console log is available at https://results.new.llvm-merge-guard.org/${MY_BUILD_ID}"
dir("${env.TARGET_DIR}") {
// copy console log to result folder
sh "wget -qO console-log.txt http://jenkins-ui.jenkins.svc.cluster.local:8080/job/${JOB_BASE_NAME}/${BUILD_NUMBER}/consoleText"
// TODO: move all file copy operations here
// junit 'build/*.xml'
}
}
}
stage('ninja check-all') {
steps {
dir("${LLVM_DIR}"){
powershell "${SCRIPT_DIR}/run_ninja.ps1 check-all"
}
}
}
}
}
post {
always {
echo "Logs uploaded to https://pantheon.corp.google.com/storage/browser/llvm-premerge-checks/results/${MY_BUILD_ID}."
dir("${env.RESULT_DIR}") {
// gather all result files in a folder, then upload everything to
// Google Cloud Storage
powershell """
# get the console log
Invoke-WebRequest -OutFile console-log.txt -uri "http://jenkins.local:8080/job/${JOB_BASE_NAME}/${BUILD_NUMBER}/consoleText" -ErrorAction "Continue"
Copy-Item "${LLVM_DIR}\\build\\CMakeCache.txt"
Copy-Item "${LLVM_DIR}\\build\\test-results.xml"
# upload files
\$ErrorActionPreference = 'SilentlyContinue'
gsutil cp -Z *.* gs://llvm-premerge-checks/results/${MY_BUILD_ID}/
"""
stage("Windows"){
agent { label "windows"}
stages {
stage("git checkout"){
steps {
echo "getting llvm-premerge-checks... "
dir("llvm-premerge-checks")
{
git url: 'https://github.com/google/llvm-premerge-checks.git'
}
echo "getting llvm-project... "
dir("llvm-project")
{
git url: 'https://github.com/llvm/llvm-project.git', branch: 'release/10.x'
}
powershell "New-Item -ItemType Directory -Force -Path ${RESULT_DIR}"
}
}
stage('CMake') {
steps {
dir("${LLVM_DIR}"){
powershell "${SCRIPT_DIR}/run_cmake.ps1"
}
}
}
stage('ninja all') {
steps {
dir("${LLVM_DIR}"){
powershell "${SCRIPT_DIR}/run_ninja.ps1 all"
}
}
}
stage('ninja check-all') {
steps {
dir("${LLVM_DIR}"){
powershell "${SCRIPT_DIR}/run_ninja.ps1 check-all"
}
}
}
// doesn't find junit results, not sure why...
// junit "${LLVM_DIR}\\build\\test-results.xml"
}
}
post {
always {
echo "Logs uploaded to https://pantheon.corp.google.com/storage/browser/llvm-premerge-checks/results/${MY_BUILD_ID}."
dir("${env.RESULT_DIR}") {
// gather all result files in a folder, then upload everything to
// Google Cloud Storage
powershell """
# get the console log
Invoke-WebRequest -OutFile console-log.txt -uri "http://jenkins.local:8080/job/${JOB_BASE_NAME}/${BUILD_NUMBER}/consoleText" -ErrorAction "Continue"
Copy-Item "${LLVM_DIR}\\build\\CMakeCache.txt"
Copy-Item "${LLVM_DIR}\\build\\test-results.xml"
# upload files
\$ErrorActionPreference = 'SilentlyContinue'
gsutil cp -Z *.* gs://llvm-premerge-checks/results/${MY_BUILD_ID}/
"""
}
// doesn't find junit results, not sure why...
// junit "${LLVM_DIR}\\build\\test-results.xml"
}
}
}
}
}
}
}
}