forked from ldc-developers/ldc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
247 lines (238 loc) · 8.58 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# syntax: https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema
variables:
LLVM_VERSION: 12.0.1
CLANG_VERSION: 11.1.0
HOST_LDC_VERSION: 1.24.0
trigger:
- '*'
- refs/tags/v*
jobs:
- job: Windows
timeoutInMinutes: 120
pool:
vmImage: 'windows-2019'
variables:
CI_OS: windows
OS: windows
LDC_VSDIR: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise
strategy:
matrix:
x64:
MODEL: 64
ARCH: x64
EXTRA_CMAKE_FLAGS: >
-DBUILD_LTO_LIBS=ON
-DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto"
-DEXTRA_CXXFLAGS=-flto=full
x86:
MODEL: 32
ARCH: x86
# Undefined symbol errors with FullLTO; ThinLTO works.
EXTRA_CMAKE_FLAGS: >
-DBUILD_LTO_LIBS=ON
-DD_COMPILER_FLAGS="-O -flto=thin -defaultlib=phobos2-ldc-lto,druntime-ldc-lto"
-DEXTRA_CXXFLAGS=-flto=thin
# Let CMake configure 64-bit clang-cl for 32-bit code emission.
CFLAGS: -m32
CXXFLAGS: -m32
ASMFLAGS: -m32
steps:
- template: .azure-pipelines/windows.yml
- template: .azure-pipelines/4-install.yml
- template: .azure-pipelines/4a-windows.yml
- template: .azure-pipelines/5-integration_test.yml
- template: .azure-pipelines/6-package.yml
# Merges the x64 and x86 Windows packages to a multilib package (64-bit binaries + 32/64-bit libraries).
- job: Windows_multilib
timeoutInMinutes: 30
pool:
vmImage: 'windows-2019'
dependsOn:
- Windows
steps:
- template: .azure-pipelines/windows-merge.yml
- job: Linux_multilib
timeoutInMinutes: 120
pool:
vmImage: 'ubuntu-18.04'
variables:
CI_OS: linux
ARCH: x86_64
BOOTSTRAP_CMAKE_FLAGS: -DBUILD_LTO_LIBS=ON
# To improve portability of the generated binaries, link the C++ standard library statically.
# FIXME: need to use ld.gold for LTOing LDC itself for now, fixed in frontend v2.099
EXTRA_CMAKE_FLAGS: >
-DMULTILIB=ON
-DBUILD_LTO_LIBS=ON
-DCMAKE_EXE_LINKER_FLAGS=-static-libstdc++
-DJITRT_EXTRA_LDFLAGS=-static-libstdc++
-DD_COMPILER_FLAGS="-O -flto=full -linker=gold -defaultlib=phobos2-ldc-lto,druntime-ldc-lto"
-DEXTRA_CXXFLAGS=-flto=full
steps:
- template: .azure-pipelines/1-posix-setup.yml
- template: .azure-pipelines/2-posix-build_native.yml
# Pack source dir
- script: |
set -ex
cd ..
mkdir artifacts
if [ "${BUILD_SOURCEBRANCH:0:10}" = "refs/tags/" ]; then
artifactID=${BUILD_SOURCEBRANCH:11}
else
artifactID=${BUILD_SOURCEVERSION:0:8}
fi
artifactName=ldc-$artifactID-src
chmod -R go=rX $BUILD_SOURCESDIRECTORY
GZIP=-9 tar -czf artifacts/$artifactName.tar.gz --exclude-vcs --owner=0 --group=0 --transform=s,${BUILD_SOURCESDIRECTORY:1},$artifactName, $BUILD_SOURCESDIRECTORY
tar -xf artifacts/$artifactName.tar.gz
zip -r -9 artifacts/$artifactName.zip $artifactName
displayName: Pack source dir
- template: .azure-pipelines/3-posix-test.yml
- template: .azure-pipelines/4-install.yml
- template: .azure-pipelines/5-integration_test.yml
- template: .azure-pipelines/6-package.yml
- job: macOS_x64
timeoutInMinutes: 120
pool:
vmImage: 'macOS-10.15'
variables:
CI_OS: osx
ARCH: x86_64
BOOTSTRAP_CMAKE_FLAGS: -DBUILD_LTO_LIBS=ON
EXTRA_CMAKE_FLAGS: >
-DBUILD_LTO_LIBS=ON
-DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto"
-DEXTRA_CXXFLAGS=-flto=full
MACOSX_DEPLOYMENT_TARGET: 10.9
IOS_DEPLOYMENT_TARGET: 12.0
steps:
- template: .azure-pipelines/1-posix-setup.yml
- template: .azure-pipelines/2-posix-build_native.yml
- template: .azure-pipelines/3-posix-test.yml
- template: .azure-pipelines/4-install.yml
- template: .azure-pipelines/4a-mac_x64.yml
- template: .azure-pipelines/5-integration_test.yml
- script: |
set -ex
cd ..
installed/bin/ldc2 -mtriple="arm64-apple-macos" hello.d -of=hello_arm64
installed/bin/ldc2 -mtriple="arm64-apple-macos" hello.d -of=hello_arm64_shared -link-defaultlib-shared
installed/bin/ldc2 -mtriple="arm64-apple-ios$IOS_DEPLOYMENT_TARGET" hello.d -of=hello_ios_arm64
installed/bin/ldc2 -mtriple="arm64-apple-ios$IOS_DEPLOYMENT_TARGET" hello.d -of=hello_ios_arm64_shared -link-defaultlib-shared
installed/bin/ldc2 -mtriple="x86_64-apple-ios$IOS_DEPLOYMENT_TARGET" hello.d -of=hello_ios_x86_64
installed/bin/ldc2 -mtriple="x86_64-apple-ios$IOS_DEPLOYMENT_TARGET" hello.d -of=hello_ios_x86_64_shared -link-defaultlib-shared
displayName: 'Cross-compile & -link hello-world for arm64 and iOS'
- template: .azure-pipelines/6-package.yml
- job: macOS_arm64
timeoutInMinutes: 120
pool:
vmImage: 'macOS-10.15'
variables:
CI_OS: osx
ARCH: arm64
EXTRA_CMAKE_FLAGS: >
-DBUILD_LTO_LIBS=ON
-DD_COMPILER_FLAGS="-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto"
-DEXTRA_CXXFLAGS=-flto=full
EXTRA_CMAKE_FLAGS_CROSS: -DCMAKE_OSX_ARCHITECTURES=arm64
MACOSX_DEPLOYMENT_TARGET: 11.0
IOS_DEPLOYMENT_TARGET: 12.0
steps:
- template: .azure-pipelines/1-posix-setup.yml
- template: .azure-pipelines/2-posix-build_cross_mac.yml
- template: .azure-pipelines/4-install.yml
- template: .azure-pipelines/6-package.yml
- job: Android
timeoutInMinutes: 120
pool:
vmImage: 'ubuntu-18.04'
variables:
CI_OS: android
ANDROID_NDK_VERSION: r21e
strategy:
matrix:
armv7a:
ARCH: armv7a
EXTRA_CMAKE_FLAGS_CROSS: >
-DANDROID_ABI=armeabi-v7a
-DANDROID_NATIVE_API_LEVEL=21
-DANDROID_STL=c++_static
-DCMAKE_CROSSCOMPILING=True
ANDROID_X86_ABI: x86
aarch64:
ARCH: aarch64
EXTRA_CMAKE_FLAGS_CROSS: >
-DANDROID_ABI=arm64-v8a
-DANDROID_NATIVE_API_LEVEL=21
-DANDROID_STL=c++_static
-DCMAKE_CROSSCOMPILING=True
-DLDC_INSTALL_LLVM_RUNTIME_LIBS_OS=android
-DLDC_INSTALL_LLVM_RUNTIME_LIBS_ARCH=aarch64-android
ANDROID_X86_ABI: x86_64
steps:
- template: .azure-pipelines/1-posix-setup.yml
- template: .azure-pipelines/2-posix-build_cross_android.yml
- template: .azure-pipelines/4-install.yml
- template: .azure-pipelines/4a-android.yml
- template: .azure-pipelines/6-package.yml
# Uploads all artifacts to a GitHub release.
- job: Upload_to_GitHub
timeoutInMinutes: 30
pool:
vmImage: 'ubuntu-18.04'
dependsOn:
- Windows_multilib
- Linux_multilib
- macOS_x64
- macOS_arm64
- Android
# Only run for commits on the master branch and tags.
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'], 'refs/tags/')))
steps:
- checkout: none
- task: DownloadPipelineArtifact@2
inputs:
targetPath: artifacts
- bash: |
set -ex
cd artifacts
mv */*.* .
find . -type d -empty -delete
ls -l
sha256sum * > sha256sums.txt
displayName: Move artifact files out of their subdirs and compute hashes
# We also need to determine whether the GitHub release is a pre-release,
# as the GitHubRelease task overwrites that flag.
- bash: |
set -ex
if [ "${BUILD_SOURCEBRANCH:0:10}" != "refs/tags/" ]; then
releaseTag=CI
isPreRelease=true
artifactID=${BUILD_SOURCEVERSION:0:8}
else
releaseTag=${BUILD_SOURCEBRANCH:10}
if [[ "$releaseTag" == *-* ]]; then
isPreRelease=true
else
isPreRelease=false
fi
artifactID=${BUILD_SOURCEBRANCH:11}
fi
mv artifacts/sha256sums.txt artifacts/ldc2-$artifactID.sha256sums.txt
set +x
echo "##vso[task.setvariable variable=GITHUB_RELEASE_TAG]$releaseTag"
echo "##vso[task.setvariable variable=GITHUB_RELEASE_ISPRERELEASE]$isPreRelease"
displayName: Set GITHUB_RELEASE_{TAG,ISPRERELEASE} env variables
- task: GitHubRelease@0
inputs:
gitHubConnection: kinke
repositoryName: ldc-developers/ldc
action: edit
tag: $(GITHUB_RELEASE_TAG)
assets: artifacts/*
assetUploadMode: replace
# If we omit this, GitHub's isPreRelease flag is overwritten by the default `false`.
isPreRelease: $(GITHUB_RELEASE_ISPRERELEASE)
# If we omit this, an automatic change log is appended to the GitHub description.
addChangeLog: false
displayName: Upload artifacts to GitHub release