-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-and-publish-frontend-app.yml
More file actions
88 lines (73 loc) · 3.17 KB
/
Copy pathbuild-and-publish-frontend-app.yml
File metadata and controls
88 lines (73 loc) · 3.17 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
name: Build and Publish Frontend App
on:
workflow_call:
jobs:
build-and-publish-frontend-app:
name: Build and Publish Frontend App
runs-on: ubuntu-latest
defaults:
run:
working-directory: genai-database-explorer-frontend
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Set up pnpm
uses: pnpm/action-setup@v6
with:
version: 10
run_install: false
- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version: 22
cache: pnpm
cache-dependency-path: genai-database-explorer-frontend/pnpm-lock.yaml
- name: Install dependencies
run: pnpm install
- name: Run linting
run: pnpm lint
- name: Run unit tests with coverage
if: always()
run: pnpm exec vitest run --coverage --coverage.reporter=json --coverage.reporter=json-summary --coverage.reporter=html --coverage.reporter=cobertura --reporter=junit --reporter=verbose --reporter=github-actions --outputFile.junit=test-results/junit.xml
- name: Generate Coverage Markdown Summary
if: always()
run: |
mkdir -p TestResults/CoverageReport
node -e "const fs=require('fs');const c=JSON.parse(fs.readFileSync('./coverage/coverage-summary.json'));const t=c.total;const fmt=v=>typeof v==='number'?v.toFixed(2):'0.00';const h='# Code Coverage Summary\n\n| Metric | Coverage |\n|--------|----------|\n| Statements | '+fmt(t.statements.pct)+'% |\n| Branches | '+fmt(t.branches.pct)+'% |\n| Functions | '+fmt(t.functions.pct)+'% |\n| Lines | '+fmt(t.lines.pct)+'% |\n';fs.writeFileSync('./TestResults/CoverageReport/SummaryGithub.md',h);"
- name: Add Coverage to Job Summary
if: always()
run: cat TestResults/CoverageReport/SummaryGithub.md >> $GITHUB_STEP_SUMMARY
- name: Add Coverage PR Comment
if: github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' && always()
uses: marocchino/sticky-pull-request-comment@v3
with:
recreate: true
path: genai-database-explorer-frontend/TestResults/CoverageReport/SummaryGithub.md
- name: Build app
run: pnpm run build
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v7
with:
name: frontend-vitest-test-results
path: genai-database-explorer-frontend/test-results/**/*.xml
retention-days: 7
- name: Upload Coverage Report (HTML)
if: always()
uses: actions/upload-artifact@v7
with:
name: frontend-coverage-report-html
path: genai-database-explorer-frontend/coverage/
retention-days: 30
- name: Upload Code Coverage (Cobertura)
if: always()
uses: actions/upload-artifact@v7
with:
name: frontend-code-coverage-cobertura
path: genai-database-explorer-frontend/coverage/coverage-final.json
retention-days: 7
- name: Upload Build Artifact
uses: actions/upload-artifact@v7
with:
name: genai-database-explorer-frontend
path: genai-database-explorer-frontend/dist