Skip to content
This repository was archived by the owner on Dec 20, 2019. It is now read-only.

Commit 56185df

Browse files
committed
LDC: Set up CI with Azure Pipelines and Shippable
Azure: Windows x86 & x64, macOS x64, Linux x64 Shippable: Linux AArch64 2 packages per platform (enabled/disabled assertions). Tagged builds are uploaded to the corresponding GitHub release, untagged builds to the GitHub 'CI' release.
1 parent 38955d9 commit 56185df

File tree

4 files changed

+383
-0
lines changed

4 files changed

+383
-0
lines changed

.azure-pipelines/posix.yml

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Each step starts in the checked-out source directory,
2+
# environment variables aren't persisted across steps.
3+
4+
steps:
5+
- checkout: self
6+
submodules: true
7+
fetchDepth: 50
8+
- script: |
9+
set -ex
10+
cd ..
11+
if [ "$CI_OS" = "linux" ]; then
12+
export DEBIAN_FRONTEND=noninteractive
13+
sudo apt-get -q update
14+
sudo apt-get -yq install \
15+
curl git-core g++ ninja-build binutils-dev
16+
else
17+
# Download & extract Ninja
18+
curl -L -o ninja-mac.zip https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-mac.zip
19+
mkdir ninja
20+
tar -xf ninja-mac.zip -C ninja
21+
fi
22+
displayName: Install prerequisites
23+
- script: |
24+
set -ex
25+
cd ..
26+
export PATH="$PWD/ninja:$PATH"
27+
cmake --version
28+
ninja --version
29+
mkdir build
30+
cd build
31+
cmake -G Ninja $BUILD_SOURCESDIRECTORY \
32+
-DCMAKE_BUILD_TYPE=Release \
33+
-DCMAKE_INSTALL_PREFIX=$PWD/../install \
34+
-DLLVM_TARGETS_TO_BUILD="$LLVM_TARGETS_TO_BUILD" \
35+
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="$LLVM_EXPERIMENTAL_TARGETS_TO_BUILD" \
36+
-DLLVM_ENABLE_ASSERTIONS=$LLVM_ENABLE_ASSERTIONS \
37+
-DCOMPILER_RT_INCLUDE_TESTS=OFF \
38+
$BASE_CMAKE_FLAGS $EXTRA_CMAKE_FLAGS
39+
ninja install
40+
displayName: Build & install LLVM incl. LLD, compiler-rt and the Khronos SPIRV-LLVM-Translator
41+
- script: |
42+
set -e
43+
cd ..
44+
if [ "${BUILD_SOURCEBRANCH:0:10}" = "refs/tags/" ]; then
45+
ARTIFACT_ID=${BUILD_SOURCEBRANCH:15}
46+
else
47+
ARTIFACT_ID=${BUILD_SOURCEVERSION:0:8}
48+
fi
49+
ASSERTS_SUFFIX=""
50+
if [ "$LLVM_ENABLE_ASSERTIONS" = "ON" ]; then
51+
ASSERTS_SUFFIX="-withAsserts"
52+
fi
53+
# Persist the ARTIFACT_ID and ASSERTS_SUFFIX variables for future steps
54+
echo "##vso[task.setvariable variable=ARTIFACT_ID]$ARTIFACT_ID"
55+
echo "##vso[task.setvariable variable=ASSERTS_SUFFIX]$ASSERTS_SUFFIX"
56+
artifactName=llvm-$ARTIFACT_ID-$CI_OS-x86_64$ASSERTS_SUFFIX
57+
mv install $artifactName
58+
mkdir artifacts
59+
XZ_OPT=-9 tar -cJf artifacts/$artifactName.tar.xz $artifactName
60+
displayName: Pack installation dir
61+
- script: |
62+
set -e
63+
cd ..
64+
if [[ "$CI_OS" = "linux" && "$LLVM_ENABLE_ASSERTIONS" = "OFF" ]]; then
65+
artifactName=llvm-$ARTIFACT_ID.src
66+
XZ_OPT=-9 tar -cJf artifacts/$artifactName.tar.xz --exclude-vcs --transform=s,${BUILD_SOURCESDIRECTORY:1},$artifactName, $BUILD_SOURCESDIRECTORY
67+
else
68+
echo 'Skipping'
69+
fi
70+
displayName: Pack source dir
71+
- task: PublishPipelineArtifact@0
72+
inputs:
73+
artifactName: $(CI_OS)-x86_64$(ASSERTS_SUFFIX)
74+
targetPath: ../artifacts
75+
displayName: Publish artifact(s)

