Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 66 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,31 @@ on:
push:
branches: [ main, upd, release/2.2.0 ]
pull_request:
branches: [ main, upd, release/2.2.0, sp220/checkpoint-c ]
branches: [ main, upd, release/2.2.0, sp220/checkpoint-c, sp220/checkpoint-d ]

permissions:
contents: read

env:
NUGET_PACKAGES: ${{ github.event_name == 'pull_request' && format('{0}/.nuget/packages', github.workspace) || '' }}

jobs:
validation:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
uses: ./.github/workflows/reusable-release-validation.yml
permissions:
contents: read
with:
runner-labels: ${{ github.event_name == 'pull_request' && '["self-hosted","Windows","X64"]' || '["ubuntu-latest"]' }}

hosting-integration:
name: Hosting integration (${{ matrix.os }})
runs-on: ${{ matrix.os }}
name: Hosting integration (${{ matrix.os == 'self-hosted' && 'Windows' || matrix.os }})
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ${{ matrix.os == 'self-hosted' && fromJSON('["self-hosted","Windows","X64"]') || matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
matrix: ${{ fromJSON(github.event_name == 'pull_request' && '{"os":["self-hosted"]}' || '{"os":["ubuntu-latest","windows-latest"]}') }}

steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
Expand All @@ -45,7 +51,8 @@ jobs:
run: dotnet test --project tests/SmartPipe.Extensions.Hosting.Tests/SmartPipe.Extensions.Hosting.Tests.csproj --configuration Release --no-build --filter-class SmartPipe.Extensions.Hosting.Tests.Integration.GenericHostIntegrationTests --minimum-expected-tests 1

json-file-windows:
runs-on: windows-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ${{ github.event_name == 'pull_request' && fromJSON('["self-hosted","Windows","X64"]') || 'windows-latest' }}
timeout-minutes: 20

steps:
Expand All @@ -65,28 +72,43 @@ jobs:
run: dotnet build tests/SmartPipe.Extensions.Json.Tests/SmartPipe.Extensions.Json.Tests.csproj --configuration Release --no-restore -warnaserror

- name: JSON file source, path, open, and share tests
shell: pwsh
run: |
dotnet test --project tests/SmartPipe.Extensions.Json.Tests/SmartPipe.Extensions.Json.Tests.csproj --configuration Release --no-build --filter-class SmartPipe.Extensions.Tests.Sources.JsonFileSourceTests --minimum-expected-tests 1
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
dotnet test --project tests/SmartPipe.Extensions.Json.Tests/SmartPipe.Extensions.Json.Tests.csproj --configuration Release --no-build --filter-class SmartPipe.Extensions.Tests.Sources.JsonFileSourceRecoveryTests --minimum-expected-tests 1
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
dotnet test --project tests/SmartPipe.Extensions.Json.Tests/SmartPipe.Extensions.Json.Tests.csproj --configuration Release --no-build --filter-class SmartPipe.Extensions.Tests.Sources.JsonFileSourceMetadataTests --minimum-expected-tests 1
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

- name: JSON file sink and dispose tests
shell: pwsh
run: |
dotnet test --project tests/SmartPipe.Extensions.Json.Tests/SmartPipe.Extensions.Json.Tests.csproj --configuration Release --no-build --filter-class SmartPipe.Extensions.Tests.Sinks.JsonFileSinkTests --minimum-expected-tests 1
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
dotnet test --project tests/SmartPipe.Extensions.Json.Tests/SmartPipe.Extensions.Json.Tests.csproj --configuration Release --no-build --filter-class SmartPipe.Extensions.Tests.Sinks.JsonFileSinkAppendTests --minimum-expected-tests 1
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
dotnet test --project tests/SmartPipe.Extensions.Json.Tests/SmartPipe.Extensions.Json.Tests.csproj --configuration Release --no-build --filter-class SmartPipe.Extensions.Json.Tests.Sinks.JsonFileSinkLifecycleTests --minimum-expected-tests 1
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

- name: Dead-letter source and sink tests
shell: pwsh
run: |
dotnet test --project tests/SmartPipe.Extensions.Json.Tests/SmartPipe.Extensions.Json.Tests.csproj --configuration Release --no-build --filter-class SmartPipe.Extensions.Tests.Sources.DeadLetterSourceTests --minimum-expected-tests 1
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
dotnet test --project tests/SmartPipe.Extensions.Json.Tests/SmartPipe.Extensions.Json.Tests.csproj --configuration Release --no-build --filter-class SmartPipe.Extensions.Tests.Sources.DeadLetterSourceRecoveryTests --minimum-expected-tests 1
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
dotnet test --project tests/SmartPipe.Extensions.Json.Tests/SmartPipe.Extensions.Json.Tests.csproj --configuration Release --no-build --filter-class SmartPipe.Extensions.Tests.DeadLetterSinkTests --minimum-expected-tests 1
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
dotnet test --project tests/SmartPipe.Extensions.Json.Tests/SmartPipe.Extensions.Json.Tests.csproj --configuration Release --no-build --filter-class SmartPipe.Extensions.Tests.DeadLetterSinkAppendTests --minimum-expected-tests 1
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
dotnet test --project tests/SmartPipe.Extensions.Json.Tests/SmartPipe.Extensions.Json.Tests.csproj --configuration Release --no-build --filter-class SmartPipe.Extensions.Json.Tests.DeadLetterSinkLifecycleTests --minimum-expected-tests 1
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

baseline-contract-windows:
name: Baseline contract (Windows)
runs-on: windows-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ${{ github.event_name == 'pull_request' && fromJSON('["self-hosted","Windows","X64"]') || 'windows-latest' }}
timeout-minutes: 20

steps:
Expand Down Expand Up @@ -114,3 +136,40 @@ jobs:

- name: Verify 2.1.2 baseline offline
run: dotnet run --project eng/SmartPipe.RepositoryChecks/SmartPipe.RepositoryChecks.csproj --configuration Release --no-build -- verify-baseline --repo-root . --manifest eng/baselines/2.1.2/manifest.json --packages-dir artifacts/baselines/2.1.2 --offline --mode integrity

cleanup-self-hosted:
name: Cleanup self-hosted workspace
if: always() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
needs: [validation, hosting-integration, json-file-windows, baseline-contract-windows]
runs-on: [self-hosted, Windows, X64]
steps:
- name: Cleanup generated outputs
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
if ([string]::IsNullOrWhiteSpace($env:GITHUB_WORKSPACE)) { throw 'GITHUB_WORKSPACE is required.' }
$workspace = [IO.Path]::GetFullPath($env:GITHUB_WORKSPACE).TrimEnd([IO.Path]::DirectorySeparatorChar, [IO.Path]::AltDirectorySeparatorChar)
if ((Get-Item -LiteralPath $workspace -Force).Attributes -band [IO.FileAttributes]::ReparsePoint) { throw 'Workspace is a reparse point.' }
$prefix = "$workspace$([IO.Path]::DirectorySeparatorChar)"
$targets = [Collections.Generic.List[string]]::new()
$targets.Add((Join-Path $workspace 'artifacts'))
$targets.Add((Join-Path $workspace 'BenchmarkDotNet.Artifacts'))
$targets.Add((Join-Path $workspace '.nuget'))
$pending = [Collections.Generic.Stack[string]]::new()
$pending.Push($workspace)
while ($pending.Count) {
foreach ($directory in Get-ChildItem -LiteralPath $pending.Pop() -Force -Directory) {
if ($directory.Attributes -band [IO.FileAttributes]::ReparsePoint) { continue }
if ($directory.Name -in 'bin', 'obj') { $targets.Add($directory.FullName) }
else { $pending.Push($directory.FullName) }
}
}
foreach ($target in $targets | Sort-Object Length -Descending -Unique) {
$fullPath = [IO.Path]::GetFullPath($target)
if (!$fullPath.StartsWith($prefix, [StringComparison]::OrdinalIgnoreCase)) { throw "Outside workspace: $fullPath" }
if (Test-Path -LiteralPath $fullPath -PathType Container) {
if ((Get-Item -LiteralPath $fullPath -Force).Attributes -band [IO.FileAttributes]::ReparsePoint) { throw "Reparse point: $fullPath" }
if (Get-ChildItem -LiteralPath $fullPath -Force -Recurse | Where-Object { $_.Attributes -band [IO.FileAttributes]::ReparsePoint }) { throw "Reparse point: $fullPath" }
Remove-Item -LiteralPath $fullPath -Recurse -Force
}
}
48 changes: 46 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@ on:
push:
branches: [ main, upd, release/2.2.0 ]
pull_request:
branches: [ main, release/2.2.0, sp220/checkpoint-c ]
branches: [ main, release/2.2.0, sp220/checkpoint-c, sp220/checkpoint-d ]
schedule:
- cron: '27 3 * * 1'

permissions:
contents: read
security-events: write

env:
NUGET_PACKAGES: ${{ github.event_name == 'pull_request' && format('{0}/.nuget/packages', github.workspace) || '' }}

jobs:
analyze:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ${{ github.event_name == 'pull_request' && fromJSON('["self-hosted","Windows","X64"]') || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
Expand All @@ -35,3 +39,43 @@ jobs:

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@99df26d4f13ea111d4ec1a7dddef6063f76b97e9 # v4.37.0
with:
ram: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && '16384' || '' }}
threads: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && '2' || '' }}

