-
Notifications
You must be signed in to change notification settings - Fork 143
228 lines (202 loc) · 10.9 KB
/
msbuild.yml
File metadata and controls
228 lines (202 loc) · 10.9 KB
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
218
219
220
221
222
223
224
225
226
227
228
name: Build MapWinGIS -Develop branch
on:
push:
branches:
- develop
paths-ignore:
- '**.md'
#- '**.yml'
- 'docs/**'
pull_request:
paths-ignore:
- '**.md'
- '**.yml'
- 'docs/**'
env:
# Path to the solution files relative to the root of the project.
SUPPORTLIBS_SOLUTION_FILE_PATH: ./Support/SupportLibs.sln
MAPWINGIS_SOLUTION_FILE_PATH: ./src/MapWinGIS.sln
UNITTESTS_SOLUTION_FILE_PATH: ./MapWinGisTests-net6/MapWinGisTests-net6.sln
# Configuration type to build.
BUILD_CONFIGURATION: Debug
jobs:
build:
name: Build MapWinGIS
runs-on: windows-2019
strategy:
matrix:
platform: ['Win32', 'x64']
# platform: ['Win32']
steps:
- uses: actions/checkout@v3
with:
submodules: true
# Setup MSBuild
- name: setup-msbuild
uses: microsoft/setup-msbuild@v1.1
if: ${{matrix.platform == 'x64' }}
with:
msbuild-architecture: x64
- name: setup-msbuild
uses: microsoft/setup-msbuild@v1.1
if: ${{matrix.platform == 'Win32' }}
with:
msbuild-architecture: x86
- name: Set VcpkgTriplet-x86
if: ${{matrix.platform == 'Win32' }}
run: |
chcp 65001 #set code page to utf-8
echo ("VcpkgTriplet=x86-windows") >> $env:GITHUB_ENV
echo ("VCPKG_INSTALLED_DIR=${{ github.workspace }}/src/vcpkg_installed/x86-windows/") >> $env:GITHUB_ENV
mkdir $[env.VCPKG_INSTALLED_DIR]
- name: Set VcpkgTriplet-x64
if: ${{matrix.platform == 'x64' }}
run: |
chcp 65001 #set code page to utf-8
echo ("VcpkgTriplet=x64-windows") >> $env:GITHUB_ENV
echo ("VCPKG_INSTALLED_DIR=${{ github.workspace }}/src/vcpkg_installed/x64-windows/") >> $env:GITHUB_ENV
mkdir $[env.VCPKG_INSTALLED_DIR]
# Install VCPCK
- name: run-vcpkg
# You may pin to the exact commit or the version.
# uses: lukka/run-vcpkg@c5ce6a7de6e5ce834a25f7d55b6c250a275a6732
uses: lukka/run-vcpkg@v10
with:
runVcpkgInstall: true
vcpkgDirectory: ${{ github.workspace }}\src\vcpkg\
runVcpkgFormatString: "[`install`, `--recurse`, `--clean-after-build`, `--x-install-root`, `$[env.VCPKG_INSTALLED_DIR]`, `--triplet`, `${{env.VcpkgTriplet}}`]"
- name: List downloaded VCPCK files
uses: Azure/powershell@v1
with:
# Specify the Az PowerShell script here.
inlineScript: |
Write-Host "Test:"
Write-Host "VCPKG_INSTALLED_DIR: " ${{env.VCPKG_INSTALLED_DIR}}
Write-Host "VcpkgTriplet: " ${{env.VcpkgTriplet}}
ls -R ${{env.VCPKG_INSTALLED_DIR}}
# Azure PS version to be used to execute the script, example: 1.8.0, 2.8.0, 3.4.0. To use the latest version, specify "latest".
azPSVersion: "latest"
# Select the value of the ErrorActionPreference variable for executing the script. Options: stop, continue, silentlyContinue. Default is Stop.
errorActionPreference: Stop
# If this is true, this task will fail if any errors are written to the error pipeline, or if any data is written to the Standard Error stream.
failOnStandardError: true
# Download GisInternals zips
- name: Download GisInternals zips
uses: Azure/powershell@v1
with:
# Specify the Az PowerShell script here.
inlineScript: |
Invoke-WebRequest -Uri "https://github.com/MapWindow/Dependencies/raw/main/GisInternals/release-1928-gdal-3-5-mapserver-8-0.zip" -MaximumRetryCount 3 -Resume -RetryIntervalSec 30 -OutFile ".\Support\release-1928-gdal-3-5-mapserver-8-0.zip"
Invoke-WebRequest -Uri "https://github.com/MapWindow/Dependencies/raw/main/GisInternals/release-1928-gdal-3-5-mapserver-8-0-libs.zip" -MaximumRetryCount 3 -Resume -RetryIntervalSec 30 -OutFile ".\Support\release-1928-gdal-3-5-mapserver-8-0-libs.zip"
Invoke-WebRequest -Uri "https://github.com/MapWindow/Dependencies/raw/main/GisInternals/release-1928-x64-gdal-3-5-mapserver-8-0.zip" -MaximumRetryCount 3 -Resume -RetryIntervalSec 30 -OutFile ".\Support\release-1928-x64-gdal-3-5-mapserver-8-0.zip"
Invoke-WebRequest -Uri "https://github.com/MapWindow/Dependencies/raw/main/GisInternals/release-1928-x64-gdal-3-5-mapserver-8-0-libs.zip" -MaximumRetryCount 3 -Resume -RetryIntervalSec 30 -OutFile ".\Support\release-1928-x64-gdal-3-5-mapserver-8-0-libs.zip"
ls .\Support\
# Azure PS version to be used to execute the script, example: 1.8.0, 2.8.0, 3.4.0. To use the latest version, specify "latest".
azPSVersion: "latest"
# Select the value of the ErrorActionPreference variable for executing the script. Options: stop, continue, silentlyContinue. Default is Stop.
errorActionPreference: Stop
# If this is true, this task will fail if any errors are written to the error pipeline, or if any data is written to the Standard Error stream.
failOnStandardError: true
# Unzip zips by calling powershell script
- name: Unzip
working-directory: ./Support/
shell: pwsh
run: .\unpackGdal3-Toolset142-GISInternals.ps1
# Build support libs
- name: Build SupportLibs ${{matrix.platform}}
working-directory: ${{env.GITHUB_WORKSPACE}}
# Add additional options to the MSBuild command line here (like platform or verbosity level).
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
# MSBuild SupportLibs.sln /t:Rebuild /p:Configuration=Release /p:Platform="Win32"
run: msbuild /m /p:Configuration=Release /p:Platform=${{matrix.platform}} ${{env.SUPPORTLIBS_SOLUTION_FILE_PATH}}
# Build MapWinGIS
- name: Build MapWinGIS ${{matrix.platform}}
working-directory: ${{env.GITHUB_WORKSPACE}}
# Add additional options to the MSBuild command line here (like platform or verbosity level).
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
# MSBuild SupportLibs.sln /t:Rebuild /p:Configuration=Release /p:Platform="Win32"
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=${{matrix.platform}} /p:VcpkgEnabled=true /p:VcpkgEnableManifest=true /p:VcpkgTriplet=${{env.VcpkgTriplet}} /p:VcpkgHostTriplet=${{env.VcpkgTriplet}} ${{env.MAPWINGIS_SOLUTION_FILE_PATH}}
# Save artifacts:
- name: Archive production artifacts
uses: actions/upload-artifact@v3.1.1
with:
name: binaries-${{matrix.platform}}
path: .\src\bin\${{env.BUILD_CONFIGURATION}}\${{matrix.platform}}\**\*
unit-tests:
name: Unit Testing
needs: build
runs-on: windows-2022
strategy:
max-parallel: 1
matrix:
platform: ['x64', 'Win32']
# platform: ['Win32']
steps:
- uses: actions/checkout@v3
- name: Setup dotnet 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.x'
- name: Setup dotnet 7
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.x'
- name: Download MapWinGIS (${{matrix.platform}}) binaries
uses: actions/download-artifact@v2
with:
name: binaries-${{matrix.platform}}
path: .\src\bin\${{env.BUILD_CONFIGURATION}}\${{matrix.platform}}\
- name: Register MapWinGIS.ocx (${{matrix.platform}})
uses: Azure/powershell@v1
with:
# Specify the Az PowerShell script here.
inlineScript: |
$ExitCodes = @{
0 = "SUCCESS";
1 = "FAIL_ARGS - Invalid Argument";
2 = "FAIL_OLE - OleInitialize Failed";
3 = "FAIL_LOAD - LoadLibrary Failed";
4 = "FAIL_ENTRY - GetProcAddress failed";
5 = "FAIL_REG - DllRegisterServer or DllUnregisterServer failed.";
}
$regsvrp = Start-Process C:\Windows\SysWOW64\regsvr32.exe -ArgumentList "/s ${{ github.workspace }}\src\bin\${{env.BUILD_CONFIGURATION}}\${{matrix.platform}}\MapWinGIS.ocx" -PassThru
$regsvrp.WaitForExit(5000) # Wait (up to) 5 seconds
if($regsvrp.ExitCode -ne 0)
{
Write-Host "RegSrv32 for ${{matrix.platform}} failed"
Write-Error $ExitCodes[$regsvrp.ExitCode]
}
# Azure PS version to be used to execute the script, example: 1.8.0, 2.8.0, 3.4.0. To use the latest version, specify "latest".
azPSVersion: "latest"
# Select the value of the ErrorActionPreference variable for executing the script. Options: stop, continue, silentlyContinue. Default is Stop.
errorActionPreference: Stop
# If this is true, this task will fail if any errors are written to the error pipeline, or if any data is written to the Standard Error stream.
failOnStandardError: true
# Build test solution
- name: setup-msbuild
uses: microsoft/setup-msbuild@v1.1
if: ${{matrix.platform == 'x64' }}
with:
msbuild-architecture: x64
- name: setup-msbuild
uses: microsoft/setup-msbuild@v1.1
if: ${{matrix.platform == 'Win32' }}
with:
msbuild-architecture: x86
- name: Build test solution ${{matrix.platform}}
working-directory: ${{env.GITHUB_WORKSPACE}}
# Add additional options to the MSBuild command line here (like platform or verbosity level).
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
# MSBuild SupportLibs.sln /t:Rebuild /p:Configuration=Release /p:Platform="Win32"
run: msbuild /m:2 /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=${{matrix.platform}} -restore /v:m ${{env.UNITTESTS_SOLUTION_FILE_PATH}}
# Run unit tests
- name: Setup VSTest.console.exe
uses: darenm/Setup-VSTest@v1
- name: Unit Testing x86
if: ${{matrix.platform == 'Win32' }}
run: vstest.console.exe /Blame /Diag:logs\log.txt /Platform:x86 -e:PROJ_LIB="${{ github.workspace }}\src\bin\${{env.BUILD_CONFIGURATION}}\Win32\proj7\share\" .\MapWinGisTests-net6\MapWinGisTests\bin\x86\${{env.BUILD_CONFIGURATION}}\net6.0-windows8.0\MapWinGisTests.dll
- name: Unit Testing x64
if: ${{matrix.platform == 'x64' }}
run: vstest.console.exe /Blame /Diag:logs\log.txt /Platform:x64 -e:PROJ_LIB="${{ github.workspace }}\src\bin\${{env.BUILD_CONFIGURATION}}\x64\proj7\share\" .\MapWinGisTests-net6\MapWinGisTests\bin\x64\${{env.BUILD_CONFIGURATION}}\net6.0-windows8.0\MapWinGisTests.dll
# TODO: Create installer using innosetup
# TODO: Publish installer to GitHub Releases