-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (61 loc) · 2.26 KB
/
ci.yml
File metadata and controls
78 lines (61 loc) · 2.26 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
name: Codecov CI with Vitest and SonarQube
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch the entire Git history
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: npm install
- name: Verify Vitest installation
run: |
echo "Checking Vitest installation..."
which vitest || echo "Vitest not found!" # Check if Vitest is installed
npm list vitest # List the Vitest package to verify installation
# Uncomment this block if you eventually want bundle analysis enabled again:
#
# - name: Create vite.config.js (for Codecov Bundle Analysis)
# run: |
# echo "import { defineConfig } from 'vite';
# import { codecovVitePlugin } from '@codecov/vite-plugin';
# export default defineConfig({
# plugins: [
# codecovVitePlugin({
# enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
# bundleName: 'example-javascript',
# uploadToken: process.env.CODECOV_TOKEN
# })
# ]
# })" > vite.config.js
# - name: Build app for bundle analysis
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }}
# run: npm run build
- name: Run tests with coverage
run: npm run test --coverage || true
- name: List all files recursively (debugging step)
run: |
ls -R coverage
find . -type f -name "*coverage*"
find . -type f -name "*.json"
find . -type f -name "*.lcov*"
- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_ORG_TOKEN }}
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_ORG_TOKEN }}
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}