cleanup-self-hosted:
name: Cleanup self-hosted workspace
if: always() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
needs: [analyze]
runs-on: [self-hosted, Windows, X64]
steps:
- name: Cleanup generated outputs
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
if ([string]::IsNullOrWhiteSpace($env:GITHUB_WORKSPACE)) { throw 'GITHUB_WORKSPACE is required.' }
$workspace = [IO.Path]::GetFullPath($env:GITHUB_WORKSPACE).TrimEnd([IO.Path]::DirectorySeparatorChar, [IO.Path]::AltDirectorySeparatorChar)
if ((Get-Item -LiteralPath $workspace -Force).Attributes -band [IO.FileAttributes]::ReparsePoint) { throw 'Workspace is a reparse point.' }
$prefix = "$workspace$([IO.Path]::DirectorySeparatorChar)"
$targets = [Collections.Generic.List[string]]::new()
$targets.Add((Join-Path $workspace 'artifacts'))
$targets.Add((Join-Path $workspace 'BenchmarkDotNet.Artifacts'))
$targets.Add((Join-Path $workspace '.nuget'))
$pending = [Collections.Generic.Stack[string]]::new()
$pending.Push($workspace)
while ($pending.Count) {
foreach ($directory in Get-ChildItem -LiteralPath $pending.Pop() -Force -Directory) {
if ($directory.Attributes -band [IO.FileAttributes]::ReparsePoint) { continue }
if ($directory.Name -in 'bin', 'obj') { $targets.Add($directory.FullName) }
else { $pending.Push($directory.FullName) }
}
}
foreach ($target in $targets | Sort-Object Length -Descending -Unique) {
$fullPath = [IO.Path]::GetFullPath($target)
if (!$fullPath.StartsWith($prefix, [StringComparison]::OrdinalIgnoreCase)) { throw "Outside workspace: $fullPath" }
if (Test-Path -LiteralPath $fullPath -PathType Container) {
if ((Get-Item -LiteralPath $fullPath -Force).Attributes -band [IO.FileAttributes]::ReparsePoint) { throw "Reparse point: $fullPath" }
if (Get-ChildItem -LiteralPath $fullPath -Force -Recurse | Where-Object { $_.Attributes -band [IO.FileAttributes]::ReparsePoint }) { throw "Reparse point: $fullPath" }
Remove-Item -LiteralPath $fullPath -Recurse -Force
}
}
41 changes: 39 additions & 2 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,56 @@ name: Dependency Review

