Skip to content

Commit 594c259

Browse files
committed
dependency fix + test reporting
1 parent 53d77bd commit 594c259

16 files changed

Lines changed: 171 additions & 16 deletions

File tree

.github/dependabot.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ updates:
1111
patterns: ['*']
1212

1313
# The two SPAs and the two e2e harnesses each have their own lockfile.
14+
# Group aggressively so a weekly run lands ~2 PRs per directory (safe vs. breaking),
15+
# not one-per-package: minor/patch in one PR, the riskier majors batched in another.
1416
- package-ecosystem: npm
1517
directories:
1618
- '/src/web/admin'
@@ -23,9 +25,14 @@ updates:
2325
groups:
2426
npm-minor-patch:
2527
update-types: ['minor', 'patch']
28+
npm-major:
29+
update-types: ['major']
2630

27-
# Keep the workflow actions themselves current.
31+
# Keep the workflow actions themselves current — all action bumps in a single PR.
2832
- package-ecosystem: github-actions
2933
directory: '/'
3034
schedule:
3135
interval: weekly
36+
groups:
37+
github-actions:
38+
patterns: ['*']

.github/workflows/backend.yml

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,11 @@ jobs:
3838
build-test:
3939
name: Build & test
4040
runs-on: ubuntu-latest # Docker is preinstalled here — the integration tests need it (Testcontainers).
41+
permissions:
42+
contents: read
43+
checks: write # let the test reporter publish a per-test Check run.
4144
steps:
42-
- uses: actions/checkout@v5
45+
- uses: actions/checkout@v7
4346

4447
- name: Setup .NET (from global.json)
4548
uses: actions/setup-dotnet@v5
@@ -60,15 +63,38 @@ jobs:
6063
- name: Build (Release, warnings-as-errors)
6164
run: dotnet build Warehouse.slnx -c Release --no-restore
6265

63-
# To also collect coverage, add the `coverlet.collector` package to the test projects
64-
# and append: --collect "XPlat Code Coverage"
6566
- name: Test (unit + architecture + integration)
6667
run: >
6768
dotnet test Warehouse.slnx -c Release --no-build
68-
--logger "trx;LogFileName=test-results.trx"
69+
--logger trx
70+
--collect "XPlat Code Coverage"
6971
--results-directory ${{ github.workspace }}/TestResults
7072
71-
- name: Upload test results
73+
# Surfaces a per-test pass/fail Check (with failure annotations on the PR) from the TRX files,
74+
# so you can see which tests broke without downloading the artifact. Runs even when tests fail.
75+
- name: Publish test report
76+
if: ${{ !cancelled() }}
77+
uses: dorny/test-reporter@v3
78+
with:
79+
name: Backend tests
80+
path: TestResults/**/*.trx
81+
reporter: dotnet-trx
82+
fail-on-error: false
83+
84+
# Turn the cobertura output (from coverlet.collector) into a markdown table on the run's summary page.
85+
- name: Coverage summary
86+
if: ${{ !cancelled() }}
87+
uses: danielpalme/ReportGenerator-GitHub-Action@5
88+
with:
89+
reports: ${{ github.workspace }}/TestResults/**/coverage.cobertura.xml
90+
targetdir: ${{ github.workspace }}/coveragereport
91+
reporttypes: MarkdownSummaryGithub
92+
93+
- name: Append coverage to job summary
94+
if: ${{ !cancelled() }}
95+
run: cat ${{ github.workspace }}/coveragereport/SummaryGithub.md >> "$GITHUB_STEP_SUMMARY" || true
96+
97+
- name: Upload test results & coverage
7298
if: ${{ !cancelled() }}
7399
uses: actions/upload-artifact@v7
74100
with:
@@ -93,7 +119,7 @@ jobs:
93119
- name: logistics-api
94120
project: src/Services/Logistics/Warehouse.Logistics.Api/Warehouse.Logistics.Api.csproj
95121
steps:
96-
- uses: actions/checkout@v5
122+
- uses: actions/checkout@v7
97123

