forked from owent/libcopp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
executable file
·217 lines (147 loc) · 6.69 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
#
# Appveyor configuration file for CI build of hiredis-happ on Windows (under Cygwin)
#
# For further details see http://www.appveyor.com
#
#
# Custom environment variables
#
environment:
global:
PREBUILT_ROOT: C:/Users/appveyor/prebuilt
SETUP_ROOT: C:/Users/appveyor/setup
PKG_SRC_ROOT: C:/Users/appveyor/pkg_src
MSYS2_PREFIX: C:/tools/msys64
MSYS2_LOG_FILE: C:/Users/appveyor/pkg_src/output.log
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
platform: x64
CMAKE_GEN: Visual Studio 15 2017 Win64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
platform: x64
CMAKE_GEN: Visual Studio 14 2015 Win64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
platform: x64
CMAKE_GEN: Visual Studio 12 2013 Win64
#- os: MinGW
# CMAKE_GEN: MinGW32
- os: MinGW
CMAKE_GEN: MinGW64
configuration: RelWithDebInfo
#
# Cache Cygwin files to speed up build
#
cache:
- C:\Users\appveyor\prebuilt
#
# Do a shallow clone of the repo to speed up build
#
clone_depth: 1
#
# Initialisation prior to pulling the Mono repository
# Attempt to ensure we don't try to convert line endings to Win32 CRLF as this will cause build to fail
#
init:
- ps: >-
if ( -not ( Test-Path "$Env:PKG_SRC_ROOT" ) ) {
mkdir "$Env:PKG_SRC_ROOT"
}
if ( -not ( Test-Path "$Env:MSYS2_PREFIX" ) ) {
mkdir "$Env:MSYS2_PREFIX"
}
- ps: >-
& git config --global core.autocrlf input
if ( "$Env:OS" -ieq "MinGW" ) {
if ( Test-Path "C:/msys64" ) {
$Env:MSYS2_PREFIX="C:/msys64"
$Env:PATH="$Env:MSYS2_PREFIX;$Env:PATH"
} else {
& cinst -y msys2 | Out-Host
}
echo "" > "$Env:MSYS2_LOG_FILE"
Get-ChildItem "$Env:MSYS2_PREFIX"
}
- ps: >-
if ( "$Env:OS" -ieq "MinGW" ) {
echo "$Env:MSYS2_PREFIX/msys2_shell -lc 'pacman -Su --noconfirm --force > '$Env:MSYS2_LOG_FILE' 2>&1'"
& "$Env:MSYS2_PREFIX/msys2_shell" -lc "pacman -Su --noconfirm --force > '$Env:MSYS2_LOG_FILE' 2>&1" | Out-Host
Get-Content "$Env:MSYS2_LOG_FILE"
}
#
# Install needed build dependencies
#
install:
- ps: >-
if ( "$Env:OS" -ieq "MinGW" ) {
& "$Env:MSYS2_PREFIX/msys2_shell" -lc 'for pkg_name in cmake m4 curl wget tar autoconf automake mingw-w64-x86_64-toolchain mingw-w64-x86_64-toolchain mingw-w64-i686-toolchain mingw-w64-x86_64-libtool mingw-w64-i686-libtool python; do pacman -S --noconfirm --force $pkg_name >> '$Env:MSYS2_LOG_FILE' 2>&1; done' | Out-Host
Get-Content "$Env:MSYS2_LOG_FILE"
} else {
echo "No need install."
}
# Build script
#
# NOTES:
#
# The stdin/stdout file descriptor appears not to be valid for the Appveyor
# build which causes failures as certain functions attempt to redirect
# default file handles. Ensure a dummy file descriptor is opened with 'exec'.
#
build_script:
- ps: >-
cd "$Env:APPVEYOR_BUILD_FOLDER"
New-Item -Path build -ItemType directory
cd build
Remove-Item -r *
if ( "$Env:OS" -ieq "MinGW" ) {
if ( "$Env:CMAKE_GEN" -ieq "MinGW32" ) {
echo "$Env:MSYS2_PREFIX/msys2_shell -mingw32 -lc cd '$Env:APPVEYOR_BUILD_FOLDER/build'; mkdir build cmake .. -G 'MSYS Makefiles' -DLIBCOPP_FCONTEXT_USE_TSX=ON -DPROJECT_ENABLE_UNITTEST=ON -DPROJECT_ENABLE_SAMPLE=ON -DCMAKE_BUILD_TYPE=$Env:CONFIGURATION ; cmake --build . -- -j4"
& "$Env:MSYS2_PREFIX/msys2_shell" -mingw32 -lc "cd '$Env:APPVEYOR_BUILD_FOLDER/build'; cmake .. -G 'MSYS Makefiles' -DLIBCOPP_FCONTEXT_USE_TSX=ON -DPROJECT_ENABLE_UNITTEST=ON -DPROJECT_ENABLE_SAMPLE=ON > '$Env:MSYS2_LOG_FILE' 2>&1; cmake --build . -- -j4 >> '$Env:MSYS2_LOG_FILE' 2>&1" | Out-Host
Get-Content "$Env:MSYS2_LOG_FILE"
} else {
echo "$Env:MSYS2_PREFIX/msys2_shell -mingw64 -lc cd '$Env:APPVEYOR_BUILD_FOLDER/build'; cmake .. -G 'MSYS Makefiles' -DLIBCOPP_FCONTEXT_USE_TSX=ON -DPROJECT_ENABLE_UNITTEST=ON -DPROJECT_ENABLE_SAMPLE=ON -DCMAKE_BUILD_TYPE=$Env:CONFIGURATION ; cmake --build . -- -j4"
& "$Env:MSYS2_PREFIX/msys2_shell" -mingw64 -lc "cd '$Env:APPVEYOR_BUILD_FOLDER/build'; cmake .. -G 'MSYS Makefiles' -DLIBCOPP_FCONTEXT_USE_TSX=ON -DPROJECT_ENABLE_UNITTEST=ON -DPROJECT_ENABLE_SAMPLE=ON > '$Env:MSYS2_LOG_FILE' 2>&1; cmake --build . -- -j4 >> '$Env:MSYS2_LOG_FILE' 2>&1" | Out-Host
Get-Content "$Env:MSYS2_LOG_FILE"
}
} else {
echo "cmake .. -G '$Env:CMAKE_GEN' -DLIBCOPP_FCONTEXT_USE_TSX=ON -DPROJECT_ENABLE_UNITTEST=ON -DPROJECT_ENABLE_SAMPLE=ON -DCMAKE_BUILD_TYPE=$Env:CONFIGURATION "
& cmake .. -G "$Env:CMAKE_GEN" -DLIBCOPP_FCONTEXT_USE_TSX=ON -DPROJECT_ENABLE_UNITTEST=ON -DPROJECT_ENABLE_SAMPLE=ON -DCMAKE_BUILD_TYPE=$Env:CONFIGURATION
echo "cmake --build . --config $Env:CONFIGURATION"
& cmake --build . --config $Env:CONFIGURATION
}
#
# Run unit test
# Can not get failed log in mingw, so just check if build success in mingw(custom test myself)
#
test_script:
- ps: >-
if ( "$Env:OS" -ieq "MinGW" ) {
if ( "$Env:CMAKE_GEN" -ieq "MinGW32" ) {
echo "$Env:MSYS2_PREFIX/msys2_shell -mingw32 -lc cd '$Env:APPVEYOR_BUILD_FOLDER/build'; cmake --build . -- run_sample run_test benchmark;"
& "$Env:MSYS2_PREFIX/msys2_shell" -mingw32 -lc "cd '$Env:APPVEYOR_BUILD_FOLDER/build'; cmake --build . -- run_sample run_test benchmark > '$Env:MSYS2_LOG_FILE';" | Out-Host
Get-Content "$Env:MSYS2_LOG_FILE"
} else {
echo "$Env:MSYS2_PREFIX/msys2_shell -mingw64 -lc cd '$Env:APPVEYOR_BUILD_FOLDER/build'; cmake --build . -- run_sample run_test benchmark;"
& "$Env:MSYS2_PREFIX/msys2_shell" -mingw64 -lc "cd '$Env:APPVEYOR_BUILD_FOLDER/build'; cmake --build . -- run_sample run_test benchmark > '$Env:MSYS2_LOG_FILE';" | Out-Host
Get-Content "$Env:MSYS2_LOG_FILE"
}
} else {
& cmake --build . --config $Env:CONFIGURATION --target run_sample
& cmake --build . --config $Env:CONFIGURATION --target run_test
& cmake --build . --config $Env:CONFIGURATION --target benchmark
}
#
# Only build the master branch
#
branches:
only:
- master
- v2
# no need artifacts
notifications:
- provider: Email
to:
on_build_success: false
on_build_failure: false
on_build_status_changed: true