-
-
Notifications
You must be signed in to change notification settings - Fork 118
/
.appveyor.yml
199 lines (167 loc) · 6.48 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
# http://www.appveyor.com/docs/appveyor-yml
# mostly copied from nan appveyor.yml
## AppVeyor is used to build:
## - Electron (Win64, Win32)
## - Node.js (Win64, Win32)
os: Visual Studio 2019
# Set build version format here instead of in the admin panel.
version: '{build}'
environment:
DEBUG: 'node-libcurl'
NODE_LIBCURL_POSTINSTALL_SKIP_CLEANUP: 'true'
matrix:
# node.js
- nodejs_version: '18'
- nodejs_version: '20'
- nodejs_version: '21'
- nodejs_version: '20'
ELECTRON_VERSION: '28.0.0'
- nodejs_version: '20'
ELECTRON_VERSION: '27.1.3'
- nodejs_version: '20'
ELECTRON_VERSION: '26.6.2'
# disabled until nwjs supports newer node-gyp versions + python 3
# - nodejs_version: '12'
# NWJS_VERSION: '0.44.5'
# - nodejs_version: '12'
# NWJS_VERSION: '0.43.6'
# - nodejs_version: '12'
# NWJS_VERSION: '0.42.6'
matrix:
allow_failures:
- nodejs_version: '21'
skip_branch_with_pr: true
platform:
- x86
- x64
# git clone depth
clone_depth: 5
cache:
- build -> binding.gyp, LIBCURL_VERSION_WIN_DEPS
- '%USERPROFILE%\.node-gyp'
- '%USERPROFILE%\.nw-gyp'
- '%USERPROFILE%\.nw'
- '%LOCALAPPDATA%\Yarn\cache'
- '%LOCALAPPDATA%\electron\Cache'
# Install scripts. (runs after repo cloning)
install:
# We need this because we are building libcurl with c-ares
# instead of the system DNS resolver, and on Windows, this
# means that localhost is not handled by default
- echo 127.0.0.1 localhost >> C:\Windows\System32\drivers\etc\hosts
- echo ::1 localhost >> C:\Windows\System32\drivers\etc\hosts
# Get nasm
- cinst nasm -y
- set PATH=%PROGRAMFILES%\NASM;%PATH%
# in case above does not work
# - curl -L -o nasminst.exe http://libgd.blob.core.windows.net/nasm/nasm-2.07-installer.exe
# - start /wait nasminst.exe /S
# - ps: $env:path="C:\Program Files (x86)\nasm;$($env:path)"
- ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version) $env:Platform
- SET PATH=%cd%\node_modules\.bin\;%PATH%
# Output useful info for debugging.
- node --version
- npm --version
- yarn --version
# Check if we need to publish the package
- SET PUBLISH_BINARY=false
# we are creating a empty file named publish
- ps: if ( $env:APPVEYOR_REPO_COMMIT_MESSAGE.ToLower().Contains('[publish binary]') -OR $(git describe --tags --always HEAD) -eq $env:APPVEYOR_REPO_BRANCH ) { echo $null >> publish }
- IF EXIST "publish" SET PUBLISH_BINARY=true
# Install the curl-for-windows dependencies.
- git submodule update --init --recursive
- ps: |
python -m pip install --upgrade pip
if (-not (python -c "import distutils")) {
pip install setuptools
}
- python deps\curl-for-windows\configure.py
- ps: |
# $ErrorActionPreference = "Stop"
$runtime = ""
$dist_url = ""
$target = ""
if ($null -ne $env:ELECTRON_VERSION) {
$runtime = "electron"
$dist_url = "https://electronjs.org/headers"
$target = $env:ELECTRON_VERSION
yarn global add electron@${env:ELECTRON_VERSION}
} elseif ($null -ne $env:NWJS_VERSION) {
$runtime = "node-webkit"
$target = $env:NWJS_VERSION
yarn global add [email protected]
yarn global add nw@$target
# We had this issue on nw-gyp 3.6.4
# https://github.com/nwjs/nw-gyp/issues/116
# patch tool for Windows
# https://stackoverflow.com/a/9485089/710693
pip install patch
# apply patch to nw-gyp fixing issue
python -m patch -d "$(yarn global dir)/node_modules/nw-gyp/src" ./scripts/ci/patches/win_delay_load_hook.cc.patch
$arch = if ($env:PLATFORM -eq "x86") { "ia32" } else { "x64" }
$rootFolder = "$env:USERPROFILE/.nw"
mkdir -Force $rootFolder
$nwName = "nwjs-v$target-win-$arch"
$outputFolder = "$env:USERPROFILE/.nw/$nwName"
if (![System.IO.File]::Exists("$outputFolder/nw.exe")) {
Write-Host "nw.exe not found on $outputFolder - Downloading it"
$url = "https://dl.nwjs.io/v$target/$nwName.zip"
$output = "$rootFolder/$nwName.zip"
# https://blog.jourdant.me/post/3-ways-to-download-files-with-powershell
Import-Module BitsTransfer
Start-BitsTransfer -Source $url -Destination $output
Expand-Archive $output -DestinationPath $rootFolder
Remove-Item –path $output
}
$env:PATH = "$outputFolder;$env:PATH"
}
$env:npm_config_msvs_version = "2019"
$env:npm_config_build_from_source = "true"
$env:npm_config_runtime = $runtime
$env:npm_config_dist_url = $dist_url
$env:npm_config_target = $target
Write-Host $env:npm_config_msvs_version
Write-Host $env:npm_config_build_from_source
Write-Host $env:npm_config_runtime
Write-Host $env:npm_config_dist_url
Write-Host $env:npm_config_target
build_script:
- yarn install --frozen-lockfile
- dir .
# Post-install test scripts.
test_script:
# run tests
- ps: |
if ($null -ne $env:ELECTRON_VERSION) {
yarn test:electron
} else {
if ($null -ne $env:NWJS_VERSION) {
Write-Host "No tests available for nw.js, skipping tests..."
} else {
yarn ts-node -e "console.log(require('./lib').Curl.getVersionInfoString())"
yarn test
}
}
# This is needed because powershell treats
# output to stderr as errors
# See:
# https://stackoverflow.com/q/2095088/710693
# https://stackoverflow.com/a/12866669/710693
# https://stackoverflow.com/a/31451481/710693
if ($LASTEXITCODE -eq 0) {
$host.SetShouldExit(0)
}
after_test:
- IF "%PUBLISH_BINARY%" == "true" (node-pre-gyp package testpackage --verbose)
- IF "%PUBLISH_BINARY%" == "true" (for /f "usebackq delims=" %%x in (`node-pre-gyp reveal staged_tarball --silent`) do node scripts\module-packaging.js --publish %%x)
on_success:
- SET INSTALL_RESULT=0
- set npm_config_fallback_to_build=false
- IF "%PUBLISH_BINARY%" == "true" (yarn install --frozen-lockfile)
- IF "%PUBLISH_BINARY%" == "true" (SET INSTALL_RESULT=%ERRORLEVEL%)
- IF NOT %INSTALL_RESULT% == 0 (for /f "usebackq delims=" %%x in (`node-pre-gyp reveal hosted_tarball --silent`) do node scripts\module-packaging.js --unpublish %%x)
- IF NOT %INSTALL_RESULT% == 0 (echo "Package unpublished since we got an error while installing it.")
- dir .
# - node-pre-gyp clean
# Don't actually deploy.
deploy: off