forked from daormar/thot
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathappveyor.yml
148 lines (128 loc) · 5.7 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
version: "{build}"
pull_requests:
do_not_increment_build_number: true
branches:
only:
- master
skip_branch_with_pr: true
image:
- Ubuntu1604
- macOS-Mojave
- Visual Studio 2019
environment:
ApiKey:
secure: F+Q6kHqg+DlND/2yeIt5bXJC5GJ0ZRufxxdwQRkcPT8=
Timeout: 10
LinuxJob: "Image: Ubuntu1604"
MacJob: "Image: macos-mojave"
for:
- matrix:
only:
- image: Ubuntu1604
build_script:
- sh: |
set -e
mkdir build
pushd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_PYTHON_MODULE=OFF
make
appveyor PushArtifact ./src/shared_library/libthot.so
popd
test_script:
- sh: |
./build/tests/thot_test --gtest_output=xml:./build/test-results.xml
curl -F 'file=@./build/test-results.xml' https://ci.appveyor.com/api/testresults/junit/$APPVEYOR_JOB_ID
- matrix:
only:
- image: macos-mojave
install:
- sh: brew install libomp
build_script:
- sh: |
set -e
mkdir build
pushd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_PYTHON_MODULE=OFF
make
appveyor PushArtifact ./src/shared_library/libthot.dylib
popd
test_script:
- sh: |
./build/tests/thot_test --gtest_output=xml:./build/test-results.xml
curl -F 'file=@./build/test-results.xml' https://ci.appveyor.com/api/testresults/junit/$APPVEYOR_JOB_ID
- matrix:
only:
- image: Visual Studio 2019
build_script:
- ps: |
New-Item -ItemType Directory -Force -Path build\x64
New-Item -ItemType Directory -Force -Path build\x86
pushd build
pushd x64
cmake ..\.. -A x64 -DBUILD_PYTHON_MODULE=OFF
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
cmake --build . --config Release
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
popd
pushd x86
cmake ..\.. -A win32 -DBUILD_PYTHON_MODULE=OFF
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
cmake --build . --config Release
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
popd
popd
New-Item -ItemType Directory -Force -Path artifacts\win-x64
New-Item -ItemType Directory -Force -Path artifacts\win-x86
Copy-Item -Path build\x64\src\shared_library\Release\thot.dll -Destination artifacts\win-x64\
Copy-Item -Path build\x86\src\shared_library\Release\thot.dll -Destination artifacts\win-x86\
Write-Host "Waiting for job `"$env:LinuxJob`" to complete"
$headers =
@{
"Authorization" = "Bearer $env:ApiKey"
"Content-type" = "application/json"
}
[datetime]$stop = ([datetime]::Now).AddMinutes($env:Timeout)
[bool]$success = $false
while (!$success -and ([datetime]::Now) -lt $stop)
{
$project = Invoke-RestMethod -Uri "https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG" -Headers $headers -Method GET
$linuxJobJson = $project.build.jobs | where {$_.name -eq $env:LinuxJob}
$success = $linuxJobJson.status -eq "success"
$linuxJobId = $linuxJobJson.jobId;
if (!$success) { Start-sleep 5 }
}
if (!$success) { throw "Job `"$env:LinuxJob`" was not finished in $env:Timeout minutes" }
if (!$linuxJobId) { throw "Unable to get JobId for the job `"$env:LinuxJob`"" }
New-Item -ItemType Directory -Force -Path artifacts\linux-x64
Start-FileDownload https://ci.appveyor.com/api/buildjobs/$linuxJobId/artifacts/libthot.so -FileName artifacts\linux-x64\libthot.so
Write-Host "Retrieved `"$env:LinuxJob`" artifacts"
Write-Host "Waiting for job `"$env:MacJob`" to complete"
$stop = ([datetime]::Now).AddMinutes($env:Timeout)
$success = $false
while (!$success -and ([datetime]::Now) -lt $stop)
{
$project = Invoke-RestMethod -Uri "https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG" -Headers $headers -Method GET
$macJobJson = $project.build.jobs | where {$_.name -eq $env:MacJob}
$success = $macJobJson.status -eq "success"
$macJobId = $macJobJson.jobId;
if (!$success) { Start-sleep 5 }
}
if (!$success) { throw "Job `"$env:MacJob`" was not finished in $env:Timeout minutes" }
if (!$macJobId) { throw "Unable to get JobId for the job `"$env:MacJob`"" }
New-Item -ItemType Directory -Force -Path artifacts\osx-x64
Start-FileDownload https://ci.appveyor.com/api/buildjobs/$macJobId/artifacts/libthot.dylib -FileName artifacts\osx-x64\libthot.dylib
Write-Host "Retrieved `"$env:MacJob`" artifacts"
nuget pack nuget\Thot.nuspec -Properties Configuration=Release -BasePath nuget -OutputDirectory artifacts
Get-ChildItem artifacts\*.nupkg | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
test_script:
- ps: |
.\build\x64\tests\Release\thot_test --gtest_output=xml:.\build\x64\test-results.xml
$wc = New-Object 'System.Net.WebClient'
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\build\x64\test-results.xml))
deploy_script:
- ps: |
if ($env:APPVEYOR_REPO_TAG -eq "true")
{
nuget push artifacts\*.nupkg -NoSymbols -SkipDuplicate -ApiKey $env:NUGET_API_KEY -Source https://api.nuget.org/v3/index.json
}
test: off