forked from coin-or/Sonnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
195 lines (170 loc) · 7.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
#---------------------------------#
# general configuration #
#---------------------------------#
environment:
sonar_token:
secure: GHaPt+XpyKpioRGIrDn/oDzDF/5F/tc4U7aA7H2sWAnDi37kkzGcPFKaKSY24kfm
github_auth_token:
secure: 7rM8AX6MnUMN7F8Ad9BTvgRci9lmy4i3LWHC5l9ZdVY3xtJg7RwIXNWAg95vXFmK
# version format
version: 2.0.0.{build}
# you can use {branch} name in version format too
# version: 1.0.{build}-{branch}
# branches to build
#branches:
# Do not build on tags (GitHub, Bitbucket, GitLab, Gitea)
# skip_tags: true
# we dont need the full git history of Sonnet to be part of the clone.
shallow_clone: true
image: Visual Studio 2022
# scripts that are called at very beginning, before repo cloning
init:
- ps: |
if ($env:sonar_token -like '')
{
Write-Host "Cannot decrypt SonarQube token. This could happen for builds from Pull Requests from other repos."
Write-Host "Proceeding without SonarQube..."
} else {
Write-Host "Proceeding with SonarQube..."
choco install "sonarscanner-msbuild-net46" -y
$env:JAVA_HOME = "C:\Program Files\Java\jdk17"
$env:PATH += ";JAVA_HOME\bin"
}
#- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# scripts that run after cloning repository
install:
# by default, all script lines are interpreted as batch
# for clarity, don't use extra bat files
#- CALL c:\projects\sonnet\appveyor-install.bat
# Multi-line batch if ( ) does work, but works in ps
- echo -- Install
- ps: |
cd c:\projects
$env:GIT_REDIRECT_STDERR = '2>&1'
$deps = Get-Content sonnet\.coin-or\Dependencies | ConvertFrom-String -Delimiter "\s+" -PropertyNames i,j,k
foreach ($d in $deps)
{
Write-Host "git clone --depth 1 -b" $d.k $d.j $d.i
git clone --depth 1 -b $d.k $d.j $d.i
}
if (Test-Path -Path 'Data\miplib3')
{
Write-Host "Found Data\miplib3. Extracting and removing archives."
7z x -bso0 -oData\miplib3 Data\miplib3\*.gz
Remove-Item -Force -Path Data\miplib3\*.gz
}
git clone --depth 1 https://github.com/GerHobbelt/pthread-win32.git -b master ..\pthreads
- set RELEASE_TYPE=undefined
- set RELEASE_NAME=undefined
# be careful of trailing white spaces in env values!
- if "%APPVEYOR_REPO_TAG%"=="true" ( set RELEASE_TYPE=tag&& set RELEASE_NAME=Sonnet-%APPVEYOR_REPO_TAG_NAME%) else if "%APPVEYOR_FORCED_BUILD%"=="true" ( set RELEASE_TYPE=manual&& set RELEASE_NAME=Sonnet-%APPVEYOR_REPO_BRANCH%-manual) else ( set RELEASE_TYPE=ci&& set RELEASE_NAME=Sonnet-%APPVEYOR_REPO_BRANCH%-CI)
- set RELEASE_NAME=%RELEASE_NAME:/=-%
- ps: |
appveyor AddMessage "Only x64 builds are included. For x86, please build manually."
if ($env:sonar_token -like '')
{
appveyor AddMessage "No SonarQube report for this build. For other SonarQube report, see https://sonarcloud.io/dashboard?id=$env:RELEASE_NAME"
} else {
appveyor AddMessage "For SonarQube report, see https://sonarcloud.io/dashboard?id=$env:RELEASE_NAME"
}
# enable patching of AssemblyInfo.* files
assembly_info:
patch: true
file: AssemblyInfo.*
assembly_version: "2.0.0.0"
assembly_file_version: "2.0.0.{build}"
# assembly_informational_version: "2.0.0.{build}"
#---------------------------------#
# build configuration #
#---------------------------------#
# We do this manually using msbuild, such that in one job we could do multiple Configurations
# build platform, i.e. x86, x64, Any CPU. This setting is optional.
# to add several platforms to build matrix:
#platform:
# - x86
# - x64
# build Configuration, i.e. Debug, Release, etc.
#configuration:
# - Release
#build:
# parallel: true # enable MSBuild parallel builds
# project: c:\projects\sonnet\MSVisualStudio\v16\Sonnet.sln # path to Visual Studio solution or project
before_build:
- echo -- Before_build
- cd c:\projects\sonnet
- echo RELEASE_NAME "%RELEASE_NAME%"
- echo RELEASE_TYPE "%RELEASE_TYPE%"
- echo Creating %RELEASE_NAME%-src.zip artefact from projects folder
- echo Built on %date% %time% > BUILD-INFO.txt
- echo Version 2.0.0.%APPVEYOR_BUILD_NUMBER% >> BUILD-INFO.txt
- echo Repo %APPVEYOR_REPO_NAME% >> BUILD-INFO.txt
- echo Ref name %APPVEYOR_REPO_BRANCH% >> BUILD-INFO.txt
- echo Commit %APPVEYOR_REPO_COMMIT% >> BUILD-INFO.txt
- call build-third-party-license.bat
- 7z a -tzip -r -x!.git "c:\projects\sonnet\%RELEASE_NAME%-src.zip" c:\projects\*
- nuget restore MSVisualStudio\v17\Sonnet.sln
- if not "%sonar_token%"=="" ( SonarScanner.MSBuild.exe begin /k:"%RELEASE_NAME%" /d:"sonar.host.url=https://sonarcloud.io" /d:"sonar.login=%sonar_token%" /o:"jhmgoossens" /d:sonar.c.file.suffixes=- /d:sonar.cpp.file.suffixes=- /d:sonar.objc.file.suffixes=- )
build_script:
- echo -- Build_script
- cd c:\projects\sonnet
- echo Build pthread-win32 as static library
- msbuild c:\pthreads\windows\VS2022\pthread_lib.2022.vcxproj /p:Configuration=Release;Platform=x64 /m
- if not exist c:\projects\sonnet\lib\x64 mkdir c:\projects\sonnet\lib\x64
- copy c:\pthreads\windows\VS2022\bin\Release-Unicode-64bit-x64\pthread_static_lib.lib c:\projects\sonnet\lib\x64\.
- echo.
- echo Build Sonnet
- msbuild MSVisualStudio\v17\Sonnet.sln /p:Configuration=ReleaseParallel;Platform=x64 /m
after_build:
- echo -- After_build
#test:
# use automatic test discovery
# Doesnt work when building both x86 and x64 without using separate build platforms
# instead, test via test script
test_script:
# Some of the sonnet tests assume input files in the current folder, so CD to the test folder.
- echo -- Testing for NET4
- cd c:\projects\sonnet\MSVisualStudio\v17\SonnetTestNET4\bin\x64\Release\
- .\SonnetTest.exe
- echo -- Testing for NET6.0
- cd c:\projects\sonnet\MSVisualStudio\v17\SonnetTest\bin\x64\Release\net6.0\
- .\SonnetTest.exe
after_test:
- echo -- after_test
- cd c:\projects\sonnet
- mkdir package\x64\net6.0
- copy MSVisualStudio\v17\Sonnet\bin\x64\Release\net6.0\Sonnet.dll package\x64\net6.0\.
- copy MSVisualStudio\v17\Sonnet\bin\x64\Release\net6.0\Sonnet.xml package\x64\net6.0\.
- copy MSVisualStudio\v17\Sonnet\bin\x64\Release\net6.0\SonnetWrapper.dll package\x64\net6.0\.
- copy MSVisualStudio\v17\Sonnet\bin\x64\Release\net6.0\SonnetWrapper.xml package\x64\net6.0\.
- copy MSVisualStudio\v17\Sonnet\bin\x64\Release\net6.0\Ijwhost.dll package\x64\net6.0\.
- mkdir package\x64\net48
- copy MSVisualStudio\v17\SonnetNET4\bin\x64\Release\Sonnet.dll package\x64\net48\.
- copy MSVisualStudio\v17\SonnetNET4\bin\x64\Release\Sonnet.xml package\x64\net48\.
- copy MSVisualStudio\v17\SonnetNET4\bin\x64\Release\SonnetWrapper.dll package\x64\net48\.
- copy MSVisualStudio\v17\SonnetNET4\bin\x64\Release\SonnetWrapper.xml package\x64\net48\.
- copy AUTHORS.txt package\.
- copy CHANGELOG.txt package\.
- copy LICENSE.txt package\.
- copy NOTICE.txt package\.
- copy README.md package\.
- copy THIRD-PARTY-LICENSE.txt package\.
- copy examples\Example5.cs package\.
- cd package
- 7z a -tzip -r "c:\projects\sonnet\%RELEASE_NAME%-bin.zip" *
- cd ..
- if not "%sonar_token%"=="" ( SonarScanner.MSBuild.exe end /d:"sonar.login=%sonar_token%" )
artifacts:
- path: $(RELEASE_NAME)-bin.zip
name: Sonnet
- path: $(RELEASE_NAME)-src.zip
name: Sonnet Sources
#deploy:
# - provider: GitHub
# tag: $(RELEASE_NAME)
# release: $(RELEASE_NAME)
# artifact: Sonnet
# draft: false
# prerelease: true
# auth_token somethign
#on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))