Skip to content

fix: resolve package cache path at runtime #24

fix: resolve package cache path at runtime

fix: resolve package cache path at runtime #24

Workflow file for this run

name: Build
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: windows-latest
env:
PACKAGE_VERSION: 3.0.1-ci.${{ github.run_number }}.${{ github.run_attempt }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore
run: dotnet restore OpenVisionLab.VisionSdk.sln
- name: Build
run: dotnet build OpenVisionLab.VisionSdk.sln -c Release --no-restore
- name: Smoke 2D and 3D combined inspection
run: dotnet run --project tests/OpenVisionLab.Inspection.Smoke/OpenVisionLab.Inspection.Smoke.csproj -c Release --no-build
- name: Pack
run: dotnet pack OpenVisionLab.VisionSdk.sln -c Release --no-build -o artifacts/packages "-p:PackageVersion=$env:PACKAGE_VERSION"
- name: Verify package documentation
shell: pwsh
run: |
Add-Type -AssemblyName System.IO.Compression.FileSystem
$packages = @(Get-ChildItem artifacts/packages/*.nupkg)
if ($packages.Count -ne 5) { throw "Expected 5 packages, found $($packages.Count)." }
foreach ($package in $packages) {
if ($package.Name -notlike "*.$env:PACKAGE_VERSION.nupkg") {
throw "$($package.Name) does not use the immutable CI version $env:PACKAGE_VERSION."
}
$archive = [System.IO.Compression.ZipFile]::OpenRead($package.FullName)
try {
$nuspec = $archive.Entries | Where-Object FullName -Like '*.nuspec' | Select-Object -First 1
$packageId = [System.IO.Path]::GetFileNameWithoutExtension($nuspec.FullName)
foreach ($required in @('README.md', "lib/netstandard2.0/$packageId.xml")) {
if (-not ($archive.Entries.FullName -contains $required)) {
throw "$($package.Name) is missing $required."
}
}
} finally {
$archive.Dispose()
}
}
- name: Restore package-only consumer
run: dotnet restore tests/OpenVisionLab.PackageConsumer.Smoke/OpenVisionLab.PackageConsumer.Smoke.csproj "-p:PackageVersion=$env:PACKAGE_VERSION" "-p:RestorePackagesPath=$env:RUNNER_TEMP\openvisionlab-package-consumer-$env:GITHUB_RUN_ID-$env:GITHUB_RUN_ATTEMPT" "-p:RestoreSources=$env:GITHUB_WORKSPACE\artifacts\packages"
- name: Run package-only 2D and 3D consumer
run: dotnet run --project tests/OpenVisionLab.PackageConsumer.Smoke/OpenVisionLab.PackageConsumer.Smoke.csproj -c Release --no-restore "-p:PackageVersion=$env:PACKAGE_VERSION" "-p:RestorePackagesPath=$env:RUNNER_TEMP\openvisionlab-package-consumer-$env:GITHUB_RUN_ID-$env:GITHUB_RUN_ATTEMPT"