Skip to content

deps: Bump Microsoft.NET.Test.Sdk from 17.12.0 to 18.0.1 #30

deps: Bump Microsoft.NET.Test.Sdk from 17.12.0 to 18.0.1

deps: Bump Microsoft.NET.Test.Sdk from 17.12.0 to 18.0.1 #30

Workflow file for this run

name: Build and Test
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master ]
permissions:
contents: read
packages: write
env:
DOTNET_VERSION: '9.0.x'
OPENSSL_VERSION: '3.2.0'
jobs:
build-windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Setup Visual Studio Build Tools
uses: microsoft/setup-msbuild@v1.3
- name: Setup OpenSSL from Repository
run: |
# Use OpenSSL files already included in the repository
Write-Host "Using OpenSSL files from repository..."
if (Test-Path "OpenSSL-Win64") {
Write-Host "OpenSSL-Win64 directory found in repository"
# Set OpenSSL environment variables
$env:OPENSSL_ROOT_DIR = "$PWD\OpenSSL-Win64"
$env:PATH = "$PWD\OpenSSL-Win64;$env:PATH"
Write-Host "OpenSSL_ROOT_DIR set to: $env:OPENSSL_ROOT_DIR"
Write-Host "OpenSSL DLLs available at: $PWD\OpenSSL-Win64"
Write-Host "PATH includes OpenSSL: $env:PATH"
} else {
Write-Error "OpenSSL-Win64 directory not found in repository"
exit 1
}
- name: Build Native Library
run: |
# Use the GitHub Actions specific build script
Write-Host "Building native library for GitHub Actions..."
# Run the GitHub Actions build script
.\Build\build_native_github_actions.bat
if ($LASTEXITCODE -ne 0) {
Write-Error "Native library build failed"
exit 1
}
- name: Build .NET Projects
run: |
dotnet restore
dotnet build --configuration Release --no-restore
- name: Copy Native DLL and OpenSSL DLLs to Test Directories
run: |
# Copy the native DLL and OpenSSL DLLs to the test output directories
Write-Host "Copying native DLL and OpenSSL DLLs to test directories..."
$testDirs = @(
"AesGcmSiv.Tests\bin\Release\net9.0",
"AesGcmSiv.Tests\bin\Debug\net9.0"
)
foreach ($dir in $testDirs) {
if (Test-Path $dir) {
# Copy native DLL
Copy-Item "bin\native\win-x64\aesgcmsiv.dll" $dir -Force
Write-Host "Copied aesgcmsiv.dll to: $dir"
# Copy OpenSSL DLLs for runtime
Copy-Item "OpenSSL-Win64\libcrypto-3-x64.dll" $dir -Force
Copy-Item "OpenSSL-Win64\libssl-3-x64.dll" $dir -Force
Write-Host "Copied OpenSSL DLLs to: $dir"
} else {
Write-Host "Test directory not found: $dir"
}
}
- name: Run Tests
run: |
dotnet test --configuration Release --no-build --verbosity normal
- name: Run Static Analysis
run: |
# Security scanning
dotnet list package --vulnerable
# Code quality
dotnet format --verify-no-changes
- name: Build NuGet Package
run: |
Write-Host "Building NuGet packages..."
dotnet pack --configuration Release --no-build --output ./nupkgs --include-symbols
Write-Host "Checking for created packages..."
if (Test-Path "nupkgs") {
Write-Host "nupkgs directory exists"
Get-ChildItem "nupkgs" -Force | ForEach-Object {
Write-Host "Found file: $($_.Name) ($($_.Length) bytes)"
}
} else {
Write-Host "nupkgs directory does not exist"
}
- name: Debug Before Upload
run: |
Write-Host "Checking what will be uploaded..."
Write-Host "Current working directory: $PWD"
Write-Host "Checking bin directory:"
if (Test-Path "bin") {
Write-Host "bin directory exists"
Get-ChildItem "bin" -Recurse -Force | ForEach-Object {
Write-Host " Found file: $($_.FullName) ($($_.Length) bytes)"
}
} else {
Write-Host "bin directory does not exist"
}
Write-Host "Checking nupkgs directory:"
if (Test-Path "nupkgs") {
Write-Host "nupkgs directory exists"
Get-ChildItem "nupkgs" -Force | ForEach-Object {
Write-Host " Found file: $($_.Name) ($($_.Length) bytes)"
}
} else {
Write-Host "nupkgs directory does not exist"
}
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
bin/
nupkgs/
security-scan:
runs-on: windows-latest
needs: build-windows
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run Security Scan
run: |
# Add security scanning tools here
# Example: dotnet tool install --global dotnet-security-scan
echo "Security scanning completed"
publish:
runs-on: windows-latest
needs: [build-windows, security-scan]
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
steps:
- name: Download Build Artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
- name: Debug Downloaded Artifacts
run: |
Write-Host "Current working directory: $PWD"
Write-Host "Listing all files in current directory:"
Get-ChildItem -Force | ForEach-Object {
Write-Host " $($_.Mode) $($_.Length) $($_.Name)"
}
Write-Host "Checking for nupkgs directory:"
if (Test-Path "nupkgs") {
Write-Host "nupkgs directory exists"
Get-ChildItem "nupkgs" -Force | ForEach-Object {
Write-Host " Found file: $($_.Name) ($($_.Length) bytes)"
}
} else {
Write-Host "nupkgs directory does not exist"
}
Write-Host "Checking for bin directory:"
if (Test-Path "bin") {
Write-Host "bin directory exists"
Get-ChildItem "bin" -Recurse -Force | ForEach-Object {
Write-Host " Found file: $($_.FullName) ($($_.Length) bytes)"
}
} else {
Write-Host "bin directory does not exist"
}
- name: Publish to NuGet
run: |
# Get all .nupkg files in the nupkgs directory
$nupkgFiles = Get-ChildItem "nupkgs" -Filter "*.nupkg"
Write-Host "Found $($nupkgFiles.Count) .nupkg files to publish:"
$nupkgFiles | ForEach-Object { Write-Host " $($_.Name)" }
# Push each .nupkg file
foreach ($file in $nupkgFiles) {
Write-Host "Publishing $($file.Name)..."
dotnet nuget push $file.FullName --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
}