.azure-pipelines/windows.yml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Each step starts in the checked-out source directory,
2+
# environment variables aren't persisted across steps.
3+
4+
steps:
5+
- script: |
6+
set
7+
displayName: Print environment variables
8+
- checkout: self
9+
submodules: true
10+
fetchDepth: 50
11+
- script: |
12+
echo on
13+
cd ..
14+
:: Download & extract Ninja
15+
curl -L -o ninja.zip https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-win.zip
16+
mkdir ninja
17+
cd ninja
18+
7z x ../ninja.zip > nul
19+
cd ..
20+
:: Download & install clang
21+
curl -L -o clang.exe http://releases.llvm.org/%CLANG_VERSION%/LLVM-%CLANG_VERSION%-win64.exe
22+
clang.exe /S
23+
displayName: Install prerequisites
24+
- script: |
25+
echo on
26+
cd ..
27+
set PATH=C:\Program Files\LLVM\bin;%CD%\ninja;%PATH%
28+
call "%VSINSTALLDIR%Common7\Tools\VsDevCmd.bat" -arch=%ARCH%
29+
echo on
30+
cmake --version
31+
ninja --version
32+
clang-cl --version
33+
mkdir build
34+
cd build
35+
cmake -G Ninja %BUILD_SOURCESDIRECTORY% -DCMAKE_C_COMPILER:PATH=clang-cl.exe -DCMAKE_CXX_COMPILER:PATH=clang-cl.exe -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%CD%/../install -DLLVM_TARGETS_TO_BUILD=%LLVM_TARGETS_TO_BUILD% -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=%LLVM_EXPERIMENTAL_TARGETS_TO_BUILD% -DLLVM_ENABLE_ASSERTIONS=%LLVM_ENABLE_ASSERTIONS% -DLLVM_DEFAULT_TARGET_TRIPLE=%LLVM_DEFAULT_TARGET_TRIPLE% -DCOMPILER_RT_INCLUDE_TESTS=OFF %BASE_CMAKE_FLAGS% %EXTRA_CMAKE_FLAGS%
36+
ninja install
37+
displayName: Build & install LLVM incl. LLD, compiler-rt and the Khronos SPIRV-LLVM-Translator
38+
- script: |
39+
cd ..
40+
:: On Windows, the lld symlinks are copies
41+
rm install/bin/ld.lld.exe
42+
rm install/bin/ld64.lld.exe
43+
rm install/bin/lld.exe
44+
rm install/bin/wasm-ld.exe
45+
if "%BUILD_SOURCEBRANCH:~0,10%" == "refs/tags/" (
46+
set ARTIFACT_ID=%BUILD_SOURCEBRANCH:~15%
47+
) else (
48+
set ARTIFACT_ID=%BUILD_SOURCEVERSION:~0,8%
49+
)
50+
set ASSERTS_SUFFIX=
51+
if "%LLVM_ENABLE_ASSERTIONS%" == "ON" (
52+
set ASSERTS_SUFFIX=-withAsserts
53+
)
54+
:: Persist the ASSERTS_SUFFIX env variable for future steps
55+
echo ##vso[task.setvariable variable=ASSERTS_SUFFIX]%ASSERTS_SUFFIX%
56+
set ARTIFACT_NAME=llvm-%ARTIFACT_ID%-windows-%ARCH%%ASSERTS_SUFFIX%
57+
mv install %ARTIFACT_NAME%
58+
mkdir artifacts
59+
cd %ARTIFACT_NAME%
60+
7z a -mx=9 ../artifacts/%ARTIFACT_NAME%.7z * > nul
61+
displayName: Pack installation dir
62+
- task: PublishPipelineArtifact@0
63+
inputs:
64+
artifactName: windows-$(ARCH)$(ASSERTS_SUFFIX)
65+
targetPath: ../artifacts
66+
displayName: Publish artifact

