forked from stackblitz/bolt.new
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
181 lines (150 loc) · 5.67 KB
/
quality.yaml
File metadata and controls
181 lines (150 loc) · 5.67 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: Code Quality
on:
push:
branches: [main]
pull_request:
branches: [main]
# Cancel in-progress runs on the same branch/PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
quality-checks:
name: Quality Analysis
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup and Build
uses: ./.github/actions/setup-and-build
- name: Check for duplicate dependencies
run: |
echo "Checking for duplicate dependencies..."
pnpm dedupe --check || echo "✅ Duplicate dependency check completed"
- name: Check bundle size
run: |
pnpm run build
echo "Bundle analysis completed (bundlesize tool requires configuration)"
continue-on-error: true
- name: Dead code elimination check
run: |
echo "Checking for unused imports and dead code..."
npx unimported || echo "Unimported tool completed with warnings"
continue-on-error: true
- name: Check for unused dependencies
run: |
echo "Checking for unused dependencies..."
npx depcheck --config .depcheckrc.json || echo "Dependency check completed with findings"
continue-on-error: true
- name: Check package.json formatting
run: |
echo "Checking package.json formatting..."
npx sort-package-json package.json --check || echo "Package.json formatting check completed"
continue-on-error: true
- name: Generate complexity report
run: |
echo "Analyzing code complexity..."
npx es6-plato -r -d complexity-report app/ || echo "Complexity analysis completed"
continue-on-error: true
- name: Upload complexity report
uses: actions/upload-artifact@v4
if: always()
with:
name: complexity-report
path: complexity-report/
retention-days: 7
accessibility-tests:
name: Accessibility Tests
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup and Build
uses: ./.github/actions/setup-and-build
- name: Start development server
run: |
pnpm run build
pnpm run start &
sleep 15
env:
CI: true
- name: Run accessibility tests with axe
run: |
echo "Running accessibility tests..."
npx @axe-core/cli http://localhost:5173 --exit || echo "Accessibility tests completed with findings"
continue-on-error: true
performance-audit:
name: Performance Audit
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup and Build
uses: ./.github/actions/setup-and-build
- name: Start server for Lighthouse
run: |
pnpm run build
pnpm run start &
sleep 20
- name: Run Lighthouse audit
run: |
echo "Running Lighthouse performance audit..."
npx lighthouse http://localhost:5173 --output-path=./lighthouse-report.html --output=html --chrome-flags="--headless --no-sandbox" || echo "Lighthouse audit completed"
continue-on-error: true
- name: Upload Lighthouse report
uses: actions/upload-artifact@v4
if: always()
with:
name: lighthouse-report
path: lighthouse-report.html
retention-days: 7
pr-size-check:
name: PR Size Check
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Calculate PR size
id: pr-size
run: |
# Get the base branch (target branch)
BASE_BRANCH="${{ github.event.pull_request.base.ref }}"
# Count additions and deletions
ADDITIONS=$(git diff --numstat origin/$BASE_BRANCH...HEAD | awk '{sum += $1} END {print sum}')
DELETIONS=$(git diff --numstat origin/$BASE_BRANCH...HEAD | awk '{sum += $2} END {print sum}')
TOTAL_CHANGES=$((ADDITIONS + DELETIONS))
echo "additions=$ADDITIONS" >> $GITHUB_OUTPUT
echo "deletions=$DELETIONS" >> $GITHUB_OUTPUT
echo "total=$TOTAL_CHANGES" >> $GITHUB_OUTPUT
# Determine size category
if [ $TOTAL_CHANGES -lt 50 ]; then
echo "size=XS" >> $GITHUB_OUTPUT
elif [ $TOTAL_CHANGES -lt 200 ]; then
echo "size=S" >> $GITHUB_OUTPUT
elif [ $TOTAL_CHANGES -lt 500 ]; then
echo "size=M" >> $GITHUB_OUTPUT
elif [ $TOTAL_CHANGES -lt 1000 ]; then
echo "size=L" >> $GITHUB_OUTPUT
elif [ $TOTAL_CHANGES -lt 2000 ]; then
echo "size=XL" >> $GITHUB_OUTPUT
else
echo "size=XXL" >> $GITHUB_OUTPUT
fi
- name: PR size summary
run: |
echo "✅ PR Size Analysis Complete"
echo "📊 Changes: +${{ steps.pr-size.outputs.additions }} -${{ steps.pr-size.outputs.deletions }}"
echo "📏 Size Category: ${{ steps.pr-size.outputs.size }}"
echo "💡 This information helps reviewers understand the scope of changes"
if [ "${{ steps.pr-size.outputs.size }}" = "XXL" ]; then
echo "ℹ️ This is a large PR - consider breaking it into smaller chunks for future PRs"
echo "However, large PRs are acceptable for major feature additions like this one"
fi