Files
UA-.NETStandard/.github/ci-test-durations.json
romanett fbaabf5b28 Cut CI runner minutes: duration-packed test batches, CodeQL on Linux/daily, cancellable branch packing (#4694)
Reduces GitHub Actions runner minutes without removing any OS, target
framework, test project or check. All figures come from master CI run
37520359929 (158 jobs, ~1,880 runner-minutes) and the last two weeks of
run history.

## 1. Test batches packed by duration (`get-ci-matrix.ps1`)

Previously the expander picked the **smallest** batch size that fit the
256-job limit, which meant 2 projects per job and 33 jobs per profile.
Job logs show ~45% of the test matrix (674 of ~1,516 min) went to
compiling. Each batch rebuilds the shared dependency graph: the first
project's build took 3.8–4.9 min, the second only 0.4–0.9 min.

- Projects are now packed in path order (which keeps `PubSub.*`,
`Redundancy.*`, `WotCon.*` together) up to a 30-minute weight target,
using `.github/ci-test-durations.json`. Each weight is the slowest PR
profile's test minutes, rounded up, plus 1.
- A batch never holds more projects than the job timeout can budget for:
at most 7, given 20 + n×45 ≤ 350.
- If the matrix would exceed the job limit, the target is raised
instead.
- **PR test matrix: 132 → 60 jobs** (15 per profile; macOS 33 → 15).
Each batch is estimated at ≤36 min on the slowest runner, comparable to
today's slowest jobs (37–43 min), so wall-clock should be about the
same. Expected saving is roughly 300+ runner-min per run, plus less
queueing for the scarce macOS runners.
- The weekly full scope shrinks the same way (still 13 profiles).
- The table only steers balance: a project missing from it gets
`defaultMinutes`, so it is still scheduled.
- `run-dotnet-tests.ps1` now records per-project
`buildSeconds`/`testSeconds` (batch summary and job summary). The new
`update-test-durations.ps1` refreshes the table from any run's
`dotnet-results-*` artifacts.
- `discover` output `batch_size` is renamed to `batch_target_minutes`.
Nothing consumed it.

New `CiMatrixScriptTests` cases:
- each profile runs each of its projects exactly once;
- only a lone project may exceed the target;
- PR profiles average ≥3 projects per job;
- the duration table names only existing projects.

## 2 + 3. CodeQL (`codeql-analysis.yml`)

- **No longer runs on every push to master.** Instead, a daily schedule
on master (was weekly) gives an analysis that always completes. Each
analysis takes ~3 h, and with `cancel-in-progress: true` per branch, 49
of 76 push runs in two weeks were cancelled by the next merge before
uploading anything. `master378`/`release/*`/`develop/*` keep their push
trigger. PRs are still analyzed as before.
- Only PR runs are cancelled when superseded. Push and scheduled runs
always finish.
- **Runs on `ubuntu-latest` instead of `windows-2025`.** Only net10.0 is
built, so the extracted sources are identical. The traced Windows build
alone took 70 min, against 12 min for the untraced Linux `UA.slnx`
net10.0 leg. This PR touches a `.cs` file, so its own CodeQL run is the
first measurement.

## 4. NuGet packing on feature branches (`nuget-publish.yml`)

298 of ~400 runs in two weeks were feature-branch pushes, each about 59
Windows-min across two signed builds.

- A superseded feature-branch run is now cancelled. Protected lines and
tags are never cancelled: they publish previews, and `release.yml`
promotes a run by ID. Each manual (`workflow_dispatch`) run gets its own
concurrency group, so a later push cannot cancel it.
- A new `changes` job skips packing when a feature branch, as a whole,
changes only documentation. It diffs against the merge base with master,
not the previous push, so a docs-only push that cancels a code push
cannot mask that code change. It uses the same `get-path-relevance.ps1`
rule as CI.
- Protected refs, tags, manual runs, and any branch whose merge base
cannot be resolved always pack. Checked locally for docs-only branch
(skip), code branch, protected ref, manual run and unknown commit (all
pack).

## Verification

- `CiMatrixScriptTests`, `CiPathRelevanceTests` and the new
`CiTestDurationsScriptTests` (covering `update-test-durations.ps1`): all
`*.Ci*` tests in `Opc.Ua.Tools.Tests` pass locally, 63/63.
- This PR's own CI run shows the new matrix. Compare its total
runner-minutes and longest test job against run 37520359929.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 10:00:19 +02:00

73 lines
2.7 KiB
JSON

{
"source": "Run 37520359929 (master, 2026-10-06): slowest of the four pull-request profiles, test minutes rounded up, plus one minute of incremental build. Opc.Ua.Server.Tests (net48), Opc.Ua.WotCon.Samples.Tests (macOS) and Opc.Ua.Subscriptions.Durable.Tests (nightly) were set from their known run times. Regenerate with .github/scripts/update-test-durations.ps1.",
"defaultMinutes": 5,
"projects": {
"Opc.Ua.AI.Tests": 3,
"Opc.Ua.AMB.Tests": 5,
"Opc.Ua.Bindings.Https.WebApi.Tests": 3,
"Opc.Ua.Certificates.Fuzz.Tests": 3,
"Opc.Ua.Client.ComplexTypes.Tests": 5,
"Opc.Ua.Client.Tests": 7,
"Opc.Ua.Configuration.Tests": 3,
"Opc.Ua.Core.Diagnostics.Tests": 3,
"Opc.Ua.Core.Encoders.Tests": 3,
"Opc.Ua.Core.Schema.Tests": 2,
"Opc.Ua.Core.Security.Tests": 8,
"Opc.Ua.Core.Tests": 6,
"Opc.Ua.Di.Tests": 9,
"Opc.Ua.Encoders.Fuzz.Tests": 4,
"Opc.Ua.Features.Tests": 11,
"Opc.Ua.Fuzzing.Tests": 2,
"Opc.Ua.Gds.Tests": 12,
"Opc.Ua.History.Tests": 6,
"Opc.Ua.ISA95.Tests": 4,
"Opc.Ua.InformationModel.Tests": 7,
"Opc.Ua.Interop.Tests": 11,
"Opc.Ua.Lds.Tests": 4,
"Opc.Ua.Machinery.Tests": 7,
"Opc.Ua.MigrationAnalyzer.Core.Tests": 2,
"Opc.Ua.MigrationAnalyzer.Tests": 2,
"Opc.Ua.Network.Fuzz.Tests": 2,
"Opc.Ua.OpenUsd.Tests": 3,
"Opc.Ua.Positioning.Tests": 3,
"Opc.Ua.PubSub.Adapter.Tests": 3,
"Opc.Ua.PubSub.Diagnostics.Tests": 3,
"Opc.Ua.PubSub.Eth.Tests": 2,
"Opc.Ua.PubSub.Fuzz.Tests": 3,
"Opc.Ua.PubSub.Kafka.Tests": 2,
"Opc.Ua.PubSub.Mqtt.Tests": 2,
"Opc.Ua.PubSub.Schema.Tests": 3,
"Opc.Ua.PubSub.Server.Tests": 3,
"Opc.Ua.PubSub.Tests": 3,
"Opc.Ua.PubSub.Udp.Tests": 2,
"Opc.Ua.Pumps.Tests": 5,
"Opc.Ua.Redundancy.Client.Tests": 3,
"Opc.Ua.Redundancy.Kubernetes.Tests": 3,
"Opc.Ua.Redundancy.PubSub.Tests": 2,
"Opc.Ua.Redundancy.Samples.Tests": 3,
"Opc.Ua.Redundancy.Server.Tests": 4,
"Opc.Ua.Robotics.Intent.Tests": 4,
"Opc.Ua.Robotics.Tests": 6,
"Opc.Ua.Scales.Tests": 6,
"Opc.Ua.Security.Certificates.Tests": 3,
"Opc.Ua.Security.Pkcs11.Tests": 2,
"Opc.Ua.Server.Tests": 21,
"Opc.Ua.Sessions.Tests": 17,
"Opc.Ua.SourceGeneration.Core.Tests": 13,
"Opc.Ua.SourceGeneration.Stack.Tests": 4,
"Opc.Ua.SourceGeneration.Tests": 6,
"Opc.Ua.Subscriptions.Classic.Tests": 7,
"Opc.Ua.Subscriptions.Durable.Tests": 8,
"Opc.Ua.Subscriptions.Tests": 2,
"Opc.Ua.Tools.Tests": 7,
"Opc.Ua.Types.Tests": 3,
"Opc.Ua.Vision.Intent.Tests": 4,
"Opc.Ua.Vision.Tests": 5,
"Opc.Ua.VisualInspection.Tests": 2,
"Opc.Ua.WotCon.Bindings.Tests": 4,
"Opc.Ua.WotCon.Samples.Tests": 22,
"Opc.Ua.WotCon.Tests": 9,
"Opc.Ua.XRegistry.Tests": 4
}
}