forked from ldc-developers/ldc
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathazure-pipelines.yml
209 lines (202 loc) · 6.91 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
variables:
LLVM_VERSION: 9.0.0
HOST_LDC_VERSION: 1.14.0
# Although tags are supposed to trigger builds by default, they don't.
trigger:
- '*'
- refs/tags/v*
jobs:
- job: Windows
timeoutInMinutes: 120
pool:
vmImage: 'windows-2019'
variables:
CLANG_VERSION: 9.0.0
VSINSTALLDIR: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\
EXTRA_CMAKE_FLAGS: -DBUILD_LTO_LIBS=ON
strategy:
matrix:
x64:
OS: windows
MODEL: 64
ARCH: x64
x86:
OS: windows
MODEL: 32
ARCH: x86
# Let CMake configure 64-bit clang-cl for 32-bit code emission.
CFLAGS: -m32
CXXFLAGS: -m32
ASMFLAGS: -m32
steps:
- template: .azure-pipelines/windows.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
variables:
# Let LDC auto-detect the Visual C++ installation for the smoke tests.
LDC_VSDIR: C:\non-existing_dummy
steps:
- checkout: none
- task: DownloadPipelineArtifact@0
inputs:
artifactName: windows-x64
targetPath: artifacts
displayName: Download x64 artifact
- task: DownloadPipelineArtifact@0
inputs:
artifactName: windows-x86
targetPath: artifacts
displayName: Download x86 artifact
- script: |
if "%BUILD_SOURCEBRANCH:~0,10%" == "refs/tags/" (
set ARTIFACT_ID=%BUILD_SOURCEBRANCH:~11%
) else (
set ARTIFACT_ID=%BUILD_SOURCEVERSION:~0,8%
)
set ARTIFACT_NAME=ldc2-%ARTIFACT_ID%-windows-multilib
:: Persist the ARTIFACT_NAME env variable for future steps
echo ##vso[task.setvariable variable=ARTIFACT_NAME]%ARTIFACT_NAME%
7z x artifacts/ldc2-*-x64.7z > nul
7z x artifacts/ldc2-*-x86.7z > nul
mv ldc2-*-x64 %ARTIFACT_NAME%
cd %ARTIFACT_NAME%
mv lib lib64
cp -r ../ldc2-*-x86/lib .
mv lib lib32
displayName: Extract & merge artifacts
- powershell: |
cd ldc2-*-multilib
(cat etc\ldc2.conf).replace('%%ldcbinarypath%%/../lib', '%%ldcbinarypath%%/../lib64') | Set-Content etc\ldc2.conf
$conf32 = cat ..\ldc2-*-x86\etc\ldc2.conf -Raw
$conf32 = "`r`n""i[3-6]86-.*-windows-msvc"":" + $conf32.Substring($conf32.IndexOf("`r`ndefault:") + 10)
$conf32 = $conf32.Substring(0, $conf32.IndexOf("`r`n};`r`n") + 6)
$conf32 = $conf32.Replace('%%ldcbinarypath%%/../lib', '%%ldcbinarypath%%/../lib32')
Add-Content etc\ldc2.conf $conf32
cat etc\ldc2.conf
displayName: Merge ldc2.conf
- powershell: |
echo 'void main() { import std.stdio; writefln("Hello world, %d bits", size_t.sizeof * 8); }' > hello.d
displayName: Generate hello.d
- script: |
%ARTIFACT_NAME%\bin\ldc2 -run hello.d
displayName: Run 64-bit hello-world smoke test
- script: |
%ARTIFACT_NAME%\bin\ldc2 -m32 -run hello.d
displayName: Run 32-bit hello-world smoke test
- script: |
mkdir newArtifacts
7z a -mx=9 newArtifacts/%ARTIFACT_NAME%.7z %ARTIFACT_NAME% > nul
displayName: Pack
- task: PublishPipelineArtifact@0
inputs:
artifactName: windows-multilib
targetPath: newArtifacts
displayName: Publish artifact
- job: Linux_multilib
timeoutInMinutes: 120
pool:
vmImage: 'ubuntu-16.04'
variables:
CI_OS: linux
ARCH: x86_64
# To improve portability of the generated binaries, link the C++ standard library statically.
# Also don't use relax relocations for the C(++) parts of the default libraries in order to
# support older user binutils (e.g., Ubuntu 14.04).
EXTRA_CMAKE_FLAGS: -DMULTILIB=ON -DBUILD_LTO_LIBS=ON -DCMAKE_EXE_LINKER_FLAGS=-static-libstdc++ -DRT_CFLAGS=-Wa,-mrelax-relocations=no -DLDC_INSTALL_LTOPLUGIN=ON -DLDC_INSTALL_LLVM_RUNTIME_LIBS=ON
steps:
- template: .azure-pipelines/posix.yml
- job: macOS_x64
timeoutInMinutes: 120
pool:
vmImage: 'macOS-10.13'
variables:
CI_OS: osx
ARCH: x86_64
EXTRA_CMAKE_FLAGS: -DBUILD_LTO_LIBS=ON
MACOSX_DEPLOYMENT_TARGET: 10.9
steps:
- template: .azure-pipelines/posix.yml
- job: Android_armv7a
timeoutInMinutes: 120
pool:
vmImage: 'ubuntu-16.04'
variables:
CI_OS: android
ARCH: armv7a
EXTRA_CMAKE_FLAGS: -DANDROID_ABI=armeabi-v7a -DANDROID_NATIVE_API_LEVEL=21 -DANDROID_STL=c++_static -DCMAKE_CROSSCOMPILING=True
steps:
- template: .azure-pipelines/posix.yml
# Uploads the packages to a GitHub release.
- job: Upload_to_GitHub
timeoutInMinutes: 30
pool:
vmImage: 'ubuntu-16.04'
dependsOn:
- Windows_multilib
- Linux_multilib
- macOS_x64
- Android_armv7a
# 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@0
inputs:
artifactName: windows-x64
targetPath: artifacts
- task: DownloadPipelineArtifact@0
inputs:
artifactName: windows-x86
targetPath: artifacts
- task: DownloadPipelineArtifact@0
inputs:
artifactName: windows-multilib
targetPath: artifacts
- task: DownloadPipelineArtifact@0
inputs:
artifactName: linux-x86_64
targetPath: artifacts
- task: DownloadPipelineArtifact@0
inputs:
artifactName: osx-x86_64
targetPath: artifacts
- task: DownloadPipelineArtifact@0
inputs:
artifactName: android-armv7a
targetPath: artifacts
# We also need to determine whether the GitHub release is a pre-release,
# as the GitHubRelease task overwrites that flag.
- bash: |
set -e
if [ "${BUILD_SOURCEBRANCH:0:10}" != "refs/tags/" ]; then
releaseTag=CI
isPreRelease=true
else
releaseTag=${BUILD_SOURCEBRANCH:10}
if [[ "$releaseTag" == *-* ]]; then
isPreRelease=true
else
isPreRelease=false
fi
fi
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