Skip to content

Implemented error handling in GlobalClassFactory and related COM obje… #338

Implemented error handling in GlobalClassFactory and related COM obje…

Implemented error handling in GlobalClassFactory and related COM obje… #338

Workflow file for this run

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-net/MapWinGisTests-net.sln
# Configuration type to build.
BUILD_CONFIGURATION: Debug
jobs:
build:
name: Build MapWinGIS
runs-on: windows-2022
strategy:
matrix:
platform: ['Win32', 'x64']
# platform: ['Win32']
steps:
- uses: actions/checkout@v5
with:
submodules: true
- name: Locate MSBuild and VSTest
shell: pwsh
run: |
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$msbuild = & $vswhere -latest -products * -requires Microsoft.Component.MSBuild -find "MSBuild\**\Bin\MSBuild.exe" | Select-Object -First 1
if (-not $msbuild) {
throw "MSBuild.exe was not found via vswhere"
}
"MSBUILD_EXE=$msbuild" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Set VcpkgTriplet-x86
if: ${{matrix.platform == 'Win32' }}
shell: pwsh
run: |
chcp 65001 #set code page to utf-8
$vcpkgInstalledDir = "${{ github.workspace }}/src/vcpkg_installed/x86-windows/"
echo ("VcpkgTriplet=x86-windows") >> $env:GITHUB_ENV
echo ("VCPKG_INSTALLED_DIR=$vcpkgInstalledDir") >> $env:GITHUB_ENV
New-Item -ItemType Directory -Path $vcpkgInstalledDir -Force | Out-Null
- name: Set VcpkgTriplet-x64
if: ${{matrix.platform == 'x64' }}
shell: pwsh
run: |
chcp 65001 #set code page to utf-8
$vcpkgInstalledDir = "${{ github.workspace }}/src/vcpkg_installed/x64-windows/"
echo ("VcpkgTriplet=x64-windows") >> $env:GITHUB_ENV
echo ("VCPKG_INSTALLED_DIR=$vcpkgInstalledDir") >> $env:GITHUB_ENV
New-Item -ItemType Directory -Path $vcpkgInstalledDir -Force | Out-Null
# Install VCPKG without Node-based action wrappers.
- name: Install vcpkg dependencies
shell: pwsh
working-directory: ./src/vcpkg/
run: |
.\bootstrap-vcpkg.bat
.\vcpkg.exe install --recurse --clean-after-build --x-install-root "$env:VCPKG_INSTALLED_DIR" --triplet "$env:VcpkgTriplet"
- name: List downloaded VCPCK files
shell: pwsh
run: |
Write-Host "Test:"
Write-Host "VCPKG_INSTALLED_DIR: " $env:VCPKG_INSTALLED_DIR
Write-Host "VcpkgTriplet: " $env:VcpkgTriplet
Get-ChildItem -Path "$env:VCPKG_INSTALLED_DIR" -Recurse
# Download GisInternals zips
- name: Download GisInternals zips
shell: pwsh
run: |
Invoke-WebRequest -Uri "https://github.com/MapWindow/Dependencies/raw/main/GisInternals/release-1930-gdal-3-10-3-mapserver-8-2-2.zip" -MaximumRetryCount 3 -Resume -RetryIntervalSec 30 -OutFile ".\Support\release-1930-gdal-3-10-3-mapserver-8-2-2.zip"
Invoke-WebRequest -Uri "https://github.com/MapWindow/Dependencies/raw/main/GisInternals/release-1930-gdal-3-10-3-mapserver-8-2-2-libs.zip" -MaximumRetryCount 3 -Resume -RetryIntervalSec 30 -OutFile ".\Support\release-1930-gdal-3-10-3-mapserver-8-2-2-libs.zip"
Invoke-WebRequest -Uri "https://github.com/MapWindow/Dependencies/raw/main/GisInternals/release-1930-x64-gdal-3-10-3-mapserver-8-2-2.zip" -MaximumRetryCount 3 -Resume -RetryIntervalSec 30 -OutFile ".\Support\release-1930-x64-gdal-3-10-3-mapserver-8-2-2.zip"
Invoke-WebRequest -Uri "https://github.com/MapWindow/Dependencies/raw/main/GisInternals/release-1930-x64-gdal-3-10-3-mapserver-8-2-2-libs.zip" -MaximumRetryCount 3 -Resume -RetryIntervalSec 30 -OutFile ".\Support\release-1930-x64-gdal-3-10-3-mapserver-8-2-2-libs.zip"
Get-ChildItem .\Support\
# Unzip zips by calling powershell script
- name: Unzip
working-directory: ./Support/
shell: pwsh
run: .\unpackGdal3-Toolset143-GISInternals.ps1
# Build support libs
- name: Build SupportLibs ${{matrix.platform}}
working-directory: ${{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"
shell: pwsh
run: |
& $env:MSBUILD_EXE /m /p:Configuration=Release /p:Platform=${{matrix.platform}} $env:SUPPORTLIBS_SOLUTION_FILE_PATH
# Build MapWinGIS
- name: Build MapWinGIS ${{matrix.platform}}
working-directory: ${{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"
shell: pwsh
run: |
& $env:MSBUILD_EXE /m /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=${{matrix.platform}} /p:EnableComRegistration=false /p:RegisterOutput=false /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@v6
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@v5
- name: Locate MSBuild and VSTest
shell: pwsh
run: |
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$msbuild = & $vswhere -latest -products * -requires Microsoft.Component.MSBuild -find "MSBuild\**\Bin\MSBuild.exe" | Select-Object -First 1
if (-not $msbuild) {
throw "MSBuild.exe was not found via vswhere"
}
$vstest = & $vswhere -latest -products * -find "Common7\IDE\Extensions\TestPlatform\vstest.console.exe" | Select-Object -First 1
if (-not $vstest) {
throw "vstest.console.exe was not found via vswhere"
}
"MSBUILD_EXE=$msbuild" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
"VSTEST_EXE=$vstest" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Setup dotnet 10 (x64)
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.x'
architecture: x64
- name: Download MapWinGIS (${{matrix.platform}}) binaries
uses: actions/download-artifact@v6
with:
name: binaries-${{matrix.platform}}
path: .\src\bin\${{env.BUILD_CONFIGURATION}}\${{matrix.platform}}\
- name: Register MapWinGIS.ocx (Win32)
if: ${{matrix.platform == 'Win32' }}
shell: pwsh
run: |
$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.";
}
$ocxPath = "${{ github.workspace }}\src\bin\${{env.BUILD_CONFIGURATION}}\Win32\MapWinGIS.ocx"
if (!(Test-Path $ocxPath)) {
Write-Error "MapWinGIS.ocx was not found at $ocxPath"
}
$regsvrp = Start-Process C:\Windows\SysWOW64\regsvr32.exe -ArgumentList "/s $ocxPath" -PassThru
$regsvrp.WaitForExit(15000) # Wait (up to) 15 seconds
if($regsvrp.ExitCode -ne 0)
{
Write-Host "RegSrv32 for Win32 failed"
Write-Error $ExitCodes[$regsvrp.ExitCode]
}
- name: Register MapWinGIS.ocx (x64)
if: ${{matrix.platform == 'x64' }}
shell: pwsh
run: |
$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.";
}
$ocxPath = "${{ github.workspace }}\src\bin\${{env.BUILD_CONFIGURATION}}\x64\MapWinGIS.ocx"
if (!(Test-Path $ocxPath)) {
Write-Error "MapWinGIS.ocx was not found at $ocxPath"
}
$regsvrp = Start-Process C:\Windows\System32\regsvr32.exe -ArgumentList "/s $ocxPath" -PassThru
$regsvrp.WaitForExit(15000) # Wait (up to) 15 seconds
if($regsvrp.ExitCode -ne 0)
{
Write-Host "RegSrv32 for x64 failed"
Write-Error $ExitCodes[$regsvrp.ExitCode]
}
# Build test solution (requires full MSBuild because COMReference is used)
- name: Build test solution x64
if: ${{matrix.platform == 'x64' }}
working-directory: ${{github.workspace}}
shell: pwsh
run: |
& $env:MSBUILD_EXE /m:2 /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=${{matrix.platform}} /p:NoWarn=NETSDK1223 -restore /v:m $env:UNITTESTS_SOLUTION_FILE_PATH
- name: Build test solution Win32
if: ${{matrix.platform == 'Win32' }}
working-directory: ${{github.workspace}}
shell: pwsh
run: |
& $env:MSBUILD_EXE /m:2 /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=${{matrix.platform}} /p:NoWarn=NETSDK1223 -restore /v:m $env:UNITTESTS_SOLUTION_FILE_PATH
# Run unit tests
- name: Setup dotnet 10 (x86)
if: ${{matrix.platform == 'Win32' }}
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.x'
architecture: x86
- name: Unit Testing x86
if: ${{matrix.platform == 'Win32' }}
env:
DOTNET_ROOT: C:\Program Files\dotnet\x86
DOTNET_MULTILEVEL_LOOKUP: 0
"DOTNET_ROOT(x86)": C:\Program Files\dotnet\x86
PATH: ${{ github.workspace }}\src\bin\${{env.BUILD_CONFIGURATION}}\Win32;${{ env.PATH }}
PROJ_LIB: ${{ github.workspace }}\src\bin\${{env.BUILD_CONFIGURATION}}\Win32\proj9\share\proj
shell: pwsh
run: |
$projLib = "${{ github.workspace }}\src\bin\$env:BUILD_CONFIGURATION\Win32\proj9\share"
$testDll = ".\MapWinGisTests-net\MapWinGisTests\bin\x86\$env:BUILD_CONFIGURATION\net10.0-windows8.0\MapWinGisTests.dll"
& $env:VSTEST_EXE '/Blame:CollectHangDump;TestTimeout=120000;DumpType=Full' /Diag:logs\log.txt /Platform:x86 "-e:PROJ_LIB=$projLib" $testDll
- name: Unit Testing x64
if: ${{matrix.platform == 'x64' }}
env:
PATH: ${{ github.workspace }}\src\bin\${{env.BUILD_CONFIGURATION}}\x64;${{ env.PATH }}
PROJ_LIB: ${{ github.workspace }}\src\bin\${{env.BUILD_CONFIGURATION}}\x64\proj9\share\proj
shell: pwsh
run: |
$projLib = "${{ github.workspace }}\src\bin\$env:BUILD_CONFIGURATION\x64\proj9\share"
$testDll = ".\MapWinGisTests-net\MapWinGisTests\bin\x64\$env:BUILD_CONFIGURATION\net10.0-windows8.0\MapWinGisTests.dll"
& $env:VSTEST_EXE '/Blame:CollectHangDump;TestTimeout=120000;DumpType=Full' /Diag:logs\log.txt /Platform:x64 "-e:PROJ_LIB=$projLib" $testDll
- name: Upload test logs and hang dump
if: always()
uses: actions/upload-artifact@v6
with:
name: test-logs-${{matrix.platform}}
path: |
logs\**\*
**\*.dmp
**\Sequence_*.xml
if-no-files-found: ignore
# TODO: Create installer using innosetup
# TODO: Publish installer to GitHub Releases