98124
- name: Setup .NET (from global.json)
99125
uses: actions/setup-dotnet@v5

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- language: javascript-typescript
3131
build-mode: none
3232
steps:
33-
- uses: actions/checkout@v5
33+
- uses: actions/checkout@v7
3434

3535
- name: Initialize CodeQL
3636
uses: github/codeql-action/init@v4
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Dependency review
2+
3+
# On every PR, flag dependencies that introduce known vulnerabilities or disallowed licenses
4+
# (reads the GitHub dependency graph — covers both NuGet and npm). No deployment.
5+
on:
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
dependency-review:
13+
name: Review
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
pull-requests: write # post the findings summary as a PR comment
18+
steps:
19+
- uses: actions/checkout@v7
20+
21+
- name: Dependency review
22+
uses: actions/dependency-review-action@v5
23+
with:
24+
fail-on-severity: high
25+
comment-summary-in-pr: on-failure

.github/workflows/docker.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ jobs:
3636
build:
3737
name: ${{ matrix.name }}
3838
runs-on: ubuntu-latest
39+
permissions:
40+
contents: read
41+
security-events: write # upload the Trivy SARIF to the Security tab.
3942
strategy:
4043
fail-fast: false
4144
matrix:
@@ -61,7 +64,7 @@ jobs:
6164
context: src/web/terminal
6265
dockerfile: src/web/terminal/Dockerfile
6366
steps:
64-
- uses: actions/checkout@v5
67+
- uses: actions/checkout@v7
6568

6669
- name: Setup Buildx
6770
uses: docker/setup-buildx-action@v4
@@ -72,6 +75,40 @@ jobs:
7275
context: ${{ matrix.context }}
7376
file: ${{ matrix.dockerfile }}
7477
push: false
78+
load: true # keep the image locally so it can be scanned below.
7579
tags: warehouse-${{ matrix.name }}:ci
7680
cache-from: type=gha,scope=${{ matrix.name }}
7781
cache-to: type=gha,scope=${{ matrix.name }},mode=max
82+
83+
# Scan the built image for known CVEs. Report-only (exit-code 0) — results land in the
84+
# Security tab via SARIF rather than blocking the build; tighten exit-code later to gate.
85+
- name: Scan image (Trivy)
86+
uses: aquasecurity/trivy-action@v0.36.0
87+
with:
88+
image-ref: warehouse-${{ matrix.name }}:ci
89+
format: sarif
90+
output: trivy-${{ matrix.name }}.sarif
91+
severity: CRITICAL,HIGH
92+
exit-code: '0'
93+
94+
- name: Upload Trivy results
95+
if: ${{ !cancelled() }}
96+
uses: github/codeql-action/upload-sarif@v4
97+
with:
98+
sarif_file: trivy-${{ matrix.name }}.sarif
99+
category: trivy-${{ matrix.name }}
100+
101+
# Software bill of materials for the image — useful artifact for supply-chain auditing.
102+
- name: Generate SBOM
103+
uses: anchore/sbom-action@v0
104+
with:
105+
image: warehouse-${{ matrix.name }}:ci
106+
format: spdx-json
107+
output-file: sbom-${{ matrix.name }}.spdx.json
108+
109+
- name: Upload SBOM
110+
uses: actions/upload-artifact@v7
111+
with:
112+
name: sbom-${{ matrix.name }}
113+
path: sbom-${{ matrix.name }}.spdx.json
114+
if-no-files-found: warn

.github/workflows/e2e.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ jobs:
2525
e2e:
2626
name: ${{ matrix.app }}
2727
runs-on: ubuntu-latest
28+
permissions:
29+
contents: read
30+
checks: write # let the test reporter publish a per-test Check run.
2831
strategy:
2932
fail-fast: false
3033
matrix:
@@ -38,10 +41,10 @@ jobs:
3841
env:
3942
CI: '1'
4043
steps:
41-
- uses: actions/checkout@v5
44+
- uses: actions/checkout@v7
4245

