forked from ldc-developers/ldc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
279 lines (267 loc) · 11.8 KB
/
appveyor.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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
#---------------------------------#
# general configuration #
#---------------------------------#
#version: 1.0.{build}-{branch}
#---------------------------------#
# environment configuration #
#---------------------------------#
environment:
matrix:
- APPVEYOR_JOB_ARCH: x64
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
LLVM_VERSION: 6.0.1-3
HOST_LDC_VERSION: 1.10.0
EXTRA_CMAKE_FLAGS: -DBUILD_LTO_LIBS=ON
DUB_VERSION: v1.9.0
- APPVEYOR_JOB_ARCH: x86
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
LLVM_VERSION: 6.0.1-3
HOST_LDC_VERSION: 1.10.0
DUB_VERSION: v1.9.0
# scripts that are called at very beginning, before repo cloning
init:
- git config --global core.autocrlf input
# scripts that run after cloning repository
install:
- cd c:\projects
# Fetch submodules
- cd ldc
- git submodule update --init --recursive
- cd ..
# Download & extract libcurl
- appveyor DownloadFile "https://dl.dropboxusercontent.com/s/jxwohqax4e2avyt/libcurl-7.48.0-WinSSL-zlib-x86-x64.zip?dl=0" -FileName libcurl.zip
- md libcurl
- cd libcurl
- 7z x ..\libcurl.zip > nul
- cd ..
# Copy libcurl.{dll,lib} and add to PATH, so that libcurl.dll is found during the tests
- ps: |
md libcurl\ldc2
If ($Env:APPVEYOR_JOB_ARCH -eq 'x64') {
cp libcurl\dmd2\windows\bin64\libcurl.dll libcurl\ldc2
cp libcurl\dmd2\windows\lib64\curl.lib libcurl\ldc2
} Else {
cp libcurl\dmd2\windows\bin\libcurl.dll libcurl\ldc2
cp libcurl\dmd2\windows\lib32mscoff\curl.lib libcurl\ldc2
}
- set PATH=%CD%\libcurl\ldc2;%PATH%
# Download & extract Ninja
- appveyor DownloadFile "https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-win.zip" -FileName ninja.zip
- md ninja
- cd ninja
- 7z x ..\ninja.zip > nul
- ninja --version
- cd ..
# Install lit
- python --version
- python -m pip install lit
- python -c "import lit; lit.main();" --version
# Download & extract D compiler
- ps: |
If (Test-Path Env:HOST_LDC_VERSION) {
$ldcVersion = $Env:HOST_LDC_VERSION
appveyor DownloadFile "http://github.com/ldc-developers/ldc/releases/download/v$ldcVersion/ldc2-$ldcVersion-windows-$Env:APPVEYOR_JOB_ARCH.7z" -FileName ldc2.7z
7z x ldc2.7z > $null
Set-Item -path env:DMD -value "c:\projects\ldc2-$ldcVersion-windows-$Env:APPVEYOR_JOB_ARCH\bin\ldmd2.exe"
} Else {
$dmdVersion = $Env:HOST_DMD_VERSION
appveyor DownloadFile "http://downloads.dlang.org/releases/2.x/$dmdVersion/dmd.$dmdVersion.windows.7z" -FileName dmd.7z
7z x dmd.7z > $null
Set-Item -path env:DMD -value c:\projects\dmd2\windows\bin\dmd.exe
}
# Download & extract GNU make + utils (for dmd-testsuite)
- bash --version
- appveyor DownloadFile "https://dl.dropboxusercontent.com/s/4y36f5ydgrk4p5g/make-4.2.1.7z?dl=0" -FileName make.7z
- md make
- cd make
- 7z x ..\make.7z > nul
- make --version
- cd ..
# Download & extract LDC-flavoured LLVM
- ps: |
$assertsSuffix = ''
If (!(Test-Path Env:APPVEYOR_REPO_TAG_NAME)) {
echo 'Using LLVM with enabled assertions'
$assertsSuffix = '-withAsserts'
}
appveyor DownloadFile "https://github.com/ldc-developers/llvm/releases/download/ldc-v$Env:LLVM_VERSION/llvm-$Env:LLVM_VERSION-windows-$Env:APPVEYOR_JOB_ARCH$assertsSuffix.7z" -FileName llvm.7z
- md llvm
- cd llvm
- 7z x ..\llvm.7z > nul
- cd ..
# Set environment variables
# (LLVM bin dir required for lld-link.exe,
# git's usr/bin required for GNU find precedence over Windows find.exe)
- set PATH=%CD%\llvm\bin;%CD%\ninja;%CD%\make;C:\Program Files\Git\usr\bin;%PATH%
- 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%
- if "%APPVEYOR_BUILD_WORKER_IMAGE:~-4%" == "2015" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %APPVEYOR_JOB_ARCH%
# Print environment info
- set
- msbuild /version
- cl
- cmake --version
#---------------------------------#
# build configuration #
#---------------------------------#
build_script:
- cd c:\projects
# Build bootstrap LDC
- md bootstrap
- cd bootstrap
- cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ROOT_DIR=c:/projects/llvm ..\ldc
- ninja -j2 all
- cd ..
# Build LDC and stdlib unittest runners
- md ninja-ldc
- cd ninja-ldc
- cmake -G Ninja -DCMAKE_BUILD_TYPE=Release %EXTRA_CMAKE_FLAGS% -DCMAKE_INSTALL_PREFIX=c:\projects\ldc2-%APPVEYOR_JOB_ARCH% -DINCLUDE_INSTALL_DIR=c:/projects/ldc2-%APPVEYOR_JOB_ARCH%/import -DLLVM_ROOT_DIR=c:/projects/llvm -DD_COMPILER=c:\projects\bootstrap\bin\ldmd2.exe ..\ldc
- ninja -j2 all all-test-runners
#---------------------------------#
# test configuration #
#---------------------------------#
test_script:
- cd c:\projects\ninja-ldc
- bin\ldc2 -version
# Build and run LDC D unittests
- ctest --output-on-failure -R "ldc2-unittest"
# Run LIT testsuite
# Exclude linking/link_internally.d with LLD < 6 due to a magic symbol
# required since VS 2017 v15.5 (see https://reviews.llvm.org/D41089).
- ps: If ($($Env:LLVM_VERSION[0]) -lt '6') { del ..\ldc\tests\linking\link_internally.d }
- ctest -V -R "lit-tests"
# Run DMD testsuite
- if "%APPVEYOR_JOB_ARCH%"=="x64" ( set OS=Win_64) else ( set OS=Win_32)
- set DMD_TESTSUITE_MAKE_ARGS=-j2
- ctest -V -R "dmd-testsuite"
# Run stdlib unittests
- ctest -j2 --output-on-failure -E "dmd-testsuite|lit-tests|ldc2-unittest"
#---------------------------------#
# deployment configuration #
#---------------------------------#
after_test:
# Install LDC
- ps: |
cd c:\projects\ninja-ldc
$ldcInstallDir = "c:\projects\ldc2-$Env:APPVEYOR_JOB_ARCH"
ninja install > $null
cd "$ldcInstallDir"
(cat etc\ldc2.conf).replace("C:/projects/ldc2-$Env:APPVEYOR_JOB_ARCH/", '%%ldcbinarypath%%/../') | Set-Content etc\ldc2.conf
cd ..
cp ldc/LICENSE "$ldcInstallDir"
git clone https://github.com/ldc-developers/ldc-scripts.git
cp ldc-scripts\ldc2-packaging\pkgfiles\README.txt "$ldcInstallDir"
cp libcurl\ldc2\libcurl.dll "$ldcInstallDir\bin"
cp libcurl\ldc2\curl.lib "$ldcInstallDir\lib"
If ($Env:APPVEYOR_JOB_ARCH -eq 'x64') {
cp c:\projects\llvm\bin\lld-link.exe "$ldcInstallDir\bin"
}
# Now rename the installation dir to test portability.
ren "$ldcInstallDir" ldc2-install
# Hello world integration test with LTO (x64 only)
- ps: |
If ($Env:APPVEYOR_JOB_ARCH -eq 'x64') {
cd c:\projects
$ldcInstallDir = 'c:\projects\ldc2-install'
echo 'void main() { import std.stdio; writefln("Hello world, %d bits", size_t.sizeof * 8); }' > hello.d
& "$ldcInstallDir\bin\ldc2.exe" hello.d '-of=hello_thin.exe' '-flto=thin' '-defaultlib=phobos2-ldc-lto,druntime-ldc-lto'
.\hello_thin.exe
& "$ldcInstallDir\bin\ldc2.exe" hello.d '-of=hello_full.exe' '-flto=full' '-defaultlib=phobos2-ldc-lto,druntime-ldc-lto'
.\hello_full.exe
}
# Build dub
- ps: |
cd c:\projects
$ldcInstallDir = 'c:\projects\ldc2-install'
Set-Item -path env:DC -value "$ldcInstallDir\bin\ldmd2"
git clone --recursive https://github.com/dlang/dub.git
cd dub
git checkout $Env:DUB_VERSION
(cat build.cmd).replace('curl.lib', "$ldcInstallDir\lib\curl.lib") | Set-Content build.cmd
.\build.cmd
cp bin\dub.exe "$ldcInstallDir\bin"
# Build dlang tools
- ps: |
cd c:\projects
$ldcInstallDir = 'c:\projects\ldc2-install'
git clone --recursive https://github.com/dlang/tools.git
cd tools
& "$ldcInstallDir\bin\ldmd2" -w rdmd.d
& "$ldcInstallDir\bin\ldmd2" -w ddemangle.d
& "$ldcInstallDir\bin\ldmd2" -w DustMite\dustmite.d DustMite\splitter.d
cp *.exe "$ldcInstallDir\bin"
# Pack installation dir & publish as artifact
- ps: |
cd c:\projects
If (Test-Path Env:APPVEYOR_REPO_TAG_NAME) {
$artifactBasename = "ldc2-$($Env:APPVEYOR_REPO_TAG_NAME.Substring(1))-windows-$Env:APPVEYOR_JOB_ARCH"
} Else {
$artifactBasename = "ldc2-$($Env:APPVEYOR_REPO_COMMIT.Substring(0, 8))-windows-$Env:APPVEYOR_JOB_ARCH"
}
ren ldc2-install $artifactBasename
7z a -mx=9 "$artifactBasename.7z" $artifactBasename > $null
ren $artifactBasename ldc2-install
Push-AppveyorArtifact "$artifactBasename.7z"
# x86 job: Create a 32/64-bit multilib artifact if the commit is on the master branch
# (or a tag). It consists of the x64 artifact (published by a successful x64 job)
# downloaded from GitHub, augmented by the 32-bit libs and an extra section in the
# ldc2.conf file for `-m32` (using the lib32 directory).
- ps: |
If (($Env:APPVEYOR_JOB_ARCH -eq 'x86') -And
( (Test-Path Env:APPVEYOR_REPO_TAG_NAME) -Or
( ($Env:APPVEYOR_REPO_BRANCH -eq 'master') -And !(Test-Path Env:APPVEYOR_PULL_REQUEST_NUMBER) ) ) ) {
echo 'Preparing 32/64-bit multilib artifact...'
cd c:\projects
If (Test-Path Env:APPVEYOR_REPO_TAG_NAME) {
$artifact64 = "https://github.com/ldc-developers/ldc/releases/download/$Env:APPVEYOR_REPO_TAG_NAME/ldc2-$($Env:APPVEYOR_REPO_TAG_NAME.Substring(1))-windows-x64.7z"
$artifactBasename = "ldc2-$($Env:APPVEYOR_REPO_TAG_NAME.Substring(1))-windows"
} Else {
$artifact64 = "https://github.com/ldc-developers/ldc/releases/download/CI/ldc2-$($Env:APPVEYOR_REPO_COMMIT.Substring(0, 8))-windows-x64.7z"
$artifactBasename = "ldc2-$($Env:APPVEYOR_REPO_COMMIT.Substring(0, 8))-windows"
}
$artifact64Downloaded = $True
Try {
(New-Object Net.WebClient).DownloadFile("$artifact64", 'c:\projects\ldc2-x64.7z')
} Catch {
echo 'Failed to download the 64-bit artifact from GitHub (the x64 job probably failed).'
echo 'Skipping the 32/64-bit multilib artifact.'
$artifact64Downloaded = $False
}
If ($artifact64Downloaded) {
7z x ldc2-x64.7z > $null
del ldc2-x64.7z
ren "$artifactBasename-x64" "$artifactBasename-multilib"
cd "$artifactBasename-multilib"
ren lib lib64
copy ..\ldc2-install\lib -Recurse
ren lib lib32
(cat etc\ldc2.conf).replace('%%ldcbinarypath%%/../lib', '%%ldcbinarypath%%/../lib64') | Set-Content etc\ldc2.conf
$conf32 = cat ..\ldc2-install\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
cd ..
7z a -mx=9 "$artifactBasename-multilib.7z" "$artifactBasename-multilib" > $null
Push-AppveyorArtifact "$artifactBasename-multilib.7z"
}
}
deploy:
- release: CI
prerelease: true
provider: GitHub
auth_token:
secure: qnbD8agL9mr0SFvy/sMkR2E29oQQ427T5zYwVVZkjRS3IZ361tG+9jlSiyEkyULy
artifact: /ldc2-.*\.7z/
on:
branch: master
appveyor_repo_tag: false
- release: $(APPVEYOR_REPO_TAG_NAME)
description: $(APPVEYOR_REPO_TAG_NAME)
prerelease: true
draft: true
provider: GitHub
auth_token:
secure: qnbD8agL9mr0SFvy/sMkR2E29oQQ427T5zYwVVZkjRS3IZ361tG+9jlSiyEkyULy
artifact: /ldc2-.*\.7z/
on:
appveyor_repo_tag: true