Skip to content

Commit dd4299b

Browse files
committed
Add CI workflow for standard/explicit tests; update docs
Introduced a GitHub Actions workflow (ci.yml) with separate jobs for standard and explicit-mode tests, including artifact handling and conditional blocking for branch protection. Updated README to document CI requirements for main/dev branches and clarify fork PR settings.
1 parent 5f8aa56 commit dd4299b

2 files changed

Lines changed: 91 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, dev]
6+
pull_request:
7+
branches: [main, dev]
8+
9+
jobs:
10+
test-standard:
11+
name: test-standard
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 30
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup .NET
19+
uses: actions/setup-dotnet@v4
20+
with:
21+
dotnet-version: 10.x
22+
23+
- name: Restore
24+
run: dotnet restore Source/KZDev.PerfUtils.sln
25+
26+
- name: Build
27+
run: dotnet build Source/KZDev.PerfUtils.sln -c Release
28+
29+
- name: Test (standard)
30+
run: dotnet test Source/KZDev.PerfUtils.sln -c Release --no-build
31+
32+
- name: Upload Release artifacts
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: test-release-artifacts
36+
path: artifacts
37+
if-no-files-found: error
38+
39+
test-explicit:
40+
name: test-explicit
41+
needs: [test-standard]
42+
runs-on: ubuntu-latest
43+
timeout-minutes: 45
44+
# test-explicit failures are non-blocking only for PRs whose base is not main, or for pushes to dev.
45+
# They remain blocking for PRs into main and for pushes to main (aligned with branch-protection intent).
46+
continue-on-error: ${{ (github.event_name == 'pull_request' && github.base_ref != 'main') || (github.event_name == 'push' && github.ref == 'refs/heads/dev') }}
47+
steps:
48+
- name: Checkout
49+
uses: actions/checkout@v4
50+
51+
- name: Setup .NET
52+
uses: actions/setup-dotnet@v4
53+
with:
54+
dotnet-version: 10.x
55+
56+
- name: Download build artifacts
57+
uses: actions/download-artifact@v4
58+
with:
59+
name: test-release-artifacts
60+
path: artifacts
61+
62+
- name: Apply serialized xUnit runner for Explicit
63+
run: |
64+
set -euo pipefail
65+
count=0
66+
while IFS= read -r -d '' f; do
67+
cp Source/Tst/xunit.runner.explicit.json "$f"
68+
count=$((count + 1))
69+
done < <(find artifacts/bin -name xunit.runner.json -print0)
70+
if [ "$count" -eq 0 ]; then
71+
echo "No xunit.runner.json found under artifacts/bin; cannot apply explicit runner overlay."
72+
exit 1
73+
fi
74+
echo "Overlay applied to ${count} xunit.runner.json file(s)."
75+
76+
- name: Test (Explicit only, sequential xUnit)
77+
run: |
78+
dotnet test Source/KZDev.PerfUtils.sln -c Release --no-build \
79+
--filter "TestMode=Explicit" \
80+
-- xUnit.Explicit=only xUnit.MaxParallelThreads=1 xUnit.ParallelizeAssembly=false xUnit.ParallelizeTestCollections=false

Source/Tst/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,17 @@ Add **`[Trait(TestConstants.TestTrait.TestMode, TestConstants.TestMode.Explicit)
6363

6464
---
6565

66+
## Maintainers: branch protection (CI)
67+
68+
Configure GitHub **branch protection** status checks to match how CI gates merges:
69+
70+
- **`main`:** Require **`test-standard`** and **`test-explicit`** from the **CI** workflow so both jobs must pass before merge.
71+
- **`dev`:** Require **`test-standard`** only. **`test-explicit`** is informational on `dev` (workflow uses `continue-on-error` for pushes to `dev` and for pull requests whose base branch is not `main`).
72+
73+
Fork pull requests need repository settings that allow GitHub Actions to run from forks if you want CI for external contributors.
74+
75+
---
76+
6677
## Linux: Docker-based test run
6778

6879
> Run these commands from the \{RepositoryRoot\}\Source directory

0 commit comments

Comments
 (0)