|
| 1 | +pipeline { |
| 2 | + options { |
| 3 | + disableConcurrentBuilds() |
| 4 | + } |
| 5 | + |
| 6 | + parameters { |
| 7 | + string(name: 'LABEL', defaultValue: params.LABEL ?: 'macos-arm64', description: 'Node label to run on') |
| 8 | + |
| 9 | + string(name: 'GIT_REVISION', defaultValue: params.GIT_REVISION ?: '*/main', description: 'Git revision to build') |
| 10 | + } |
| 11 | + |
| 12 | + agent { |
| 13 | + node { |
| 14 | + label params.LABEL |
| 15 | + } |
| 16 | + } |
| 17 | + |
| 18 | + stages { |
| 19 | + stage('Checkout') { |
| 20 | + steps { |
| 21 | + dir('llvm-project') { |
| 22 | + checkout([$class: 'GitSCM', branches: [ |
| 23 | + [name: params.GIT_REVISION] |
| 24 | + ], extensions: [ |
| 25 | + [$class: 'CloneOption', |
| 26 | + timeout: 30] |
| 27 | + ], userRemoteConfigs: [ |
| 28 | + [url: 'https://github.com/llvm/llvm-project.git'] |
| 29 | + ]]) |
| 30 | + } |
| 31 | + dir('llvm-zorg') { |
| 32 | + checkout([$class: 'GitSCM', branches: [ |
| 33 | + [name: '*/main'] |
| 34 | + ], userRemoteConfigs: [ |
| 35 | + [url: 'https://github.com/llvm/llvm-zorg.git'] |
| 36 | + ]]) |
| 37 | + } |
| 38 | + } |
| 39 | + } |
| 40 | + stage('Setup Venv') { |
| 41 | + environment { |
| 42 | + PATH="$PATH:/usr/bin:/usr/local/bin" |
| 43 | + } |
| 44 | + steps { |
| 45 | + sh ''' |
| 46 | + # Non-incremental, so always delete just in case. |
| 47 | + rm -rf clang-build clang-install host-compiler *.tar.gz |
| 48 | + rm -rf venv |
| 49 | + python3 -m venv venv |
| 50 | + set +u |
| 51 | + source ./venv/bin/activate |
| 52 | + python -m pip install -r ./llvm-zorg/zorg/jenkins/jobs/requirements.txt |
| 53 | + set -u |
| 54 | + ''' |
| 55 | + } |
| 56 | + } |
| 57 | + stage('Build') { |
| 58 | + environment { |
| 59 | + PATH="$PATH:/usr/bin:/usr/local/bin" |
| 60 | + MACOSX_DEPLOYMENT_TARGET="13.6" |
| 61 | + } |
| 62 | + steps { |
| 63 | + timeout(120) { |
| 64 | + withCredentials([string(credentialsId: 's3_resource_bucket', variable: 'S3_BUCKET')]) { |
| 65 | + sh ''' |
| 66 | + set -u |
| 67 | + rm -rf build.properties |
| 68 | + |
| 69 | + source ./venv/bin/activate |
| 70 | + |
| 71 | + cd llvm-project |
| 72 | + git tag -a -m "First Commit" first_commit 97724f18c79c7cc81ced24239eb5e883bf1398ef || true |
| 73 | + |
| 74 | + git_desc=$(git describe --match "first_commit") |
| 75 | + export GIT_DISTANCE=$(echo ${git_desc} | cut -f 2 -d "-") |
| 76 | + |
| 77 | + sha=$(echo ${git_desc} | cut -f 3 -d "-") |
| 78 | + export GIT_SHA=${sha:1} |
| 79 | + |
| 80 | + # Also save the LLVM_REV until LNT server is taught about GIT |
| 81 | + export LLVM_REV=$(git show -q | grep "llvm-svn:" | cut -f2 -d":" | tr -d " ") |
| 82 | + |
| 83 | + cd - |
| 84 | + |
| 85 | + echo "GIT_DISTANCE=$GIT_DISTANCE" > build.properties |
| 86 | + echo "GIT_SHA=$GIT_SHA" >> build.properties |
| 87 | + echo "ARTIFACT=$JOB_NAME/clang-d$GIT_DISTANCE-g$GIT_SHA-t$BUILD_ID-b$BUILD_NUMBER.tar.gz" >> build.properties |
| 88 | + |
| 89 | + rm -rf clang-build clang-install *.tar.gz |
| 90 | + python llvm-zorg/zorg/jenkins/monorepo_build.py cmake build \ |
| 91 | + --assertions --cmake-type=RelWithDebInfo \ |
| 92 | + --projects="clang;clang-tools-extra;compiler-rt" \ |
| 93 | + --cmake-flag="-DPython3_EXECUTABLE=$(which python)" \ |
| 94 | + --cmake-flag="-DLLVM_TARGETS_TO_BUILD=AArch64" |
| 95 | + ''' |
| 96 | + } |
| 97 | + } |
| 98 | + } |
| 99 | + } |
| 100 | + stage('Test') { |
| 101 | + environment { |
| 102 | + PATH="$PATH:/usr/bin:/usr/local/bin" |
| 103 | + } |
| 104 | + steps { |
| 105 | + timeout(120) { |
| 106 | + sh ''' |
| 107 | + set -u |
| 108 | + source ./venv/bin/activate |
| 109 | + python llvm-zorg/zorg/jenkins/monorepo_build.py cmake testlong |
| 110 | + ''' |
| 111 | + } |
| 112 | + } |
| 113 | + post { |
| 114 | + always { |
| 115 | + script { |
| 116 | + junit "clang-build/**/testresults.xunit.xml" |
| 117 | + } |
| 118 | + } |
| 119 | + } |
| 120 | + } |
| 121 | + } |
| 122 | + post { |
| 123 | + always { |
| 124 | + script { |
| 125 | + // ToDo: Restore the issue scanner |
| 126 | + // scanForIssues tool: clang() |
| 127 | + sh "rm -rf clang-build clang-install host-compiler" |
| 128 | + } |
| 129 | + } |
| 130 | + // This is commented out because we don't have downstream arm64 jobs setup yet, we will |
| 131 | + // in the future |
| 132 | + //success { |
| 133 | + // script { |
| 134 | + // if (!params.SKIP_TRIGGER) { |
| 135 | + // // Trigger Stage 2 Jobs |
| 136 | + // build job: 'clang-stage2-cmake-RgSan_relay-as', wait: false |
| 137 | + // build job: 'clang-stage2-Rthinlto_relay-as', wait: false |
| 138 | + // build job: 'relay-lnt-ctmark-as', wait: false |
| 139 | + // build job: 'relay-test-suite-verify-machineinstrs-as', wait: false |
| 140 | + // } |
| 141 | + // } |
| 142 | + //} |
| 143 | + //unstable { |
| 144 | + // script { |
| 145 | + // if (!params.SKIP_TRIGGER) { |
| 146 | + // // Trigger Stage 2 Jobs |
| 147 | + // build job: 'clang-stage2-cmake-RgSan_relay-as', wait: false |
| 148 | + // build job: 'clang-stage2-Rthinlto_relay-as', wait: false |
| 149 | + // build job: 'relay-lnt-ctmark-as', wait: false |
| 150 | + // build job: 'relay-test-suite-verify-machineinstrs-as', wait: false |
| 151 | + // } |
| 152 | + // } |
| 153 | + //} |
| 154 | + } |
| 155 | +} |
| 156 | + |
0 commit comments