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

Commit e8183ac

Browse files
committed
LDC: Add AppVeyor, CircleCI and Shippable CI
Windows: x86 & x86_64 (AppVeyor) OSX: x86_64 (CircleCI) Linux: x86_64 (CircleCI) & AArch64 (Shippable) 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 0cbb0b2 commit e8183ac

File tree

3 files changed

+359
-0
lines changed

3 files changed

+359
-0
lines changed

.circleci/config.yml

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# The common steps require environment variables CI_OS and LLVM_ENABLE_ASSERTIONS.
2+
commonSteps: &commonSteps
3+
steps:
4+
# Each step starts in working dir `<root>/project` (containing the cloned LLVM repo).
5+
- run:
6+
name: Install dependencies
7+
command: |
8+
cd ..
9+
if [ "$CI_OS" = "linux" ]; then
10+
export DEBIAN_FRONTEND=noninteractive
11+
apt-get -y update
12+
apt-get -yq install software-properties-common
13+
add-apt-repository -y ppa:ubuntu-toolchain-r/test
14+
apt-get -y update
15+
apt-get -yq install curl git-core g++-6 binutils-dev ninja-build
16+
echo "export CC=gcc-6" >> $BASH_ENV
17+
echo "export CXX=g++-6" >> $BASH_ENV
18+
# install CMake
19+
curl -L -o cmake-x64.tar.gz https://cmake.org/files/v3.10/cmake-3.10.0-Linux-x86_64.tar.gz
20+
mkdir cmake-x64
21+
tar -xf cmake-x64.tar.gz --strip 1 -C cmake-x64
22+
echo "export PATH=$PWD/cmake-x64/bin:$PATH" >> $BASH_ENV
23+
else
24+
# install CMake
25+
curl -L -o cmake-x64.tar.gz https://cmake.org/files/v3.10/cmake-3.10.0-Darwin-x86_64.tar.gz
26+
mkdir cmake-x64
27+
tar -xf cmake-x64.tar.gz --strip 3 -C cmake-x64
28+
# install Ninja
29+
curl -OL https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-mac.zip
30+
mkdir ninja
31+
tar -xf ninja-mac.zip -C ninja
32+
echo "export PATH=$PWD/cmake-x64/bin:$PWD/ninja:$PATH" >> $BASH_ENV
33+
fi
34+
- checkout
35+
- run:
36+
name: Checkout git submodules
37+
command: git submodule update --init --recursive
38+
- run:
39+
name: Build LLVM incl. LLD and compiler-rt
40+
command: |
41+
cd ..
42+
echo "$PATH"
43+
ninja --version
44+
cmake --version
45+
mkdir ninja-llvm
46+
cd ninja-llvm
47+
if [ "$CI_OS" = "linux" ]; then
48+
extraCMakeFlags="-DLLVM_BINUTILS_INCDIR=/usr/include -DCMAKE_CXX_FLAGS=-static-libstdc++"
49+
else
50+
extraCMakeFlags="-DLLVM_ENABLE_LIBCXX=True -DHAVE_FUTIMENS=0"
51+
fi
52+
cmake -G Ninja \
53+
-DCMAKE_BUILD_TYPE=Release \
54+
-DCMAKE_INSTALL_PREFIX=$(dirname $PWD)/llvm-x64 \
55+
-DLLVM_TARGETS_TO_BUILD="AArch64;ARM;Mips;MSP430;NVPTX;PowerPC;X86" \
56+
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="RISCV;WebAssembly" \
57+
-DLLVM_ENABLE_ASSERTIONS=$LLVM_ENABLE_ASSERTIONS \
58+
-DCOMPILER_RT_INCLUDE_TESTS=OFF \
59+
$extraCMakeFlags \
60+
$CIRCLE_WORKING_DIRECTORY
61+
ninja -j3 install
62+
cd ..
63+
- run:
64+
name: Pack installation dir
65+
no_output_timeout: 20m
66+
command: |
67+
cd ..
68+
mkdir artifacts
69+
assertsSuffix=""
70+
if [ "$LLVM_ENABLE_ASSERTIONS" = "ON" ]; then assertsSuffix="-withAsserts"; fi
71+
if [ -z "$CIRCLE_TAG" ]; then
72+
artifactBasename="llvm-${CIRCLE_SHA1:0:8}-$CI_OS-x86_64$assertsSuffix-$(date "+%Y%m%d")"
73+
else
74+
artifactBasename="llvm-${CIRCLE_TAG:5}-$CI_OS-x86_64$assertsSuffix"
75+
fi
76+
mv llvm-x64 $artifactBasename
77+
XZ_OPT=-9 tar -cJf "artifacts/$artifactBasename.tar.xz" $artifactBasename
78+
- run:
79+
name: Pack source dir
80+
command: |
81+
cd ..
82+
if [[ "$CI_OS" = "linux" && "$LLVM_ENABLE_ASSERTIONS" = "OFF" ]]; then
83+
if [ -z "$CIRCLE_TAG" ]; then
84+
artifactBasename="llvm-${CIRCLE_SHA1:0:8}.src"
85+
else
86+
artifactBasename="llvm-${CIRCLE_TAG:5}.src"
87+
fi
88+
XZ_OPT=-9 tar -cJf "artifacts/$artifactBasename.tar.xz" --exclude-vcs --transform=s/project/$artifactBasename/ project
89+
fi
90+
- store_artifacts:
91+
path: ../artifacts
92+
- run:
93+
name: Deploy to GitHub CI release
94+
command: |
95+
cd ..
96+
if [ "$CI_OS" = "linux" ]; then
97+
curl -L -o github-release.tar.bz2 https://github.com/aktau/github-release/releases/download/v0.7.2/linux-amd64-github-release.tar.bz2
98+
else
99+
curl -L -o github-release.tar.bz2 https://github.com/aktau/github-release/releases/download/v0.7.2/darwin-amd64-github-release.tar.bz2
100+
fi
101+
tar -xf github-release.tar.bz2 --strip 3
102+
if [ -z "$CIRCLE_TAG" ]; then CIRCLE_TAG="CI"; fi
103+
# Note: needs GITHUB_TOKEN environment variable
104+
./github-release upload --user ldc-developers --repo llvm --tag $CIRCLE_TAG --name "$(cd artifacts && ls llvm-*x86_64*.tar.xz)" --file artifacts/llvm-*x86_64*.tar.xz
105+
if [[ "$CI_OS" = "linux" && "$LLVM_ENABLE_ASSERTIONS" = "OFF" ]]; then
106+
./github-release upload --user ldc-developers --repo llvm --tag $CIRCLE_TAG --name "$(cd artifacts && ls llvm-*src.tar.xz)" --file artifacts/llvm-*src.tar.xz
107+
fi
108+
109+
version: 2
110+
jobs:
111+
build-linux:
112+
<<: *commonSteps
113+
docker:
114+
- image: ubuntu:14.04
115+
environment:
116+
- CI_OS: "linux"
117+
- LLVM_ENABLE_ASSERTIONS: "OFF"
118+
build-linux-withAsserts:
119+
<<: *commonSteps
120+
docker:
121+
- image: ubuntu:14.04
122+
environment:
123+
- CI_OS: "linux"
124+
- LLVM_ENABLE_ASSERTIONS: "ON"
125+
build-osx:
126+
<<: *commonSteps
127+
macos:
128+
xcode: "9.2.0"
129+
environment:
130+
- CI_OS: "osx"
131+
- MACOSX_DEPLOYMENT_TARGET: 10.8
132+
- USE_LIBCPP: "true"
133+
- LLVM_ENABLE_ASSERTIONS: "OFF"
134+
build-osx-withAsserts:
135+
<<: *commonSteps
136+
macos:
137+
xcode: "9.2.0"
138+
environment:
139+
- CI_OS: "osx"
140+
- MACOSX_DEPLOYMENT_TARGET: 10.8
141+
- USE_LIBCPP: "true"
142+
- LLVM_ENABLE_ASSERTIONS: "ON"
143+
144+
workflows:
145+
version: 2
146+
build:
147+
jobs:
148+
- build-linux:
149+
# This is required to also trigger the job after pushing a tag.
150+
filters:
151+
tags:
152+
only: /.*/
153+
- build-osx:
154+
filters:
155+
tags:
156+
only: /.*/
157+
- build-linux-withAsserts:
158+
filters:
159+
tags:
160+
only: /.*/
161+
- build-osx-withAsserts:
162+
filters:
163+
tags:
164+
only: /.*/

