blob: 25cb7f442f964673ac8fda7c46358f133fa44daf [file] [log] [blame]
pipeline {
options {
disableConcurrentBuilds()
}
parameters {
string(name: 'LABEL', defaultValue: params.LABEL ?: 'macos-x86_64', description: 'Node label to run on')
string(name: 'GIT_SHA', defaultValue: params.GIT_REVISION ?: '*/main', description: 'Git commit to build.')
string(name: 'ARTIFACT', defaultValue: params.ARTIFACT ?: 'llvm.org/clang-stage1-RA/latest', description: 'Clang artifact to use')
}
agent {
node {
label params.LABEL
}
}
stages {
stage('Checkout') {
steps {
dir('llvm-project') {
checkout([$class: 'GitSCM', branches: [
[name: params.GIT_SHA]
], extensions: [
[$class: 'CloneOption',
timeout: 30]
], userRemoteConfigs: [
[url: 'https://github.com/llvm/llvm-project.git']
]])
}
dir('llvm-zorg') {
checkout([$class: 'GitSCM', branches: [
[name: '*/main']
], extensions: [
[$class: 'CloneOption',
reference: '/Users/Shared/llvm-zorg.git']
], userRemoteConfigs: [
[url: 'https://github.com/llvm/llvm-zorg.git']
]])
}
}
}
stage('Setup Venv') {
environment {
PATH="$PATH:/usr/bin:/usr/local/bin"
}
steps {
sh '''
# Non-incremental, so always delete.
rm -rf clang-build clang-install host-compiler *.tar.gz
rm -rf venv
python3 -m venv venv
set +u
source ./venv/bin/activate
pip install -r ./llvm-zorg/zorg/jenkins/jobs/requirements.txt
set -u
'''
}
}
stage('Fetch Artifact') {
environment {
PATH="$PATH:/usr/bin:/usr/local/bin"
}
steps {
withCredentials([string(credentialsId: 's3_resource_bucket', variable: 'S3_BUCKET')]) {
sh """
source ./venv/bin/activate
echo "ARTIFACT=${params.ARTIFACT}"
python llvm-zorg/zorg/jenkins/monorepo_build.py fetch
ls $WORKSPACE/host-compiler/lib/clang/
VERSION=`ls $WORKSPACE/host-compiler/lib/clang/`
"""
}
}
}
stage('Build') {
environment {
PATH="$PATH:/usr/bin:/usr/local/bin"
HOST_INC_DIR="$WORKSPACE/host-compiler/bin/../include"
}
steps {
withCredentials([string(credentialsId: 's3_resource_bucket', variable: 'S3_BUCKET')]) {
sh '''
source ./venv/bin/activate
cd llvm-project
git tag -a -m "First Commit" first_commit 97724f18c79c7cc81ced24239eb5e883bf1398ef || true
git_desc=$(git describe --match "first_commit")
export GIT_DISTANCE=$(echo ${git_desc} | cut -f 2 -d "-")
sha=$(echo ${git_desc} | cut -f 3 -d "-")
export GIT_SHA=${sha:1}
cd -
python llvm-zorg/zorg/jenkins/monorepo_build.py cmake build \
--cmake-type=RelWithDebInfo \
--projects="clang;clang-tools-extra" \
--runtimes="libcxx;libcxxabi;libunwind" \
--cmake-flag='-DLLVM_USE_SANITIZER=Address;Undefined' \
--cmake-flag="-DLIBCXX_INCLUDE_TESTS=OFF" \
--timeout=1800 \
--cmake-flag="-DPython3_EXECUTABLE=$(which python)"
'''
}
}
}
stage('Test') {
environment {
PATH="$PATH:/usr/bin:/usr/local/bin"
ASAN_SYMBOLIZER_PATH="$WORKSPACE/host-compiler/bin/llvm-symbolizer"
}
steps {
sh '''
set -u
source ./venv/bin/activate
python llvm-zorg/zorg/jenkins/monorepo_build.py cmake test \
--cmake-test-target=check-llvm \
--cmake-test-target=check-clang
'''
}
post {
always {
script {
junit "clang-build/**/testresults.xunit.xml"
}
}
}
}
}
post {
always {
script {
// ToDo: Restore the issue scanner
// scanForIssues tool: clang()
sh "rm -rf clang-build clang-install host-compiler *.tar.gz"
}
}
}
}