Skip to content

record struct Size #477

record struct Size

record struct Size #477

Workflow file for this run

name: Windows Server 2022
on:
pull_request:
types: [synchronize, opened]
push:
branches:
- main
env:
OPENCV_VERSION: 4.8.0
jobs:
build:
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
# - name: Cache restored NuGet packages
# uses: actions/cache@v2
# with:
# path: ${{ github.workspace }}/.nuget/packages
# key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
# restore-keys: |
# ${{ runner.os }}-nuget-
- name: NuGet restore
shell: cmd
run: |
nuget restore
- name: Install Server-Media-Foundation
shell: powershell
run: |
Install-WindowsFeature Server-Media-Foundation
- name: Cache OpenCV binaries
id: cache_opencv
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/opencv_files
key: opencv-${{ env.OPENCV_VERSION }}-rev2
- name: Download OpenCV binaries
if: steps.cache_opencv.outputs.cache-hit != 'true'
shell: powershell
run: |
. ".\download_opencv_windows.ps1"
- name: Cache Tesseract binaries
id: cache_tesseract
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/tesseract_files
key: tesseract-41-rev1
- name: Download Tesseract binaries
if: steps.cache_tesseract.outputs.cache-hit != 'true'
shell: powershell
run: |
. ".\download_tesseract_windows.ps1"
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- name: Build x64
shell: cmd
run: msbuild OpenCvSharp.sln /t:build /p:configuration=Release /p:platform=x64 -maxcpucount
- name: Build x86
shell: cmd
run: msbuild OpenCvSharp.sln /t:build /p:configuration=Release /p:platform=x86 -maxcpucount
- name: Build ARM
shell: cmd
run: msbuild OpenCvSharp.sln /t:build /p:configuration=Release /p:platform=ARM -maxcpucount
- name: Install .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
- name: Build net6.0
shell: cmd
run: |
dotnet build src/OpenCvSharp.Extensions/OpenCvSharp.Extensions.csproj -f net6.0 -p:configuration=Release -maxcpucount
dotnet build src/OpenCvSharp.WpfExtensions/OpenCvSharp.WpfExtensions.csproj -f net6.0-windows -p:configuration=Release -maxcpucount
- name: Pack NuGet packages
shell: powershell
run: |
$ErrorActionPreference = "Stop"
$date = Get-Date -Format "yyyyMMdd"
$version = "${env:OPENCV_VERSION}.${date}-beta"
Write-Host "version = ${version}"
(Get-ChildItem $env:GITHUB_WORKSPACE -Recurse).Where{ $_.Extension -eq ".nuspec" }.ForEach{
[xml]$xml = Get-Content $_.FullName
$xml.package.metadata.version = $version
$xml.Save($_.FullName)
}
$windowsNuspec = "${env:GITHUB_WORKSPACE}\nuget\OpenCvSharp4.Windows.nuspec"
$extensionsNuspec = "${env:GITHUB_WORKSPACE}\nuget\OpenCvSharp4.Extensions.nuspec"
$wpfExtensionsNuspec = "${env:GITHUB_WORKSPACE}\nuget\OpenCvSharp4.WpfExtensions.nuspec"
$nuspecFiles = @($windowsNuspec, $extensionsNuspec, $wpfExtensionsNuspec)
foreach ( $nuspecFile in $nuspecFiles ) {
[xml]$xml = Get-Content $nuspecFile
foreach ($group in $xml.package.metadata.dependencies.ChildNodes){
foreach ($dependency in $group.ChildNodes){
$packageId = $dependency.GetAttribute("id")
if ($packageId.StartsWith("OpenCvSharp")){
Write-Host "before: " $packageId "=" $dependency.GetAttribute("version")
$dependency.SetAttribute("version", $version)
Write-Host "after: " $packageId "=" $dependency.GetAttribute("version")
$xml.Save($nuspecFile)
}
else {
Write-Host "Skipped: " $packageId
}
}
}
}
nuget pack nuget/OpenCvSharp4.nuspec -OutputDirectory artifacts -Symbols -SymbolPackageFormat snupkg
nuget pack nuget/OpenCvSharp4.Windows.nuspec -OutputDirectory artifacts
nuget pack nuget/OpenCvSharp4.Extensions.nuspec -OutputDirectory artifacts -Symbols -SymbolPackageFormat snupkg
nuget pack nuget/OpenCvSharp4.WpfExtensions.nuspec -OutputDirectory artifacts -Symbols -SymbolPackageFormat snupkg
nuget pack nuget/OpenCvSharp4.runtime.win.nuspec -OutputDirectory artifacts
nuget pack nuget/OpenCvSharp4.runtime.uwp.nuspec -OutputDirectory artifacts
- name: Test
shell: powershell
run: |
cd ${env:GITHUB_WORKSPACE}\test\OpenCvSharp.Tests
dotnet test -c Release -f net48 --runtime win-x64
- name: Test Windows-only functions
shell: powershell
run: |
cd ${env:GITHUB_WORKSPACE}\test\OpenCvSharp.Tests.Windows
dotnet test -c Release -f net48 --runtime win-x64
- name: Run ReleaseMaker
shell: powershell
run: |
cd "${env:GITHUB_WORKSPACE}\tool\OpenCvSharp.ReleaseMaker"
dotnet run -c Release --runtime win-x64 -- "${env:GITHUB_WORKSPACE}" "${env:GITHUB_WORKSPACE}\artifacts" ${{env.OPENCV_VERSION}}
- name: Upload NuGet packages and Release packages
uses: actions/upload-artifact@v3
with:
name: packages_windows
path: ${{ github.workspace }}\artifacts