azure-pipelines.yml

+152
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
variables:
2+
LLVM_TARGETS_TO_BUILD: AArch64;ARM;Mips;MSP430;NVPTX;PowerPC;X86
3+
LLVM_EXPERIMENTAL_TARGETS_TO_BUILD: RISCV;WebAssembly
4+
# Prevent dependencies on some purely optional libraries.
5+
BASE_CMAKE_FLAGS: -DLLVM_ENABLE_TERMINFO=OFF -DLLVM_ENABLE_LIBEDIT=OFF
6+
7+
# Although tags are supposed to trigger builds by default, they don't.
8+
trigger:
9+
branches:
10+
include: ['*']
11+
tags:
12+
include:
13+
- ldc-v*
14+
15+
jobs:
16+
- job: Windows
17+
timeoutInMinutes: 180
18+
pool:
19+
vmImage: 'vs2017-win2016'
20+
variables:
21+
CLANG_VERSION: 7.0.1
22+
VSINSTALLDIR: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\
23+
EXTRA_CMAKE_FLAGS: -DLLVM_USE_CRT_RELEASE=MT
24+
strategy:
25+
matrix:
26+
x64:
27+
ARCH: x64
28+
LLVM_DEFAULT_TARGET_TRIPLE: x86_64-pc-windows-msvc
29+
LLVM_ENABLE_ASSERTIONS: OFF
30+
x64_withAsserts:
31+
ARCH: x64
32+
LLVM_DEFAULT_TARGET_TRIPLE: x86_64-pc-windows-msvc
33+
LLVM_ENABLE_ASSERTIONS: ON
34+
x86:
35+
ARCH: x86
36+
LLVM_DEFAULT_TARGET_TRIPLE: i686-pc-windows-msvc
37+
LLVM_ENABLE_ASSERTIONS: OFF
38+
# Let CMake configure 64-bit clang-cl for 32-bit code emission.
39+
CFLAGS: -m32
40+
CXXFLAGS: -m32
41+
ASMFLAGS: -m32
42+
x86_withAsserts:
43+
ARCH: x86
44+
LLVM_DEFAULT_TARGET_TRIPLE: i686-pc-windows-msvc
45+
LLVM_ENABLE_ASSERTIONS: ON
46+
CFLAGS: -m32
47+
CXXFLAGS: -m32
48+
ASMFLAGS: -m32
49+
steps:
50+
- template: .azure-pipelines/windows.yml
51+
52+
- job: Linux
53+
timeoutInMinutes: 180
54+
pool:
55+
vmImage: 'ubuntu-16.04'
56+
variables:
57+
CI_OS: linux
58+
EXTRA_CMAKE_FLAGS: -DLLVM_BINUTILS_INCDIR=/usr/include -DCMAKE_CXX_FLAGS=-static-libstdc++
59+
strategy:
60+
matrix:
61+
x64:
62+
LLVM_ENABLE_ASSERTIONS: OFF
63+
x64_withAsserts:
64+
LLVM_ENABLE_ASSERTIONS: ON
65+
steps:
66+
- template: .azure-pipelines/posix.yml
67+
68+
- job: macOS
69+
timeoutInMinutes: 180
70+
pool:
71+
vmImage: 'macOS-10.13'
72+
variables:
73+
CI_OS: osx
74+
EXTRA_CMAKE_FLAGS: -DHAVE_FUTIMENS=0
75+
MACOSX_DEPLOYMENT_TARGET: 10.9
76+
strategy:
77+
matrix:
78+
x64:
79+
LLVM_ENABLE_ASSERTIONS: OFF
80+
x64_withAsserts:
81+
LLVM_ENABLE_ASSERTIONS: ON
82+
steps:
83+
- template: .azure-pipelines/posix.yml
84+
85+
# Uploads the packages to a GitHub release.
86+
- job: Upload_to_GitHub
87+
timeoutInMinutes: 30
88+
pool:
89+
vmImage: 'ubuntu-16.04'
90+
dependsOn:
91+
- Windows
92+
- Linux
93+
- macOS
94+
# Only run for branches and tags, no PRs.
95+
condition: and(succeeded(), or(startsWith(variables['Build.SourceBranch'], 'refs/heads/'), startsWith(variables['Build.SourceBranch'], 'refs/tags/')))
96+
steps:
97+
- checkout: none
98+
- task: DownloadPipelineArtifact@0
99+
inputs:
100+
artifactName: windows-x64
101+
targetPath: artifacts
102+
- task: DownloadPipelineArtifact@0
103+
inputs:
104+
artifactName: windows-x64-withAsserts
105+
targetPath: artifacts
106+
- task: DownloadPipelineArtifact@0
107+
inputs:
108+
artifactName: windows-x86
109+
targetPath: artifacts
110+
- task: DownloadPipelineArtifact@0
111+
inputs:
112+
artifactName: windows-x86-withAsserts
113+
targetPath: artifacts
114+
- task: DownloadPipelineArtifact@0
115+
inputs:
116+
artifactName: linux-x86_64
117+
targetPath: artifacts
118+
- task: DownloadPipelineArtifact@0
119+
inputs:
120+
artifactName: linux-x86_64-withAsserts
121+
targetPath: artifacts
122+
- task: DownloadPipelineArtifact@0
123+
inputs:
124+
artifactName: osx-x86_64
125+
targetPath: artifacts
126+
- task: DownloadPipelineArtifact@0
127+
inputs:
128+
artifactName: osx-x86_64-withAsserts
129+
targetPath: artifacts
130+
- bash: |
131+
set -e
132+
if [ "${BUILD_SOURCEBRANCH:0:10}" != "refs/tags/" ]; then
133+
releaseTag=CI
134+
isPreRelease=true
135+
else
136+
releaseTag=${BUILD_SOURCEBRANCH:10}
137+
isPreRelease=false
138+
fi
139+
echo "##vso[task.setvariable variable=GITHUB_RELEASE_TAG]$releaseTag"
140+
echo "##vso[task.setvariable variable=GITHUB_RELEASE_ISPRERELEASE]$isPreRelease"
141+
displayName: Set GITHUB_RELEASE_{TAG,ISPRERELEASE} env variables
142+
- task: GitHubRelease@0
143+
inputs:
144+
gitHubConnection: kinke
145+
repositoryName: ldc-developers/llvm
146+
action: edit
147+
tag: $(GITHUB_RELEASE_TAG)
148+
assets: artifacts/*
149+
assetUploadMode: replace
150+
isPreRelease: $(GITHUB_RELEASE_ISPRERELEASE)
151+
addChangeLog: false
152+
displayName: Upload artifacts to GitHub release

shippable.yml

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
language: c
2+
3+
compiler:
4+
- gcc
5+
6+
runtime:
7+
nodePool: shippable_shared_aarch64
8+
9+
# git clone depth
10+
depth: 50
11+
12+
env:
13+
global:
14+
- secure: OuhkRMNLWCzMcJdPrUtvyo78/NqOtP1WHEfVViD5oCHIFr7rTjOTRFC+1Tcal//Z9XoqlGTBSfthqn6Z8QemqdljeVSXJgb9zXJMrq4Hl/hWrNhJ/M1m/rh30EQYnAzFyiTGN9yuzOLArLDq1Emv2dzDRpZybrx6FpSvo+hm3GQZNW55+KUu5uUoCsKZwSIjytgJPuec/sTOkV81OP2bszwqmvh+Xhb1UT4ukYlDKK3B+uggKc7MCnOWiYBkh5fsNmEjUiBS3tj4B2nD4rTv0isDucZJTe5aHbOFhjRi5Yh4yk4qxi4WqwOHYDTIU4rzEOuOKihVeo52IayuJE+4Iw==
15+
matrix:
16+
- LLVM_ENABLE_ASSERTIONS=ON
17+
- LLVM_ENABLE_ASSERTIONS=OFF
18+
19+
build:
20+
ci:
21+
# Install prerequisites
22+
- export DEBIAN_FRONTEND=noninteractive
23+
- apt-get -q update
24+
- apt-get -yq install cmake curl git-core ninja-build p7zip-full binutils-dev
25+
- update-alternatives --install /usr/bin/ld ld /usr/bin/ld.gold 99
26+
# Build & install LLVM incl. LLD, compiler-rt and the Khronos SPIRV-LLVM-Translator
27+
- cmake --version
28+
- ninja --version
29+
- mkdir build
30+
- cd build
31+
- |
32+
cmake -G Ninja .. \
33+
-DCMAKE_BUILD_TYPE=Release \
34+
-DCMAKE_INSTALL_PREFIX=$PWD/../install \
35+
-DLLVM_TARGETS_TO_BUILD="AArch64;ARM" \
36+
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" \
37+
-DLLVM_ENABLE_ASSERTIONS=$LLVM_ENABLE_ASSERTIONS \
38+
-DCOMPILER_RT_INCLUDE_TESTS=OFF \
39+
-DLLVM_ENABLE_TERMINFO=OFF \
40+
-DLLVM_ENABLE_LIBEDIT=OFF \
41+
-DLLVM_BINUTILS_INCDIR=/usr/include \
42+
-DCMAKE_CXX_FLAGS='-static-libstdc++ -Wno-class-memaccess -Wno-cast-function-type'
43+
- ninja -j64 install
44+
- cd ..
45+
# Pack installation dir
46+
- |
47+
set -eo pipefail
48+
if [ "$IS_GIT_TAG" = "true" ]; then
49+
artifactID=${GIT_TAG_NAME:5}
50+
else
51+
artifactID=${COMMIT:0:8}
52+
fi
53+
assertsSuffix=""
54+
if [ "$LLVM_ENABLE_ASSERTIONS" = "ON" ]; then
55+
assertsSuffix="-withAsserts"
56+
fi
57+
artifactName=llvm-$artifactID-linux-aarch64$assertsSuffix
58+
mv install $artifactName
59+
artifact=$artifactName.tar.xz
60+
tar -cf - $artifactName | 7za a $artifact -si -txz -mx9
61+
ls -l $artifact
62+
# Upload to GitHub release (only for branches and tags, no PRs)
63+
- |
64+
set -e
65+
if [ "$IS_PULL_REQUEST" = "true" ]; then
66+
echo 'Skipping'
67+
exit 0
68+
fi
69+
if [ "$IS_GIT_TAG" = "false" ]; then
70+
releaseTag=CI
71+
else
72+
releaseTag=$GIT_TAG_NAME
73+
fi
74+
releaseID=$(curl -s https://api.github.com/repos/ldc-developers/llvm/releases/tags/$releaseTag | grep -m 1 '^ "id":')
75+
releaseID=${releaseID:8:-1}
76+
echo "Uploading $artifact to GitHub release $releaseTag ($releaseID)..."
77+
curl -s \
78+
-H "Authorization: token $GITHUB_TOKEN" \
79+
-H "Content-Type: application/octet-stream" \
80+
--data-binary @$artifact \
81+
https://uploads.github.com/repos/ldc-developers/llvm/releases/$releaseID/assets?name=$artifact
82+
83+
integrations:
84+
notifications:
85+
- integrationName: email
86+
type: email
87+
on_success: never
88+
on_failure: never
89+
on_cancel: never
90+
on_pull_request: never

0 commit comments

Comments
 (0)