4346
- name: Setup Node 20
44-
uses: actions/setup-node@v5
47+
uses: actions/setup-node@v6
4548
with:
4649
node-version: 20
4750
cache: npm
@@ -69,6 +72,17 @@ jobs:
6972
working-directory: ${{ matrix.e2e }}
7073
run: npm test
7174

75+
# Per-test pass/fail Check from Playwright's JUnit output (the `github` reporter also
76+
# annotates failures inline on the PR). Runs even when the suite fails.
77+
- name: Publish test report
78+
if: ${{ !cancelled() }}
79+
uses: dorny/test-reporter@v3
80+
with:
81+
name: E2E tests (${{ matrix.app }})
82+
path: ${{ matrix.e2e }}/test-results/junit.xml
83+
reporter: java-junit
84+
fail-on-error: false
85+
7286
- name: Upload Playwright report
7387
if: ${{ !cancelled() }}
7488
uses: actions/upload-artifact@v7

.github/workflows/frontend.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,17 @@ jobs:
3535
- app: terminal
3636
dir: src/web/terminal
3737
build: build:web # expo export --platform web
38+
permissions:
39+
contents: read
40+
checks: write # let the test reporter publish a per-test Check run.
3841
defaults:
3942
run:
4043
working-directory: ${{ matrix.dir }}
4144
steps:
42-
- uses: actions/checkout@v5
45+
- uses: actions/checkout@v7
4346

4447
- name: Setup Node 20
45-
uses: actions/setup-node@v5
48+
uses: actions/setup-node@v6
4649
with:
4750
node-version: 20
4851
cache: npm
@@ -62,8 +65,20 @@ jobs:
6265
- name: Lint
6366
run: npm run lint --if-present
6467

68+
# Only admin has a test:run script; --if-present makes this a no-op for terminal.
69+
# The extra args make vitest also emit JUnit for the test reporter below.
6570
- name: Unit tests
66-
run: npm run test:run --if-present
71+
run: npm run test:run --if-present -- --reporter=default --reporter=junit --outputFile=test-results/vitest-junit.xml
72+
73+
# Per-test pass/fail Check from the vitest JUnit output (admin only).
74+
- name: Publish test report
75+
if: ${{ !cancelled() && matrix.app == 'admin' }}
76+
uses: dorny/test-reporter@v3
77+
with:
78+
name: Frontend tests (admin)
79+
path: ${{ matrix.dir }}/test-results/vitest-junit.xml
80+
reporter: java-junit
81+
fail-on-error: false
6782

6883
- name: Build
6984
run: npm run ${{ matrix.build }}

Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="10.0.9" />
4040
<PackageVersion Include="Yarp.ReverseProxy" Version="2.3.0" />
4141
<!-- Tests -->
42+
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
4243
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.6.0" />
4344
<PackageVersion Include="NetArchTest.Rules" Version="1.3.2" />
4445
<PackageVersion Include="NSubstitute" Version="5.3.0" />

tests/Warehouse.ArchitectureTests/Warehouse.ArchitectureTests.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<ItemGroup>
4+
<PackageReference Include="coverlet.collector">
5+
<PrivateAssets>all</PrivateAssets>
6+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
7+
</PackageReference>
48
<PackageReference Include="Microsoft.NET.Test.Sdk" />
59
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" />
610
<PackageReference Include="NetArchTest.Rules" />

tests/Warehouse.Logistics.IntegrationTests/Warehouse.Logistics.IntegrationTests.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<ItemGroup>
4+
<PackageReference Include="coverlet.collector">
5+
<PrivateAssets>all</PrivateAssets>
6+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
7+
</PackageReference>
48
<PackageReference Include="Microsoft.NET.Test.Sdk" />
59
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" />
610
<PackageReference Include="Respawn" />

0 commit comments

Comments
 (0)