-
Notifications
You must be signed in to change notification settings - Fork 1
115 lines (97 loc) · 3.54 KB
/
Copy pathci.yml
File metadata and controls
115 lines (97 loc) · 3.54 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
lint-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: "24"
cache: "npm"
cache-dependency-path: package-lock.json
- name: Install dependencies
run: npm ci
- name: Lint code
run: npm run lint
- name: Lint markdown
run: npm run lint:md
- name: Build (development)
run: npm run build
- name: Run unit tests with coverage
run: npm run test:coverage
- name: Upload coverage to Codacy
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
if: ${{ env.CODACY_PROJECT_TOKEN != '' }}
continue-on-error: true
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ env.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage/lcov.info
- name: Upload coverage artifact
if: always()
continue-on-error: true
uses: actions/upload-artifact@v7
with:
name: coverage
path: coverage
- name: Generate summary
if: always()
continue-on-error: true
run: |
echo "# Test Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ -f coverage/coverage-summary.json ]; then
LINES=$(node -e "console.log(require('./coverage/coverage-summary.json').total.lines.pct)")
FUNCS=$(node -e "console.log(require('./coverage/coverage-summary.json').total.functions.pct)")
BRANCHES=$(node -e "console.log(require('./coverage/coverage-summary.json').total.branches.pct)")
STMTS=$(node -e "console.log(require('./coverage/coverage-summary.json').total.statements.pct)")
echo "- Lines: ${LINES}%" >> $GITHUB_STEP_SUMMARY
echo "- Functions: ${FUNCS}%" >> $GITHUB_STEP_SUMMARY
echo "- Branches: ${BRANCHES}%" >> $GITHUB_STEP_SUMMARY
echo "- Statements: ${STMTS}%" >> $GITHUB_STEP_SUMMARY
else
echo "Coverage summary not found." >> $GITHUB_STEP_SUMMARY
fi
- name: Cache Playwright browsers
id: playwright_cache
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-playwright-
- name: Cache Angular/Vite dev cache
uses: actions/cache@v4
with:
path: |
.angular/cache
node_modules/.vite
node_modules/.cache/angular
key: ${{ runner.os }}-ngcache-${{ hashFiles('**/package-lock.json', 'angular.json', 'tsconfig.json', 'tsconfig.app.json') }}
restore-keys: |
${{ runner.os }}-ngcache-
- name: Install Playwright system dependencies
run: npx playwright install-deps
- name: Playwright install (browsers on cache miss)
if: steps.playwright_cache.outputs.cache-hit != 'true'
run: npx playwright install
- name: Run Playwright tests (headless)
env:
NG_PERSISTENT_BUILD_CACHE: "1"
run: npm run e2e
- name: Upload Playwright report
if: always()
continue-on-error: true
uses: actions/upload-artifact@v7
with:
name: playwright-report
path: playwright-report