Repository navigation
91 lines (79 loc) · 3.7 KB
/
Copy pathci.yml
File metadata and controls
91 lines (79 loc) · 3.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: CI
on:
pull_request:
push:
branches: [master]
workflow_dispatch:
# Least-privilege default for GITHUB_TOKEN. The test job runs PR-controlled
# code (npm scripts, checkout) and must never hold a write credential.
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# Needed so `git show <base-sha>:coverage-floor.json` below can
# resolve the base branch's blob (mirrors lint.yml's guard step).
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: |
package-lock.json
test-app/package-lock.json
# Install against public npm only; the pinned .npmrc guarantees no
# internal/private registry is inherited from a runner or contributor.
- name: Install root dependencies
run: npm ci
- name: Install test-app dependencies
run: npm ci --prefix test-app
# Vitest transforms TS via esbuild for testing and does not run
# Angular's AOT compiler / template type-checking, so a change that
# breaks NgModule wiring or template types can pass lint + vitest while
# still failing a real build. `ng build` catches that class of error.
- name: Build test-app
run: npm --prefix test-app run build
# Guards against the security CI configuration (workflow, ZAP gate,
# exception baseline, docs) drifting out of the shape the QASP-driven
# gate depends on -- see docs/security-scanning.md and #614.
- name: Validate security workflow
run: npm run validate:security-workflow
# Guards against coverage-floor.json being lowered directly on this PR
# branch (paired with a coverage regression) rather than earned via
# `npm run coverage:bump`. Mirrors the ESLint baseline guard in
# .github/workflows/lint.yml.
- name: Guard against a lowered coverage floor
if: github.event_name == 'pull_request'
run: |
git show "${{ github.event.pull_request.base.sha }}:coverage-floor.json" > /tmp/base-coverage-floor.json 2>/dev/null || echo '{}' > /tmp/base-coverage-floor.json
node scripts/check-coverage-floor-not-decreased.mjs /tmp/base-coverage-floor.json coverage-floor.json
# Runs the full spec harness with coverage via Vitest (Analog's Angular
# Vite plugin + istanbul coverage). `vitest run` exits non-zero on any
# spec failure, gating the build.
- name: Run test-app harness with coverage
run: npm --prefix test-app test
# Ratcheting coverage-floor gate (#627): fails the build if measured
# coverage drops below any floor recorded in coverage-floor.json.
# Floors only ever move up, via `npm run coverage:bump`, landed as its
# own deliberate commit — feature/spec PRs must not edit that file.
- name: Enforce coverage-floor gate
run: npm run coverage:check
# Coverage is reported here (Vitest's istanbul text-summary in the log
# above, plus the lcov artifact below). Enforcement of the 80% new-code
# floor (target 90%) is tracked by #576 and applied once the green
# baseline number is set.
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: test-app-coverage
path: test-app/coverage/**
if-no-files-found: warn
retention-days: 30