@vyuhlabs/dxkit 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +173 -0
- package/dist/cli.js.map +1 -0
- package/dist/codebase-scanner.d.ts +33 -0
- package/dist/codebase-scanner.d.ts.map +1 -0
- package/dist/codebase-scanner.js +497 -0
- package/dist/codebase-scanner.js.map +1 -0
- package/dist/constants.d.ts +17 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +80 -0
- package/dist/constants.js.map +1 -0
- package/dist/detect.d.ts +3 -0
- package/dist/detect.d.ts.map +1 -0
- package/dist/detect.js +264 -0
- package/dist/detect.js.map +1 -0
- package/dist/doctor.d.ts +2 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +157 -0
- package/dist/doctor.js.map +1 -0
- package/dist/files.d.ts +17 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +99 -0
- package/dist/files.js.map +1 -0
- package/dist/generator.d.ts +10 -0
- package/dist/generator.d.ts.map +1 -0
- package/dist/generator.js +405 -0
- package/dist/generator.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +9 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +51 -0
- package/dist/logger.js.map +1 -0
- package/dist/prompts.d.ts +10 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +125 -0
- package/dist/prompts.js.map +1 -0
- package/dist/template-engine.d.ts +22 -0
- package/dist/template-engine.d.ts.map +1 -0
- package/dist/template-engine.js +63 -0
- package/dist/template-engine.js.map +1 -0
- package/dist/types.d.ts +68 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/update.d.ts +2 -0
- package/dist/update.d.ts.map +1 -0
- package/dist/update.js +97 -0
- package/dist/update.js.map +1 -0
- package/package.json +43 -0
- package/templates/.ai/README.md +117 -0
- package/templates/.ai/prompts/execution-prompt.md +9 -0
- package/templates/.ai/prompts/planning-prompt.md +18 -0
- package/templates/.ai/prompts/session-end-template.md +182 -0
- package/templates/.ai/prompts/session-end.md +132 -0
- package/templates/.ai/prompts/session-start.md +109 -0
- package/templates/.ai/prompts/step-by-step.md +113 -0
- package/templates/.ai/sessions/.gitkeep +0 -0
- package/templates/.ai/templates/session-checkpoint-template.md +97 -0
- package/templates/.claude/agents/knowledge-bot.md +62 -0
- package/templates/.claude/agents/onboarding.md +61 -0
- package/templates/.claude/agents/quality-reviewer.md +85 -0
- package/templates/.claude/agents-available/code-reviewer.md +29 -0
- package/templates/.claude/agents-available/codebase-explorer.md +99 -0
- package/templates/.claude/agents-available/debugger.md +29 -0
- package/templates/.claude/agents-available/knowledge-bot.md +62 -0
- package/templates/.claude/agents-available/test-writer.md +34 -0
- package/templates/.claude/commands/ask.md +7 -0
- package/templates/.claude/commands/check.md.template +55 -0
- package/templates/.claude/commands/doctor.md +21 -0
- package/templates/.claude/commands/enable-agent.md +12 -0
- package/templates/.claude/commands/explore-codebase.md +12 -0
- package/templates/.claude/commands/fix-issue.md +12 -0
- package/templates/.claude/commands/fix.md.template +32 -0
- package/templates/.claude/commands/help.md +36 -0
- package/templates/.claude/commands/learn.md +48 -0
- package/templates/.claude/commands/onboarding.md +21 -0
- package/templates/.claude/commands/quality.md.template +42 -0
- package/templates/.claude/commands/session-end.md +40 -0
- package/templates/.claude/commands/session-start.md +30 -0
- package/templates/.claude/commands/setup-hooks.md +60 -0
- package/templates/.claude/commands/test.md.template +49 -0
- package/templates/.claude/rules/csharp.md +18 -0
- package/templates/.claude/rules/go.md +16 -0
- package/templates/.claude/rules/nextjs.md +17 -0
- package/templates/.claude/rules/python.md +19 -0
- package/templates/.claude/rules/rust.md +14 -0
- package/templates/.claude/skills/build/SKILL.md.template +98 -0
- package/templates/.claude/skills/deploy/SKILL.md.template +131 -0
- package/templates/.claude/skills/deploy/references/gotchas.md +5 -0
- package/templates/.claude/skills/doctor/SKILL.md +54 -0
- package/templates/.claude/skills/gcloud/SKILL.md +61 -0
- package/templates/.claude/skills/gcloud/references/gotchas.md +5 -0
- package/templates/.claude/skills/learned/SKILL.md +55 -0
- package/templates/.claude/skills/learned/references/conventions.md +11 -0
- package/templates/.claude/skills/learned/references/deny-recommendations.md +18 -0
- package/templates/.claude/skills/learned/references/gotchas.md +11 -0
- package/templates/.claude/skills/pulumi/SKILL.md +67 -0
- package/templates/.claude/skills/quality/SKILL.md.template +108 -0
- package/templates/.claude/skills/quality/references/gotchas.md +5 -0
- package/templates/.claude/skills/review/SKILL.md.template +73 -0
- package/templates/.claude/skills/scaffold/SKILL.md.template +123 -0
- package/templates/.claude/skills/secrets/SKILL.md +45 -0
- package/templates/.claude/skills/session/SKILL.md +43 -0
- package/templates/.claude/skills/test/SKILL.md.template +109 -0
- package/templates/.claude/skills/test/references/gotchas.md +5 -0
- package/templates/.devcontainer/Dockerfile.dev.template +89 -0
- package/templates/.devcontainer/devcontainer.json.template +184 -0
- package/templates/.devcontainer/docker-compose.yml.template +105 -0
- package/templates/.devcontainer/init-scripts/01-init.sql.template +12 -0
- package/templates/.devcontainer/post-create.sh.template +298 -0
- package/templates/.github/workflows/ci.yml.template +399 -0
- package/templates/.github/workflows/quality.yml.template +376 -0
- package/templates/.pre-commit-config.yaml.template +106 -0
- package/templates/.project/config/edit_config.py +275 -0
- package/templates/.project/config/project_config.py +894 -0
- package/templates/.project/scripts/codegen/generate-all.sh +20 -0
- package/templates/.project/scripts/codegen/validate-all.sh +17 -0
- package/templates/.project/scripts/docs/generate-all.sh +30 -0
- package/templates/.project/scripts/docs/serve.sh +20 -0
- package/templates/.project/scripts/quality/fix-all.sh +138 -0
- package/templates/.project/scripts/quality/lint-go.sh +34 -0
- package/templates/.project/scripts/quality/lint-python.sh +54 -0
- package/templates/.project/scripts/quality/run-all.sh +497 -0
- package/templates/.project/scripts/session/commit.sh +70 -0
- package/templates/.project/scripts/session/create-pr.sh +165 -0
- package/templates/.project/scripts/session/end.sh +207 -0
- package/templates/.project/scripts/session/start.sh +233 -0
- package/templates/.project/scripts/setup/doctor.sh +404 -0
- package/templates/.project/scripts/setup/interactive-setup.sh +581 -0
- package/templates/.project/scripts/sync/sync-template.sh +328 -0
- package/templates/.project/scripts/test/run-all.sh +179 -0
- package/templates/.project/scripts/test/run-quick.sh +25 -0
- package/templates/CLAUDE.md.template +228 -0
- package/templates/Makefile +514 -0
- package/templates/config/versions.yaml +57 -0
- package/templates/configs/go/.golangci.yml.template +172 -0
- package/templates/configs/go/go.mod.template +15 -0
- package/templates/configs/node/package.json.template +67 -0
- package/templates/configs/node/tsconfig.json.template +53 -0
- package/templates/configs/python/pyproject.toml.template +92 -0
- package/templates/configs/python/pytest.ini.template +64 -0
- package/templates/configs/python/ruff.toml.template +79 -0
- package/templates/configs/rust/Cargo.toml.template +51 -0
- package/templates/configs/shared/.editorconfig +67 -0
- package/templates/scripts/validate-templates.sh +449 -0
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
# Generated from template - CI/CD Pipeline
|
|
2
|
+
# This workflow runs tests for all enabled languages
|
|
3
|
+
# Configuration is loaded from .project.yaml via project_config.py
|
|
4
|
+
|
|
5
|
+
name: CI Pipeline
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
branches: [main, develop]
|
|
10
|
+
pull_request:
|
|
11
|
+
branches: [main, develop]
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
# Validate project configuration exists
|
|
15
|
+
validate:
|
|
16
|
+
name: Validate Configuration
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- name: Checkout code
|
|
20
|
+
uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Validate .project.yaml exists
|
|
23
|
+
run: |
|
|
24
|
+
if [ ! -f ".project.yaml" ]; then
|
|
25
|
+
echo "::error::Missing .project.yaml - run 'make init' or bootstrap the project"
|
|
26
|
+
exit 1
|
|
27
|
+
fi
|
|
28
|
+
echo "✓ .project.yaml found"
|
|
29
|
+
|
|
30
|
+
- name: Set up Python for config
|
|
31
|
+
uses: actions/setup-python@v5
|
|
32
|
+
with:
|
|
33
|
+
python-version: "3.12"
|
|
34
|
+
|
|
35
|
+
- name: Install PyYAML
|
|
36
|
+
run: pip install pyyaml
|
|
37
|
+
|
|
38
|
+
- name: Validate configuration
|
|
39
|
+
run: |
|
|
40
|
+
python3 .project/config/project_config.py info
|
|
41
|
+
echo ""
|
|
42
|
+
echo "Configuration validated successfully"
|
|
43
|
+
|
|
44
|
+
{{#IF_PYTHON}}
|
|
45
|
+
test-python:
|
|
46
|
+
name: Python {{PYTHON_VERSION}} Tests
|
|
47
|
+
runs-on: ubuntu-latest
|
|
48
|
+
needs: validate
|
|
49
|
+
|
|
50
|
+
steps:
|
|
51
|
+
- name: Checkout code
|
|
52
|
+
uses: actions/checkout@v4
|
|
53
|
+
|
|
54
|
+
- name: Set up Python {{PYTHON_VERSION}}
|
|
55
|
+
uses: actions/setup-python@v5
|
|
56
|
+
with:
|
|
57
|
+
python-version: "{{PYTHON_VERSION}}"
|
|
58
|
+
cache: 'pip'
|
|
59
|
+
|
|
60
|
+
- name: Install dependencies
|
|
61
|
+
run: |
|
|
62
|
+
python -m pip install --upgrade pip
|
|
63
|
+
pip install pyyaml # For config loading
|
|
64
|
+
if [ -f pyproject.toml ]; then
|
|
65
|
+
pip install -e .[dev]
|
|
66
|
+
elif [ -f requirements.txt ]; then
|
|
67
|
+
pip install -r requirements.txt
|
|
68
|
+
fi
|
|
69
|
+
if [ -f requirements-dev.txt ]; then
|
|
70
|
+
pip install -r requirements-dev.txt
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
- name: Load quality configuration
|
|
74
|
+
id: quality
|
|
75
|
+
run: |
|
|
76
|
+
# Load from .project.yaml via project_config.py (primary source)
|
|
77
|
+
if [ -f .project/config/project_config.py ]; then
|
|
78
|
+
eval "$(python3 .project/config/project_config.py export python)"
|
|
79
|
+
echo "coverage_threshold=${PYTHON_COVERAGE_THRESHOLD:-{{COVERAGE_THRESHOLD}}}" >> $GITHUB_OUTPUT
|
|
80
|
+
echo "lint_enabled=${PYTHON_LINT_ENABLED:-true}" >> $GITHUB_OUTPUT
|
|
81
|
+
# Fallback to legacy .quality.env
|
|
82
|
+
elif [ -f .quality.env ]; then
|
|
83
|
+
source .quality.env
|
|
84
|
+
echo "coverage_threshold=${COVERAGE_THRESHOLD:-{{COVERAGE_THRESHOLD}}}" >> $GITHUB_OUTPUT
|
|
85
|
+
echo "lint_enabled=true" >> $GITHUB_OUTPUT
|
|
86
|
+
else
|
|
87
|
+
echo "coverage_threshold={{COVERAGE_THRESHOLD}}" >> $GITHUB_OUTPUT
|
|
88
|
+
echo "lint_enabled=true" >> $GITHUB_OUTPUT
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
- name: Run tests with pytest
|
|
92
|
+
run: |
|
|
93
|
+
THRESHOLD=${{ steps.quality.outputs.coverage_threshold }}
|
|
94
|
+
if [ "$THRESHOLD" = "0" ]; then
|
|
95
|
+
pytest --cov=. --cov-report=xml --cov-report=term
|
|
96
|
+
else
|
|
97
|
+
pytest --cov=. --cov-report=xml --cov-report=term --cov-fail-under=$THRESHOLD
|
|
98
|
+
fi
|
|
99
|
+
|
|
100
|
+
- name: Upload coverage to Codecov
|
|
101
|
+
uses: codecov/codecov-action@v3
|
|
102
|
+
with:
|
|
103
|
+
file: ./coverage.xml
|
|
104
|
+
flags: python
|
|
105
|
+
name: python-{{PYTHON_VERSION}}
|
|
106
|
+
|
|
107
|
+
{{/IF_PYTHON}}
|
|
108
|
+
{{#IF_GO}}
|
|
109
|
+
test-go:
|
|
110
|
+
name: Go {{GO_VERSION}} Tests
|
|
111
|
+
runs-on: ubuntu-latest
|
|
112
|
+
needs: validate
|
|
113
|
+
|
|
114
|
+
steps:
|
|
115
|
+
- name: Checkout code
|
|
116
|
+
uses: actions/checkout@v4
|
|
117
|
+
|
|
118
|
+
- name: Set up Go {{GO_VERSION}}
|
|
119
|
+
uses: actions/setup-go@v5
|
|
120
|
+
with:
|
|
121
|
+
go-version: "{{GO_VERSION}}"
|
|
122
|
+
cache: true
|
|
123
|
+
|
|
124
|
+
- name: Set up Python for config
|
|
125
|
+
uses: actions/setup-python@v5
|
|
126
|
+
with:
|
|
127
|
+
python-version: "3.12"
|
|
128
|
+
|
|
129
|
+
- name: Install PyYAML
|
|
130
|
+
run: pip install pyyaml
|
|
131
|
+
|
|
132
|
+
- name: Load quality configuration
|
|
133
|
+
id: quality
|
|
134
|
+
run: |
|
|
135
|
+
# Load from .project.yaml via project_config.py (primary source)
|
|
136
|
+
if [ -f .project/config/project_config.py ]; then
|
|
137
|
+
eval "$(python3 .project/config/project_config.py export go)"
|
|
138
|
+
echo "coverage_threshold=${GO_COVERAGE_THRESHOLD:-{{COVERAGE_THRESHOLD}}}" >> $GITHUB_OUTPUT
|
|
139
|
+
# Fallback to legacy .quality.env
|
|
140
|
+
elif [ -f .quality.env ]; then
|
|
141
|
+
source .quality.env
|
|
142
|
+
echo "coverage_threshold=${COVERAGE_THRESHOLD:-{{COVERAGE_THRESHOLD}}}" >> $GITHUB_OUTPUT
|
|
143
|
+
else
|
|
144
|
+
echo "coverage_threshold={{COVERAGE_THRESHOLD}}" >> $GITHUB_OUTPUT
|
|
145
|
+
fi
|
|
146
|
+
|
|
147
|
+
- name: Download dependencies
|
|
148
|
+
run: go mod download
|
|
149
|
+
|
|
150
|
+
- name: Run tests
|
|
151
|
+
run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
|
|
152
|
+
|
|
153
|
+
{{#IF_COVERAGE_ENABLED}}
|
|
154
|
+
- name: Check coverage threshold
|
|
155
|
+
run: |
|
|
156
|
+
THRESHOLD=${{ steps.quality.outputs.coverage_threshold }}
|
|
157
|
+
|
|
158
|
+
if [ "$THRESHOLD" = "0" ]; then
|
|
159
|
+
echo "Coverage check skipped (threshold=0)"
|
|
160
|
+
exit 0
|
|
161
|
+
fi
|
|
162
|
+
|
|
163
|
+
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print substr($3, 1, length($3)-1)}')
|
|
164
|
+
echo "Total coverage: ${COVERAGE}%"
|
|
165
|
+
echo "Required threshold: ${THRESHOLD}%"
|
|
166
|
+
if (( $(echo "$COVERAGE < $THRESHOLD" | bc -l) )); then
|
|
167
|
+
echo "Coverage ${COVERAGE}% is below threshold ${THRESHOLD}%"
|
|
168
|
+
exit 1
|
|
169
|
+
fi
|
|
170
|
+
echo "Coverage check passed!"
|
|
171
|
+
|
|
172
|
+
{{/IF_COVERAGE_ENABLED}}
|
|
173
|
+
- name: Upload coverage to Codecov
|
|
174
|
+
uses: codecov/codecov-action@v3
|
|
175
|
+
with:
|
|
176
|
+
file: ./coverage.out
|
|
177
|
+
flags: go
|
|
178
|
+
name: go-{{GO_VERSION}}
|
|
179
|
+
|
|
180
|
+
{{/IF_GO}}
|
|
181
|
+
{{#IF_NODE}}
|
|
182
|
+
test-node:
|
|
183
|
+
name: Node.js {{NODE_VERSION}} Tests
|
|
184
|
+
runs-on: ubuntu-latest
|
|
185
|
+
needs: validate
|
|
186
|
+
|
|
187
|
+
steps:
|
|
188
|
+
- name: Checkout code
|
|
189
|
+
uses: actions/checkout@v4
|
|
190
|
+
|
|
191
|
+
- name: Set up Node.js {{NODE_VERSION}}
|
|
192
|
+
uses: actions/setup-node@v4
|
|
193
|
+
with:
|
|
194
|
+
node-version: "{{NODE_VERSION}}"
|
|
195
|
+
cache: 'npm'
|
|
196
|
+
|
|
197
|
+
- name: Set up Python for config
|
|
198
|
+
uses: actions/setup-python@v5
|
|
199
|
+
with:
|
|
200
|
+
python-version: "3.12"
|
|
201
|
+
|
|
202
|
+
- name: Install PyYAML
|
|
203
|
+
run: pip install pyyaml
|
|
204
|
+
|
|
205
|
+
- name: Load quality configuration
|
|
206
|
+
id: quality
|
|
207
|
+
run: |
|
|
208
|
+
# Load from .project.yaml via project_config.py (primary source)
|
|
209
|
+
if [ -f .project/config/project_config.py ]; then
|
|
210
|
+
eval "$(python3 .project/config/project_config.py export node)"
|
|
211
|
+
echo "coverage_threshold=${NODE_COVERAGE_THRESHOLD:-{{COVERAGE_THRESHOLD}}}" >> $GITHUB_OUTPUT
|
|
212
|
+
# Fallback to legacy .quality.env
|
|
213
|
+
elif [ -f .quality.env ]; then
|
|
214
|
+
source .quality.env
|
|
215
|
+
echo "coverage_threshold=${COVERAGE_THRESHOLD:-{{COVERAGE_THRESHOLD}}}" >> $GITHUB_OUTPUT
|
|
216
|
+
else
|
|
217
|
+
echo "coverage_threshold={{COVERAGE_THRESHOLD}}" >> $GITHUB_OUTPUT
|
|
218
|
+
fi
|
|
219
|
+
|
|
220
|
+
- name: Install dependencies
|
|
221
|
+
run: npm ci
|
|
222
|
+
|
|
223
|
+
- name: Run tests
|
|
224
|
+
run: |
|
|
225
|
+
THRESHOLD=${{ steps.quality.outputs.coverage_threshold }}
|
|
226
|
+
if [ "$THRESHOLD" = "0" ]; then
|
|
227
|
+
npm test -- --coverage
|
|
228
|
+
else
|
|
229
|
+
npm test -- --coverage --coverageThreshold='{"global":{"branches":'$THRESHOLD',"functions":'$THRESHOLD',"lines":'$THRESHOLD',"statements":'$THRESHOLD'}}'
|
|
230
|
+
fi
|
|
231
|
+
|
|
232
|
+
- name: Upload coverage to Codecov
|
|
233
|
+
uses: codecov/codecov-action@v3
|
|
234
|
+
with:
|
|
235
|
+
file: ./coverage/coverage-final.json
|
|
236
|
+
flags: node
|
|
237
|
+
name: node-{{NODE_VERSION}}
|
|
238
|
+
|
|
239
|
+
{{/IF_NODE}}
|
|
240
|
+
{{#IF_NEXTJS}}
|
|
241
|
+
build-nextjs:
|
|
242
|
+
name: Next.js Build & Test
|
|
243
|
+
runs-on: ubuntu-latest
|
|
244
|
+
needs: validate
|
|
245
|
+
defaults:
|
|
246
|
+
run:
|
|
247
|
+
working-directory: frontend
|
|
248
|
+
|
|
249
|
+
steps:
|
|
250
|
+
- name: Checkout code
|
|
251
|
+
uses: actions/checkout@v4
|
|
252
|
+
|
|
253
|
+
- name: Set up Node.js {{NODE_VERSION}}
|
|
254
|
+
uses: actions/setup-node@v4
|
|
255
|
+
with:
|
|
256
|
+
node-version: "{{NODE_VERSION}}"
|
|
257
|
+
cache: 'npm'
|
|
258
|
+
cache-dependency-path: frontend/package-lock.json
|
|
259
|
+
|
|
260
|
+
- name: Install dependencies
|
|
261
|
+
run: npm ci
|
|
262
|
+
|
|
263
|
+
- name: Run linting
|
|
264
|
+
run: npm run lint
|
|
265
|
+
|
|
266
|
+
- name: Run type checking
|
|
267
|
+
run: npx tsc --noEmit
|
|
268
|
+
|
|
269
|
+
- name: Build Next.js app
|
|
270
|
+
run: npm run build
|
|
271
|
+
env:
|
|
272
|
+
NEXT_TELEMETRY_DISABLED: 1
|
|
273
|
+
|
|
274
|
+
- name: Determine coverage threshold
|
|
275
|
+
id: quality
|
|
276
|
+
run: |
|
|
277
|
+
if [ -f "../.project.yaml" ]; then
|
|
278
|
+
echo "coverage_threshold=${NEXTJS_COVERAGE_THRESHOLD:-{{COVERAGE_THRESHOLD}}}" >> $GITHUB_OUTPUT
|
|
279
|
+
else
|
|
280
|
+
echo "coverage_threshold={{COVERAGE_THRESHOLD}}" >> $GITHUB_OUTPUT
|
|
281
|
+
fi
|
|
282
|
+
|
|
283
|
+
- name: Run tests with coverage
|
|
284
|
+
run: |
|
|
285
|
+
THRESHOLD=${{ steps.quality.outputs.coverage_threshold }}
|
|
286
|
+
if grep -q '"test"' package.json; then
|
|
287
|
+
{{#IF_COVERAGE_ENABLED}}
|
|
288
|
+
npm test -- --coverage --passWithNoTests --coverageThreshold='{"global":{"branches":'$THRESHOLD',"functions":'$THRESHOLD',"lines":'$THRESHOLD',"statements":'$THRESHOLD'}}'
|
|
289
|
+
{{#ELSE}}
|
|
290
|
+
npm test -- --passWithNoTests
|
|
291
|
+
{{/IF_COVERAGE_ENABLED}}
|
|
292
|
+
else
|
|
293
|
+
echo "No test script configured, skipping"
|
|
294
|
+
fi
|
|
295
|
+
|
|
296
|
+
{{#IF_COVERAGE_ENABLED}}
|
|
297
|
+
- name: Upload coverage to Codecov
|
|
298
|
+
uses: codecov/codecov-action@v4
|
|
299
|
+
with:
|
|
300
|
+
file: ./frontend/coverage/coverage-final.json
|
|
301
|
+
flags: nextjs
|
|
302
|
+
fail_ci_if_error: false
|
|
303
|
+
{{/IF_COVERAGE_ENABLED}}
|
|
304
|
+
|
|
305
|
+
{{/IF_NEXTJS}}
|
|
306
|
+
{{#IF_RUST}}
|
|
307
|
+
test-rust:
|
|
308
|
+
name: Rust {{RUST_VERSION}} Tests
|
|
309
|
+
runs-on: ubuntu-latest
|
|
310
|
+
needs: validate
|
|
311
|
+
|
|
312
|
+
steps:
|
|
313
|
+
- name: Checkout code
|
|
314
|
+
uses: actions/checkout@v4
|
|
315
|
+
|
|
316
|
+
- name: Set up Rust {{RUST_VERSION}}
|
|
317
|
+
uses: actions-rs/toolchain@v1
|
|
318
|
+
with:
|
|
319
|
+
toolchain: {{RUST_VERSION}}
|
|
320
|
+
override: true
|
|
321
|
+
components: rustfmt, clippy
|
|
322
|
+
|
|
323
|
+
- name: Set up Python for config
|
|
324
|
+
uses: actions/setup-python@v5
|
|
325
|
+
with:
|
|
326
|
+
python-version: "3.12"
|
|
327
|
+
|
|
328
|
+
- name: Install PyYAML
|
|
329
|
+
run: pip install pyyaml
|
|
330
|
+
|
|
331
|
+
- name: Load quality configuration
|
|
332
|
+
id: quality
|
|
333
|
+
run: |
|
|
334
|
+
# Load from .project.yaml via project_config.py (primary source)
|
|
335
|
+
if [ -f .project/config/project_config.py ]; then
|
|
336
|
+
eval "$(python3 .project/config/project_config.py export rust)"
|
|
337
|
+
echo "coverage_threshold=${RUST_COVERAGE_THRESHOLD:-{{COVERAGE_THRESHOLD}}}" >> $GITHUB_OUTPUT
|
|
338
|
+
# Fallback to legacy .quality.env
|
|
339
|
+
elif [ -f .quality.env ]; then
|
|
340
|
+
source .quality.env
|
|
341
|
+
echo "coverage_threshold=${COVERAGE_THRESHOLD:-{{COVERAGE_THRESHOLD}}}" >> $GITHUB_OUTPUT
|
|
342
|
+
else
|
|
343
|
+
echo "coverage_threshold={{COVERAGE_THRESHOLD}}" >> $GITHUB_OUTPUT
|
|
344
|
+
fi
|
|
345
|
+
|
|
346
|
+
- name: Cache cargo registry
|
|
347
|
+
uses: actions/cache@v3
|
|
348
|
+
with:
|
|
349
|
+
path: ~/.cargo/registry
|
|
350
|
+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
|
351
|
+
|
|
352
|
+
- name: Cache cargo index
|
|
353
|
+
uses: actions/cache@v3
|
|
354
|
+
with:
|
|
355
|
+
path: ~/.cargo/git
|
|
356
|
+
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
|
|
357
|
+
|
|
358
|
+
- name: Cache target directory
|
|
359
|
+
uses: actions/cache@v3
|
|
360
|
+
with:
|
|
361
|
+
path: target
|
|
362
|
+
key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.lock') }}
|
|
363
|
+
|
|
364
|
+
- name: Run tests
|
|
365
|
+
run: cargo test --verbose
|
|
366
|
+
|
|
367
|
+
- name: Generate coverage
|
|
368
|
+
run: |
|
|
369
|
+
cargo install cargo-tarpaulin
|
|
370
|
+
cargo tarpaulin --out Xml
|
|
371
|
+
{{#IF_COVERAGE_ENABLED}}
|
|
372
|
+
- name: Check coverage threshold
|
|
373
|
+
run: |
|
|
374
|
+
THRESHOLD=${{ steps.quality.outputs.coverage_threshold }}
|
|
375
|
+
|
|
376
|
+
if [ "$THRESHOLD" = "0" ]; then
|
|
377
|
+
echo "Coverage check skipped (threshold=0)"
|
|
378
|
+
exit 0
|
|
379
|
+
fi
|
|
380
|
+
|
|
381
|
+
COVERAGE=$(grep -oP 'line-rate="\K[^"]+' cobertura.xml | head -1)
|
|
382
|
+
COVERAGE_PCT=$(echo "$COVERAGE * 100" | bc)
|
|
383
|
+
echo "Total coverage: ${COVERAGE_PCT}%"
|
|
384
|
+
echo "Required threshold: ${THRESHOLD}%"
|
|
385
|
+
if (( $(echo "$COVERAGE_PCT < $THRESHOLD" | bc -l) )); then
|
|
386
|
+
echo "Coverage ${COVERAGE_PCT}% is below threshold ${THRESHOLD}%"
|
|
387
|
+
exit 1
|
|
388
|
+
fi
|
|
389
|
+
echo "Coverage check passed!"
|
|
390
|
+
{{/IF_COVERAGE_ENABLED}}
|
|
391
|
+
|
|
392
|
+
- name: Upload coverage to Codecov
|
|
393
|
+
uses: codecov/codecov-action@v3
|
|
394
|
+
with:
|
|
395
|
+
file: ./cobertura.xml
|
|
396
|
+
flags: rust
|
|
397
|
+
name: rust-{{RUST_VERSION}}
|
|
398
|
+
|
|
399
|
+
{{/IF_RUST}}
|