on:
pull_request:
branches: [ main, release/2.2.0, sp220/checkpoint-c ]
branches: [ main, release/2.2.0, sp220/checkpoint-c, sp220/checkpoint-d ]

permissions:
contents: read
pull-requests: read

jobs:
dependency-review:
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: [self-hosted, Windows, X64]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false

- name: Dependency review
uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0

cleanup-self-hosted:
name: Cleanup self-hosted workspace
if: always() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
needs: [dependency-review]
runs-on: [self-hosted, Windows, X64]
steps:
- name: Cleanup generated outputs
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
if ([string]::IsNullOrWhiteSpace($env:GITHUB_WORKSPACE)) { throw 'GITHUB_WORKSPACE is required.' }
$workspace = [IO.Path]::GetFullPath($env:GITHUB_WORKSPACE).TrimEnd([IO.Path]::DirectorySeparatorChar, [IO.Path]::AltDirectorySeparatorChar)
if ((Get-Item -LiteralPath $workspace -Force).Attributes -band [IO.FileAttributes]::ReparsePoint) { throw 'Workspace is a reparse point.' }
$prefix = "$workspace$([IO.Path]::DirectorySeparatorChar)"
$targets = [Collections.Generic.List[string]]::new()
$targets.Add((Join-Path $workspace 'artifacts'))
$targets.Add((Join-Path $workspace 'BenchmarkDotNet.Artifacts'))
$pending = [Collections.Generic.Stack[string]]::new()
$pending.Push($workspace)
while ($pending.Count) {
foreach ($directory in Get-ChildItem -LiteralPath $pending.Pop() -Force -Directory) {
if ($directory.Attributes -band [IO.FileAttributes]::ReparsePoint) { continue }
if ($directory.Name -in 'bin', 'obj') { $targets.Add($directory.FullName) }
else { $pending.Push($directory.FullName) }
}
}
foreach ($target in $targets | Sort-Object Length -Descending -Unique) {
$fullPath = [IO.Path]::GetFullPath($target)
if (!$fullPath.StartsWith($prefix, [StringComparison]::OrdinalIgnoreCase)) { throw "Outside workspace: $fullPath" }
if (Test-Path -LiteralPath $fullPath -PathType Container) {
if ((Get-Item -LiteralPath $fullPath -Force).Attributes -band [IO.FileAttributes]::ReparsePoint) { throw "Reparse point: $fullPath" }
if (Get-ChildItem -LiteralPath $fullPath -Force -Recurse | Where-Object { $_.Attributes -band [IO.FileAttributes]::ReparsePoint }) { throw "Reparse point: $fullPath" }
Remove-Item -LiteralPath $fullPath -Recurse -Force
}
}
Loading
Loading