Skip to content

Commit 2e31b1b

Browse files
authored
ci: split PR checks into explicit job groups (#61)
2 parents 89ba695 + 971d25a commit 2e31b1b

3 files changed

Lines changed: 208 additions & 3 deletions

File tree

.github/workflows/pr-check.yml

Lines changed: 153 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@ name: PR Check
22

33
on:
44
pull_request:
5-
push:
6-
branches: [ main, master, develop ]
75

86
permissions:
97
contents: read
108

119
jobs:
1210
build:
11+
name: build (${{ matrix.configuration }})
1312
runs-on: ubuntu-latest
1413

1514
strategy:
@@ -29,3 +28,155 @@ jobs:
2928

3029
- name: Build ${{ matrix.configuration }}
3130
run: dotnet build ModularityKit.Mutator.slnx -c ${{ matrix.configuration }} --no-restore
31+
32+
tests:
33+
name: ${{ matrix.name }}
34+
runs-on: ubuntu-latest
35+
needs: build
36+
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
include:
41+
- name: test:core
42+
command: dotnet test Tests/ModularityKit.Mutator.Tests/ModularityKit.Mutator.Tests.csproj -c Release --no-restore
43+
- name: test:governance
44+
command: dotnet test Tests/ModularityKit.Mutator.Governance.Tests/ModularityKit.Mutator.Governance.Tests.csproj -c Release --no-restore
45+
- name: test:governance-redis
46+
command: dotnet test Tests/ModularityKit.Mutator.Governance.Redis.Tests/ModularityKit.Mutator.Governance.Redis.Tests.csproj -c Release --no-restore
47+
48+
steps:
49+
- uses: actions/checkout@v5
50+
51+
- uses: actions/setup-dotnet@v5
52+
with:
53+
dotnet-version: 10.0.x
54+
55+
- name: Restore
56+
run: dotnet restore ModularityKit.Mutator.slnx
57+
58+
- name: Run ${{ matrix.name }}
59+
run: ${{ matrix.command }}
60+
61+
examples-core:
62+
name: ${{ matrix.name }}
63+
runs-on: ubuntu-latest
64+
needs: build
65+
66+
strategy:
67+
fail-fast: false
68+
matrix:
69+
include:
70+
- name: examples:core / BillingQuotas
71+
command: dotnet run --project Examples/Core/BillingQuotas/BillingQuotas.csproj -c Release --no-restore
72+
- name: examples:core / FeatureFlags
73+
command: dotnet run --project Examples/Core/FeatureFlags/FeatureFlags.csproj -c Release --no-restore
74+
- name: examples:core / IamRoles
75+
command: dotnet run --project Examples/Core/IamRoles/IamRoles.csproj -c Release --no-restore
76+
- name: examples:core / WorkflowApprovals
77+
command: dotnet run --project Examples/Core/WorkflowApprovals/WorkflowApprovals.csproj -c Release --no-restore
78+
79+
steps:
80+
- uses: actions/checkout@v5
81+
82+
- uses: actions/setup-dotnet@v5
83+
with:
84+
dotnet-version: 10.0.x
85+
86+
- name: Restore
87+
run: dotnet restore ModularityKit.Mutator.slnx
88+
89+
- name: Run ${{ matrix.name }}
90+
run: ${{ matrix.command }}
91+
92+
examples-governance:
93+
name: ${{ matrix.name }}
94+
runs-on: ubuntu-latest
95+
needs: build
96+
97+
strategy:
98+
fail-fast: false
99+
matrix:
100+
include:
101+
- name: examples:governance / RequestLifecycle
102+
command: dotnet run --project Examples/Governance/RequestLifecycle/RequestLifecycle.csproj -c Release --no-restore
103+
- name: examples:governance / GovernedExecution
104+
command: dotnet run --project Examples/Governance/GovernedExecution/GovernedExecution.csproj -c Release --no-restore
105+
- name: examples:governance / DecisionTaxonomy
106+
command: dotnet run --project Examples/Governance/DecisionTaxonomy/DecisionTaxonomy.csproj -c Release --no-restore
107+
- name: examples:governance / ApprovalWorkflow
108+
command: dotnet run --project Examples/Governance/ApprovalWorkflow/ApprovalWorkflow.csproj -c Release --no-restore
109+
- name: examples:governance / VersionedResolution
110+
command: dotnet run --project Examples/Governance/VersionedResolution/VersionedResolution.csproj -c Release --no-restore
111+
- name: examples:governance / Queries
112+
command: dotnet run --project Examples/Governance/Queries/Queries.csproj -c Release --no-restore
113+
114+
steps:
115+
- uses: actions/checkout@v5
116+
117+
- uses: actions/setup-dotnet@v5
118+
with:
119+
dotnet-version: 10.0.x
120+
121+
- name: Restore
122+
run: dotnet restore ModularityKit.Mutator.slnx
123+
124+
- name: Run ${{ matrix.name }}
125+
run: ${{ matrix.command }}
126+
127+
examples-governance-redis:
128+
name: examples:governance / RedisQueries
129+
runs-on: ubuntu-latest
130+
needs: build
131+
132+
steps:
133+
- uses: actions/checkout@v5
134+
135+
- uses: actions/setup-dotnet@v5
136+
with:
137+
dotnet-version: 10.0.x
138+
139+
- name: Restore
140+
run: dotnet restore ModularityKit.Mutator.slnx
141+
142+
- name: Start Redis
143+
working-directory: Examples/Governance/RedisQueries
144+
run: docker compose up -d
145+
146+
- name: Run RedisQueries
147+
env:
148+
MODULARITYKIT_REDIS: localhost:6379
149+
run: dotnet run --project Examples/Governance/RedisQueries/RedisQueries.csproj -c Release --no-restore
150+
151+
- name: Stop Redis
152+
if: ${{ always() }}
153+
working-directory: Examples/Governance/RedisQueries
154+
run: docker compose down
155+
156+
validation-summary:
157+
name: validation summary
158+
runs-on: ubuntu-latest
159+
needs:
160+
- build
161+
- tests
162+
- examples-core
163+
- examples-governance
164+
- examples-governance-redis
165+
if: always()
166+
167+
steps:
168+
- name: Report job results
169+
run: |
170+
echo "build: ${{ needs.build.result }}"
171+
echo "tests: ${{ needs.tests.result }}"
172+
echo "examples-core: ${{ needs.examples-core.result }}"
173+
echo "examples-governance: ${{ needs.examples-governance.result }}"
174+
echo "examples-governance-redis: ${{ needs.examples-governance-redis.result }}"
175+
176+
if [ "${{ needs.build.result }}" != "success" ] || \
177+
[ "${{ needs.tests.result }}" != "success" ] || \
178+
[ "${{ needs.examples-core.result }}" != "success" ] || \
179+
[ "${{ needs.examples-governance.result }}" != "success" ] || \
180+
[ "${{ needs.examples-governance-redis.result }}" != "success" ]; then
181+
exit 1
182+
fi

Tests/ModularityKit.Mutator.Governance.Tests/Approval/MutationRequestApprovalWorkflowApprovalTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public void PendingApproval_maps_id_role_group_quorum_and_expiration_targets()
1616
{
1717
var expiresAt = DateTimeOffset.UtcNow.AddHours(1);
1818

19-
var request = MutationRequestApprovalWorkflowTestSupport.CreateLinearApprovalRequest();
19+
var request = MutationRequestApprovalWorkflowTestSupport.CreateTargetMappingApprovalRequest(expiresAt);
2020

2121
Assert.Equal(MutationRequestStatus.Pending, request.Status);
2222
Assert.Equal(PendingMutationReason.Approval, request.PendingReason);

Tests/ModularityKit.Mutator.Governance.Tests/TestSupport/Approval/Workflow/MutationRequestApprovalWorkflowTestSupport.cs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,60 @@ public static MutationRequest CreateLinearApprovalRequest()
2929
expectedStateVersion: "v10");
3030
}
3131

