-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBuild.ps1
131 lines (87 loc) · 3.32 KB
/
Build.ps1
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
param (
[switch]$init,
[switch]$build,
[switch]$test,
[switch]$after_test,
[switch]$on_finish,
[switch]$upload
)
#$ErrorActionPreference = 'Stop';
if ($init) {
Write-Host Initializing
if ($isWindows) {
python -m pip install --upgrade pip setuptools wheel nose
} else {
sudo apt install python-pip -y
python -m pip install --user --upgrade pip setuptools wheel nose twine
}
}
if ($build) {
Write-Host Starting build
if ($isWindows) {
# Build native windows libraries
msbuild .\native\source\.VS2017\PhonologyEngine.sln /property:Platform=x86 /p:Configuration=Release /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
Push-AppveyorArtifact ./phonology_engine/Win32_x86/PhonologyEngine.dll -FileName phonology_engine/Win32_x86/PhonologyEngine.dll -DeploymentName to-publish
msbuild .\native\source\.VS2017\PhonologyEngine.sln /property:Platform=x64 /p:Configuration=Release /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
Push-AppveyorArtifact ./phonology_engine/Win64_x64/PhonologyEngine.dll -FileName phonology_engine/Win64_x64/PhonologyEngine.dll -DeploymentName to-publish
} else {
# Build native linux libraries
cd native/source
make
cd ../..
}
python setup.py build
}
if ($test) {
Write-Host Starting test
# this produces nosetests.xml
if ($isWindows) {
cmd /c python setup.py nosetests --with-xunit --verbosity=2 2`>`&1
} else {
python setup.py nosetests --with-xunit --verbosity=2
}
if ($LastExitCode -ne 0) {
$lec = $LastExitCode
echo "LastExitCode After: $lec"
$host.SetShouldExit($lec)
}
}
if ($after_test -and $isLinux) {
Write-Host After Test
# Download VS artifacts
$env:previousJob = 'Image: Visual Studio 2017'
$headers = @{
"Authorization" = "Bearer $ApiKey"
"Content-type" = "application/json"
}
[bool]$success = $false
$project = Invoke-RestMethod -Uri "https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG" -Headers $headers -Method GET
$previousJobJson = $project.build.jobs | where {$_.name -eq $env:previousJob}
$success = $previousJobJson.status -eq "success"
$previousJobId = $previousJobJson.jobId;
if (!$previousJobId) {throw "Unable t get JobId for the job `"$env:previousJob`""}
mkdir -p phonology_engine/Win32_x86
Start-FileDownload https://ci.appveyor.com/api/buildjobs/$previousJobId/artifacts/phonology_engine/Win32_x86/PhonologyEngine.dll -FileName phonology_engine/Win32_x86/PhonologyEngine.dll
mkdir -p phonology_engine/Win64_x64
Start-FileDownload https://ci.appveyor.com/api/buildjobs/$previousJobId/artifacts/phonology_engine/Win64_x64/PhonologyEngine.dll -FileName phonology_engine/Win64_x64/PhonologyEngine.dll
# Build WHEEL dsitro
python setup.py sdist bdist_wheel
}
if ($on_finish) {
Write-Host On Finish
# this uploads nosetests.xml produced in test_script step
$wc = New-Object 'System.Net.WebClient'
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\nosetests.xml))
}
if ($upload -and $isLinux) {
Write-Host Upload
@"
[distutils]
index-servers =
pypi
[pypi]
username: aleksas
password: $env:PYPI_PASSWORD
"@ | Out-File ~/.pypirc -Force -Encoding ascii
python -m twine upload --verbose --skip-existing dist/*.whl
}