|
| 1 | +name: Runtime architecture |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [main] |
| 6 | + paths: |
| 7 | + - "src/ProcessBus.Iec61850.Raw/Runtime/**" |
| 8 | + - "src/ProcessBus.Iec61850.Raw/Replay/**" |
| 9 | + - "tests/ProcessBus.Tests/PcapReplayRuntimeTests.cs" |
| 10 | + - ".github/workflows/runtime-architecture.yml" |
| 11 | + schedule: |
| 12 | + - cron: "17 3 * * 4" |
| 13 | + workflow_dispatch: |
| 14 | + inputs: |
| 15 | + iterations: |
| 16 | + description: Number of deterministic architecture passes |
| 17 | + required: true |
| 18 | + default: "3" |
| 19 | + |
| 20 | +permissions: |
| 21 | + contents: read |
| 22 | + |
| 23 | +concurrency: |
| 24 | + group: runtime-architecture-${{ github.workflow }}-${{ github.ref }} |
| 25 | + cancel-in-progress: true |
| 26 | + |
| 27 | +env: |
| 28 | + DOTNET_NOLOGO: true |
| 29 | + DOTNET_CLI_TELEMETRY_OPTOUT: true |
| 30 | + |
| 31 | +jobs: |
| 32 | + architecture: |
| 33 | + name: Immutable snapshot and PCAP replay gate |
| 34 | + runs-on: windows-latest |
| 35 | + timeout-minutes: 30 |
| 36 | + |
| 37 | + steps: |
| 38 | + - name: Checkout |
| 39 | + uses: actions/checkout@v4 |
| 40 | + |
| 41 | + - name: Setup .NET |
| 42 | + uses: actions/setup-dotnet@v5 |
| 43 | + with: |
| 44 | + dotnet-version: 8.0.x |
| 45 | + |
| 46 | + - name: Restore |
| 47 | + run: dotnet restore .\ProcessBusSuite.sln |
| 48 | + |
| 49 | + - name: Build |
| 50 | + run: dotnet build .\ProcessBusSuite.sln -c Release --no-restore /p:ContinuousIntegrationBuild=true |
| 51 | + |
| 52 | + - name: Repeat runtime architecture suite |
| 53 | + shell: pwsh |
| 54 | + run: | |
| 55 | + $requested = '${{ github.event.inputs.iterations }}' |
| 56 | + $iterations = 3 |
| 57 | + if (-not [string]::IsNullOrWhiteSpace($requested)) { |
| 58 | + $parsed = 0 |
| 59 | + if (-not [int]::TryParse($requested, [ref]$parsed)) { |
| 60 | + throw "Invalid iterations value: $requested" |
| 61 | + } |
| 62 | + $iterations = [Math]::Clamp($parsed, 1, 20) |
| 63 | + } |
| 64 | +
|
| 65 | + New-Item -ItemType Directory -Path .\TestResults\RuntimeArchitecture -Force | Out-Null |
| 66 | + Write-Host "Runtime architecture iterations: $iterations" |
| 67 | +
|
| 68 | + for ($iteration = 1; $iteration -le $iterations; $iteration++) { |
| 69 | + Write-Host "=== Runtime architecture pass $iteration/$iterations ===" |
| 70 | + dotnet test .\tests\ProcessBus.Tests\ProcessBus.Tests.csproj ` |
| 71 | + -c Release ` |
| 72 | + --no-build ` |
| 73 | + --filter "Category=RuntimeArchitecture" ` |
| 74 | + --logger "trx;LogFileName=runtime-architecture-$iteration.trx" ` |
| 75 | + --results-directory .\TestResults\RuntimeArchitecture |
| 76 | +
|
| 77 | + if ($LASTEXITCODE -ne 0) { |
| 78 | + throw "Runtime architecture pass $iteration failed." |
| 79 | + } |
| 80 | + } |
| 81 | +
|
| 82 | + - name: Upload runtime architecture evidence |
| 83 | + if: always() |
| 84 | + uses: actions/upload-artifact@v7 |
| 85 | + with: |
| 86 | + name: runtime-architecture-${{ github.run_id }} |
| 87 | + path: TestResults/RuntimeArchitecture/** |
| 88 | + if-no-files-found: error |
| 89 | + retention-days: 30 |
0 commit comments