This repository was archived by the owner on Jun 28, 2026. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 37
94 lines (77 loc) · 2.55 KB
/
Copy pathworkflow.yml
File metadata and controls
94 lines (77 loc) · 2.55 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
name: CI Pipeline
on:
pull_request:
branches: [main, development, dev]
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate diff
run: git diff "origin/${{ github.base_ref }}" HEAD > diff.txt
- name: Upload diff artifact
uses: actions/upload-artifact@v4
with:
name: git-diff-${{ matrix.os }}
path: diff.txt
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- name: Install dependencies
run: npm ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Security audit
run: npm audit --audit-level=moderate || true
- name: Lint and Fix
run: npm run fix
- name: Compile
run: npm run compile
- name: Format
run: npm run format
- name: Build Webview
run: |
cd webviewUi
npm ci
npm run lint
npm run build
- name: Compile Tests
run: npm run compile:test
- name: Run Tests with Coverage (Linux)
run: xvfb-run -a npm run test:coverage
if: runner.os == 'Linux'
- name: Run Tests (macOS)
run: npm test
if: runner.os == 'macOS'
- name: Run Tests (Windows)
run: npm test
if: runner.os == 'Windows'
- name: Upload Coverage Report
uses: actions/upload-artifact@v4
if: ${{ runner.os == 'Linux' && !cancelled() }}
with:
name: coverage-report
path: coverage/
- name: Check Coverage Threshold
if: runner.os == 'Linux'
run: |
if [ -f coverage/coverage-summary.json ]; then
LINES=$(node -e "const c=require('./coverage/coverage-summary.json');console.log(c.total.lines.pct)")
echo "Line coverage: ${LINES}%"
node -e "const c=require('./coverage/coverage-summary.json');if(c.total.lines.pct<30){console.error('Coverage '+c.total.lines.pct+'% is below 30% threshold');process.exit(1)}else{console.log('Coverage gate passed: '+c.total.lines.pct+'%')}"
else
echo "::warning::No coverage summary found, skipping threshold check"
fi
- name: Package
run: npm run package
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}