forked from ldc-developers/ldc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
232 lines (216 loc) · 9.75 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
#---------------------------------#
# general configuration #
#---------------------------------#
#version: 1.0.{build}-{branch}
# Do not build on tags (GitHub only)
skip_tags: true
#---------------------------------#
# environment configuration #
#---------------------------------#
# Operating system (build VM template)
os: Visual Studio 2015
environment:
matrix:
- APPVEYOR_JOB_ARCH: x64
D_COMPILER: ldc
- APPVEYOR_JOB_ARCH: x86
D_COMPILER: dmd
#matrix:
# allow_failures:
# - APPVEYOR_JOB_ARCH: x86
# 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 ..
# Clone libconfig (v1.6 does not work due to https://github.com/hyperrealm/libconfig/issues/47)
- git clone https://github.com/hyperrealm/libconfig.git libconfig
- cd libconfig
- git checkout 7585cf6
- cd ..
# Download & extract libcurl
- appveyor DownloadFile "http://d.darktech.org/libcurl-7.51.0-WinSSL-zlib-x86-x64.zip" -FileName libcurl.zip
- md libcurl
- cd libcurl
- 7z x ..\libcurl.zip > nul
- cd ..
# Copy libcurl.dll to final LDC installation directory and add to PATH
- md ldc-%APPVEYOR_JOB_ARCH% && md ldc-%APPVEYOR_JOB_ARCH%\bin
- if "%APPVEYOR_JOB_ARCH%"=="x64" ( copy libcurl\dmd2\windows\bin64\libcurl.dll ldc-x64\bin )
- if "%APPVEYOR_JOB_ARCH%"=="x86" ( copy libcurl\dmd2\windows\bin\libcurl.dll ldc-x86\bin )
- set PATH=%CD%\ldc-%APPVEYOR_JOB_ARCH%\bin;%PATH%
# Download & extract Ninja
- appveyor DownloadFile "https://github.com/ninja-build/ninja/releases/download/v1.7.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 ($Env:D_COMPILER -eq 'dmd') {
$dmdVersion = '2.071.2'
appveyor DownloadFile "http://downloads.dlang.org/releases/2.x/$dmdVersion/dmd.$dmdVersion.windows.7z" -FileName dmd2.7z
7z x dmd2.7z > $null
Set-Item -path env:DMD -value c:\projects\dmd2\windows\bin\dmd.exe
c:\projects\dmd2\windows\bin\dmd.exe --version
} Else {
If ($Env:APPVEYOR_JOB_ARCH -eq 'x64') {
appveyor DownloadFile 'http://github.com/ldc-developers/ldc/releases/download/v1.0.0/ldc2-1.0.0-win64-msvc.zip' -FileName ldc2.zip
7z x ldc2.zip > $null
Set-Item -path env:DMD -value c:\projects\ldc2-1.0.0-win64-msvc\bin\ldmd2.exe
c:\projects\ldc2-1.0.0-win64-msvc\bin\ldc2 --version
} Else {
appveyor DownloadFile 'http://github.com/ldc-developers/ldc/releases/download/v1.0.0/ldc2-1.0.0-win32-msvc.zip' -FileName ldc2.zip
7z x ldc2.zip > $null
Set-Item -path env:DMD -value c:\projects\ldc2-1.0.0-win32-msvc\bin\ldmd2.exe
c:\projects\ldc2-1.0.0-win32-msvc\bin\ldc2 --version
}
}
# 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 a pre-built LLVM (CMAKE_BUILD_TYPE=Release, LLVM_ENABLE_ASSERTIONS=ON)
- ps: |
If ($Env:APPVEYOR_JOB_ARCH -eq 'x64') {
appveyor DownloadFile 'https://dl.dropboxusercontent.com/s/6jc2wld5wqgf1jg/LLVM-3.9.1-x64.7z?dl=0' -FileName llvm-x64.7z
} Else {
appveyor DownloadFile 'https://dl.dropboxusercontent.com/s/zhlt3x8xyqlx2n4/LLVM-3.9.1-x86.7z?dl=0' -FileName llvm-x86.7z
}
- md llvm-%APPVEYOR_JOB_ARCH%
- cd llvm-%APPVEYOR_JOB_ARCH%
- 7z x ..\llvm-%APPVEYOR_JOB_ARCH%.7z > nul
- cd ..
# Set environment variables
- set PATH=%CD%\ninja;%CD%\make;%PATH%
- if "%APPVEYOR_JOB_ARCH%"=="x64" ( call "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 )
- if "%APPVEYOR_JOB_ARCH%"=="x86" ( call "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 )
# Print environment info
- set
- msbuild /version
- cl
- cmake --version
#---------------------------------#
# build configuration #
#---------------------------------#
before_build:
- cd c:\projects
# Build libconfig
- if "%APPVEYOR_JOB_ARCH%"=="x64" ( msbuild libconfig\lib\libconfig.vcxproj /p:Configuration=ReleaseStatic /p:Platform=x64 )
- if "%APPVEYOR_JOB_ARCH%"=="x86" ( msbuild libconfig\lib\libconfig.vcxproj /p:Configuration=ReleaseStatic /p:Platform=Win32 )
build_script:
- cd c:\projects
# Generate build files for LDC
- md ninja-ldc
- cd ninja-ldc
- if "%APPVEYOR_JOB_ARCH%"=="x64" ( cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=c:\projects\ldc-x64 -DLLVM_ROOT_DIR=c:/projects/llvm-x64 -DLIBCONFIG_INCLUDE_DIR=c:/projects/libconfig/lib -DLIBCONFIG_LIBRARY=c:/projects/libconfig/lib/x64/ReleaseStatic/libconfig.lib ..\ldc )
- if "%APPVEYOR_JOB_ARCH%"=="x86" ( cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=c:\projects\ldc-x86 -DLLVM_ROOT_DIR=c:/projects/llvm-x86 -DLIBCONFIG_INCLUDE_DIR=c:/projects/libconfig/lib -DLIBCONFIG_LIBRARY=c:/projects/libconfig/lib/ReleaseStatic/libconfig.lib ..\ldc )
# Build LDC, druntime and phobos
- ninja -j2
after_build:
# install LDC, compress & publish as artifact
- ps: |
echo 'Preparing artifact...'
cd c:\projects\ninja-ldc
ninja install > $null
copy bin\ldc2.pdb "..\ldc-$Env:APPVEYOR_JOB_ARCH\bin"
cd "..\ldc-$Env:APPVEYOR_JOB_ARCH"
(gc etc\ldc2.conf).replace("C:/projects/ldc-$Env:APPVEYOR_JOB_ARCH/", '%%ldcbinarypath%%/../') | sc etc\ldc2.conf
$artifactFilename = "LDC-master-$Env:APPVEYOR_BUILD_NUMBER-$Env:APPVEYOR_JOB_ARCH.7z"
7z a "..\$artifactFilename" * > $null
cd ..
Push-AppveyorArtifact $artifactFilename
# x86 job: Create a 32/64-bit multilib artifact if the commit is on the master branch.
# 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_REPO_BRANCH -eq 'master') -And !(Test-Path Env:APPVEYOR_PULL_REQUEST_NUMBER) -And ($Env:APPVEYOR_JOB_ARCH -eq 'x86')) {
echo 'Preparing 32/64-bit multilib artifact...'
cd c:\projects
$artifact64Downloaded = $True
Try {
(New-Object Net.WebClient).DownloadFile("https://github.com/ldc-developers/ldc/releases/download/LDC-Win64-master/LDC-master-$Env:APPVEYOR_BUILD_NUMBER-x64.7z", 'c:\projects\LDC-master-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) {
md ldc-multilib > $null
cd ldc-multilib
7z x ..\LDC-master-x64.7z > $null
ren lib lib64
copy ..\ldc-x86\lib -Recurse
ren lib lib32
(gc etc\ldc2.conf).replace('%%ldcbinarypath%%/../lib', '%%ldcbinarypath%%/../lib64') | sc etc\ldc2.conf
$conf32 = gc ..\ldc-x86\etc\ldc2.conf -Raw
$conf32 = "`r`ni686-pc-windows-msvc:" + $conf32.Substring($conf32.IndexOf("`r`ndefault:") + 10)
$conf32 = $conf32.Replace('%%ldcbinarypath%%/../lib', '%%ldcbinarypath%%/../lib32')
ac etc\ldc2.conf $conf32
$artifactFilename = "LDC-master-$Env:APPVEYOR_BUILD_NUMBER-multilib.7z"
7z a "..\$artifactFilename" * > $null
cd ..
Push-AppveyorArtifact $artifactFilename
}
}
#---------------------------------#
# test configuration #
#---------------------------------#
test_script:
- cd c:\projects\ninja-ldc
- bin\ldc2 -version
# Compile, link & execute a hello-world program
- ps: 'echo "import std.stdio; void main() { writeln(""Hello world!""); }" > hello.d'
- bin\ldc2 hello.d
- hello.exe
# Compile the druntime & phobos unit tests
- ninja -j2 druntime-ldc-unittest-debug phobos2-ldc-unittest-debug druntime-ldc-unittest phobos2-ldc-unittest
# Execute dmd-testsuite
- if "%APPVEYOR_JOB_ARCH%"=="x64" ( set OS=Win_64) else ( set OS=Win_32)
- set DMD_TESTSUITE_MAKE_ARGS=-j2
- ctest --verbose -R dmd-testsuite
# Execute the LLVM IR tests
- ctest --output-on-failure -V -R lit-tests
# Execute the unit tests
- ctest -j2 --output-on-failure -E "dmd-testsuite|lit-tests"
#---------------------------------#
# deployment configuration #
#---------------------------------#
deploy:
- provider: GitHub
release: 'LDC Win64 master'
description: "Latest successful Windows CI builds of branch 'master'"
draft: true
prerelease: true
auth_token:
secure: qnbD8agL9mr0SFvy/sMkR2E29oQQ427T5zYwVVZkjRS3IZ361tG+9jlSiyEkyULy
artifact: LDC-master-$(APPVEYOR_BUILD_NUMBER)-$(APPVEYOR_JOB_ARCH).7z
on:
branch: master
- provider: GitHub
release: 'LDC Win64 master'
description: "Latest successful Windows CI builds of branch 'master'"
draft: true
prerelease: true
auth_token:
secure: qnbD8agL9mr0SFvy/sMkR2E29oQQ427T5zYwVVZkjRS3IZ361tG+9jlSiyEkyULy
artifact: LDC-master-$(APPVEYOR_BUILD_NUMBER)-multilib.7z
on:
branch: master
APPVEYOR_JOB_ARCH: x86