32+
/// <summary>
33+
/// Creates a request that exercises approval mapping for manager, quorum, role, and group targets.
34+
/// </summary>
35+
public static MutationRequest CreateTargetMappingApprovalRequest(DateTimeOffset expiresAt)
36+
{
37+
return MutationRequestFactory.PendingApproval(
38+
stateId: "tenant-42:roles",
39+
stateType: "IamRoleState",
40+
mutationType: "GrantRoleMutation",
41+
intent: CreateIntent(),
42+
context: MutationContext.User("requester", "Requester", "Needs privileged access"),
43+
requirements:
44+
[
45+
PolicyRequirement.Approval("alice", "Manager approval"),
46+
new PolicyRequirement
47+
{
48+
Type = "Approval",
49+
Description = "Security quorum",
50+
Data = new
51+
{
52+
Approvers = new[] { "bob", "carol", "dave" },
53+
StepOrder = 2,
54+
ApprovalGroupId = "security-quorum",
55+
Quorum = 2,
56+
ExpiresAt = expiresAt,
57+
Reason = "Security sign-off"
58+
}
59+
},
60+
new PolicyRequirement
61+
{
62+
Type = "Approval",
63+
Description = "Finance role approval",
64+
Data = new
65+
{
66+
ApproverRole = "finance-approver",
67+
StepOrder = 3,
68+
Reason = "Finance sign-off"
69+
}
70+
},
71+
new PolicyRequirement
72+
{
73+
Type = "Approval",
74+
Description = "Operations group approval",
75+
Data = new
76+
{
77+
ApproverGroup = "ops-oncall",
78+
StepOrder = 4,
79+
Reason = "Operations sign-off"
80+
}
81+
}
82+
],
83+
expectedStateVersion: "v10");
84+
}
85+
3286
/// <summary>
3387
/// Creates a request that exercises quorum-based approval requirements.
3488
/// </summary>

0 commit comments

Comments
 (0)