appveyor.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
#---------------------------------#
2+
# general configuration #
3+
#---------------------------------#
4+
5+
#version: 1.0.{build}-{branch}
6+
7+
#---------------------------------#
8+
# environment configuration #
9+
#---------------------------------#
10+
11+
environment:
12+
matrix:
13+
- APPVEYOR_JOB_ARCH: x64
14+
LLVM_DEFAULT_TARGET_TRIPLE: x86_64-pc-windows-msvc
15+
LLVM_ENABLE_ASSERTIONS: OFF
16+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
17+
- APPVEYOR_JOB_ARCH: x86
18+
LLVM_DEFAULT_TARGET_TRIPLE: i686-pc-windows-msvc
19+
LLVM_ENABLE_ASSERTIONS: OFF
20+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
21+
- APPVEYOR_JOB_ARCH: x64
22+
LLVM_DEFAULT_TARGET_TRIPLE: x86_64-pc-windows-msvc
23+
LLVM_ENABLE_ASSERTIONS: ON
24+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
25+
- APPVEYOR_JOB_ARCH: x86
26+
LLVM_DEFAULT_TARGET_TRIPLE: i686-pc-windows-msvc
27+
LLVM_ENABLE_ASSERTIONS: ON
28+
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
29+
30+
# scripts that are called at very beginning, before repo cloning
31+
init:
32+
- git config --global core.autocrlf input
33+
34+
clone_depth: 1
35+
36+
# scripts that run after cloning repository
37+
install:
38+
- cd c:\projects
39+
# Fetch submodules
40+
- cd llvm
41+
- git submodule update --init --recursive
42+
- cd ..
43+
# Download & extract Ninja
44+
- appveyor DownloadFile "https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-win.zip" -FileName ninja.zip
45+
- md ninja
46+
- cd ninja
47+
- 7z x ..\ninja.zip > nul
48+
- cd ..
49+
# Set environment variables
50+
- set PATH=%CD%\ninja;%PATH%
51+
- if "%APPVEYOR_BUILD_WORKER_IMAGE:~-4%" == "2017" call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" -arch=%APPVEYOR_JOB_ARCH%
52+
- if "%APPVEYOR_BUILD_WORKER_IMAGE:~-4%" == "2015" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %APPVEYOR_JOB_ARCH%
53+
# Print environment info
54+
- set
55+
- msbuild /version
56+
- cl
57+
- cmake --version
58+
- ninja --version
59+
60+
#---------------------------------#
61+
# build configuration #
62+
#---------------------------------#
63+
64+
build_script:
65+
- cd c:\projects
66+
- md ninja-llvm
67+
- cd ninja-llvm
68+
- cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=c:\projects\LLVM-%APPVEYOR_JOB_ARCH% -DLLVM_USE_CRT_RELEASE=MT -DLLVM_TARGETS_TO_BUILD=AArch64;ARM;Mips;MSP430;NVPTX;PowerPC;X86 -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=RISCV;WebAssembly -DLLVM_ENABLE_ASSERTIONS=%LLVM_ENABLE_ASSERTIONS% -DLLVM_DEFAULT_TARGET_TRIPLE=%LLVM_DEFAULT_TARGET_TRIPLE% -DCOMPILER_RT_INCLUDE_TESTS=OFF ..\llvm
69+
- ninja -j3 install
70+
71+
after_build:
72+
# pack installation dir & publish as artifact
73+
- ps: |
74+
echo 'Preparing artifact...'
75+
cd "c:\projects\LLVM-$Env:APPVEYOR_JOB_ARCH"
76+
del bin\ld.lld.exe
77+
del bin\ld64.lld.exe
78+
del bin\lld.exe
79+
del bin\wasm-ld.exe
80+
$assertsSuffix = ''
81+
If ($Env:LLVM_ENABLE_ASSERTIONS -eq 'ON') {
82+
$assertsSuffix = '-withAsserts'
83+
}
84+
If (Test-Path Env:APPVEYOR_REPO_TAG_NAME) {
85+
$artifactFilename = "llvm-$($Env:APPVEYOR_REPO_TAG_NAME.Substring(5))-windows-$Env:APPVEYOR_JOB_ARCH$assertsSuffix.7z"
86+
} Else {
87+
$artifactFilename = "llvm-$($Env:APPVEYOR_REPO_COMMIT.Substring(0, 8))-windows-$Env:APPVEYOR_JOB_ARCH$assertsSuffix-$(get-date -f yyyyMMdd).7z"
88+
}
89+
# TODO: Use higher compression level (-mx=9) as soon as
90+
# AppVeyor doesn't scratch the timeout limit anymore.
91+
7z a "..\$artifactFilename" * > $null
92+
cd ..
93+
Push-AppveyorArtifact $artifactFilename
94+
95+
test: off
96+
97+
#---------------------------------#
98+
# deployment configuration #
99+
#---------------------------------#
100+
101+
deploy:
102+
- release: CI
103+
prerelease: true
104+
provider: GitHub
105+
auth_token:
106+
secure: qnbD8agL9mr0SFvy/sMkR2E29oQQ427T5zYwVVZkjRS3IZ361tG+9jlSiyEkyULy
107+
artifact: /llvm-.*\.7z/
108+
on:
109+
appveyor_repo_tag: false
110+
- release: $(APPVEYOR_REPO_TAG_NAME)
111+
description: $(APPVEYOR_REPO_TAG_NAME)
112+
prerelease: true
113+
draft: true
114+
provider: GitHub
115+
auth_token:
116+
secure: qnbD8agL9mr0SFvy/sMkR2E29oQQ427T5zYwVVZkjRS3IZ361tG+9jlSiyEkyULy
117+
artifact: /llvm-.*\.7z/
118+
on:
119+
appveyor_repo_tag: true

shippable.yml

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

0 commit comments

Comments
 (0)