@codyswann/lisa 1.12.0 → 1.12.1
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.
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
"force": {
|
|
3
3
|
"scripts": {
|
|
4
4
|
"watch": "tsc -w",
|
|
5
|
-
"cdk": "cdk"
|
|
5
|
+
"cdk": "cdk",
|
|
6
|
+
"build": "tsc --noEmit"
|
|
6
7
|
},
|
|
7
8
|
"dependencies": {
|
|
8
9
|
"@aws-cdk/aws-amplify-alpha": "^2.235.0-alpha.0",
|
|
9
10
|
"aws-cdk-github-oidc": "^2.4.1",
|
|
10
11
|
"aws-cdk-lib": "2.235.0",
|
|
11
12
|
"constructs": "^10.4.5",
|
|
12
|
-
"lodash": "^4.17.21",
|
|
13
13
|
"source-map-support": "^0.5.21"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"aws-cdk": "2.
|
|
16
|
+
"aws-cdk": "^2.1104.0"
|
|
17
17
|
},
|
|
18
18
|
"bin": {
|
|
19
19
|
"infrastructure": "bin/infrastructure.js"
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"knip:fix": "knip --fix",
|
|
19
19
|
"sg:scan": "ast-grep scan",
|
|
20
20
|
"build": "tsc",
|
|
21
|
-
"prepare": "
|
|
21
|
+
"prepare": "$npm_execpath run build || husky install || true",
|
|
22
22
|
"lisa:update": "npx @codyswann/lisa@latest .",
|
|
23
23
|
"start": "node dist/index.js",
|
|
24
24
|
"dev": "tsx src/index.ts",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
},
|
|
75
75
|
"resolutions": {},
|
|
76
76
|
"name": "@codyswann/lisa",
|
|
77
|
-
"version": "1.12.
|
|
77
|
+
"version": "1.12.1",
|
|
78
78
|
"description": "Claude Code governance framework that applies guardrails, guidance, and automated enforcement to projects",
|
|
79
79
|
"main": "dist/index.js",
|
|
80
80
|
"bin": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"knip:fix": "knip --fix",
|
|
16
16
|
"sg:scan": "ast-grep scan",
|
|
17
17
|
"build": "tsc",
|
|
18
|
-
"prepare": "
|
|
18
|
+
"prepare": "$npm_execpath run build || husky install || true",
|
|
19
19
|
"lisa:update": "npx @codyswann/lisa@latest ."
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
# K6 Load Testing Workflow
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
The `k6-load-test.yml` is a reusable GitHub Actions workflow designed to run k6 performance tests as part of your CI/CD pipeline. It supports multiple test scenarios, flexible configuration, and both local and cloud execution.
|
|
6
|
-
|
|
7
|
-
## Quick Start
|
|
8
|
-
|
|
9
|
-
```yaml
|
|
10
|
-
name: Deploy and Test
|
|
11
|
-
on:
|
|
12
|
-
push:
|
|
13
|
-
branches: [main]
|
|
14
|
-
|
|
15
|
-
jobs:
|
|
16
|
-
deploy:
|
|
17
|
-
# Your deployment steps
|
|
18
|
-
|
|
19
|
-
performance-test:
|
|
20
|
-
needs: deploy
|
|
21
|
-
uses: ./.github/workflows/k6-load-test.yml
|
|
22
|
-
with:
|
|
23
|
-
environment: production
|
|
24
|
-
test_scenario: smoke
|
|
25
|
-
base_url: https://api.example.com
|
|
26
|
-
secrets: inherit
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## Workflow Inputs
|
|
30
|
-
|
|
31
|
-
| Input | Type | Required | Default | Description |
|
|
32
|
-
|-------|------|----------|---------|-------------|
|
|
33
|
-
| `environment` | string | Yes | - | Target environment (staging, production) |
|
|
34
|
-
| `test_scenario` | string | No | smoke | Test type: smoke, load, stress, spike, soak |
|
|
35
|
-
| `base_url` | string | Yes | - | Base URL of application to test |
|
|
36
|
-
| `k6_version` | string | No | latest | k6 version to use |
|
|
37
|
-
| `test_duration` | string | No | - | Override test duration (e.g., 5m, 1h) |
|
|
38
|
-
| `virtual_users` | number | No | - | Override number of virtual users |
|
|
39
|
-
| `thresholds_config` | string | No | - | Path to custom thresholds JSON |
|
|
40
|
-
| `test_script` | string | No | .github/k6/scripts/default-test.js | Path to k6 test script |
|
|
41
|
-
| `fail_on_threshold` | boolean | No | true | Fail workflow if thresholds not met |
|
|
42
|
-
| `upload_results` | boolean | No | true | Upload test results as artifacts |
|
|
43
|
-
| `cloud_run` | boolean | No | false | Run tests on k6 Cloud |
|
|
44
|
-
|
|
45
|
-
## Workflow Outputs
|
|
46
|
-
|
|
47
|
-
| Output | Description |
|
|
48
|
-
|--------|-------------|
|
|
49
|
-
| `test_passed` | Whether the test passed all thresholds (true/false) |
|
|
50
|
-
| `results_url` | URL to test results artifact |
|
|
51
|
-
| `summary` | Test execution summary |
|
|
52
|
-
|
|
53
|
-
## Workflow Secrets
|
|
54
|
-
|
|
55
|
-
| Secret | Required | Description |
|
|
56
|
-
|--------|----------|-------------|
|
|
57
|
-
| `K6_CLOUD_TOKEN` | No | k6 Cloud API token for cloud runs |
|
|
58
|
-
| `CUSTOM_HEADERS` | No | Custom headers for authenticated endpoints (JSON) |
|
|
59
|
-
|
|
60
|
-
## Test Scenarios
|
|
61
|
-
|
|
62
|
-
### Available Scenarios
|
|
63
|
-
|
|
64
|
-
- **smoke**: Quick validation (1 min, 1 VU)
|
|
65
|
-
- **load**: Normal traffic (9 min, 10 VUs)
|
|
66
|
-
- **stress**: Find breaking points (33 min, up to 200 VUs)
|
|
67
|
-
- **spike**: Sudden traffic changes (8 min, 5→100→5 VUs)
|
|
68
|
-
- **soak**: Extended duration (30+ min, 10 VUs)
|
|
69
|
-
|
|
70
|
-
### Selecting a Scenario
|
|
71
|
-
|
|
72
|
-
See the [Scenario Selection Guide](../k6/SCENARIO_SELECTION_GUIDE.md) for detailed guidance.
|
|
73
|
-
|
|
74
|
-
## Authentication
|
|
75
|
-
|
|
76
|
-
For testing protected endpoints:
|
|
77
|
-
|
|
78
|
-
```yaml
|
|
79
|
-
uses: ./.github/workflows/k6-load-test.yml
|
|
80
|
-
with:
|
|
81
|
-
base_url: https://api.example.com
|
|
82
|
-
secrets:
|
|
83
|
-
CUSTOM_HEADERS: |
|
|
84
|
-
{
|
|
85
|
-
"Authorization": "Bearer ${{ secrets.API_TOKEN }}",
|
|
86
|
-
"X-API-Key": "${{ secrets.API_KEY }}"
|
|
87
|
-
}
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## Custom Test Scripts
|
|
91
|
-
|
|
92
|
-
Use your own test script:
|
|
93
|
-
|
|
94
|
-
```yaml
|
|
95
|
-
with:
|
|
96
|
-
test_script: .github/k6/scripts/my-custom-test.js
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
## Custom Thresholds
|
|
100
|
-
|
|
101
|
-
Use environment-specific thresholds:
|
|
102
|
-
|
|
103
|
-
```yaml
|
|
104
|
-
with:
|
|
105
|
-
thresholds_config: .github/k6/thresholds/production.json
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
## k6 Cloud Integration
|
|
109
|
-
|
|
110
|
-
For high-concurrency tests:
|
|
111
|
-
|
|
112
|
-
```yaml
|
|
113
|
-
uses: ./.github/workflows/k6-load-test.yml
|
|
114
|
-
with:
|
|
115
|
-
cloud_run: true
|
|
116
|
-
secrets:
|
|
117
|
-
K6_CLOUD_TOKEN: ${{ secrets.K6_CLOUD_TOKEN }}
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
## Artifacts
|
|
121
|
-
|
|
122
|
-
Test results are automatically uploaded as artifacts including:
|
|
123
|
-
- JSON results (`results.json`)
|
|
124
|
-
- CSV results (`results.csv`)
|
|
125
|
-
- HTML report (`report.html`)
|
|
126
|
-
- Scenario-specific summaries
|
|
127
|
-
|
|
128
|
-
Artifacts are retained for 30 days.
|
|
129
|
-
|
|
130
|
-
## Error Handling
|
|
131
|
-
|
|
132
|
-
The workflow handles various error scenarios:
|
|
133
|
-
- Base URL not accessible
|
|
134
|
-
- Test script not found
|
|
135
|
-
- Threshold failures
|
|
136
|
-
- k6 installation issues
|
|
137
|
-
|
|
138
|
-
See the [Troubleshooting Guide](../k6/INTEGRATION_GUIDE.md#troubleshooting) for solutions.
|
|
139
|
-
|
|
140
|
-
## Integration Patterns
|
|
141
|
-
|
|
142
|
-
For comprehensive integration examples, see the [Integration Guide](../k6/INTEGRATION_GUIDE.md).
|
|
143
|
-
|
|
144
|
-
### Integration with Release and Deployment Workflows
|
|
145
|
-
|
|
146
|
-
The k6 load testing workflow is designed to integrate seamlessly with your release and deployment processes. Here's the recommended pattern:
|
|
147
|
-
|
|
148
|
-
```yaml
|
|
149
|
-
# deploy.yml.example - Complete release and deployment with load testing
|
|
150
|
-
name: 🚀 Release and Deploy
|
|
151
|
-
|
|
152
|
-
on:
|
|
153
|
-
push:
|
|
154
|
-
branches: [main, staging, dev]
|
|
155
|
-
|
|
156
|
-
jobs:
|
|
157
|
-
# Step 1: Create a release
|
|
158
|
-
release:
|
|
159
|
-
uses: ./.github/workflows/release.yml
|
|
160
|
-
with:
|
|
161
|
-
environment: ${{ github.ref_name }}
|
|
162
|
-
# ... other inputs
|
|
163
|
-
|
|
164
|
-
# Step 2: Deploy to your infrastructure
|
|
165
|
-
deploy:
|
|
166
|
-
needs: release
|
|
167
|
-
runs-on: ubuntu-latest
|
|
168
|
-
outputs:
|
|
169
|
-
environment_url: ${{ steps.deploy.outputs.environment_url }}
|
|
170
|
-
steps:
|
|
171
|
-
# Your deployment logic here
|
|
172
|
-
|
|
173
|
-
# Step 3: Run load tests (staging only)
|
|
174
|
-
load_testing:
|
|
175
|
-
needs: [release, deploy]
|
|
176
|
-
if: |
|
|
177
|
-
needs.deploy.result == 'success' &&
|
|
178
|
-
github.ref_name == 'staging'
|
|
179
|
-
uses: ./.github/workflows/load-test.yml
|
|
180
|
-
with:
|
|
181
|
-
environment: staging
|
|
182
|
-
test_scenario: smoke
|
|
183
|
-
base_url: ${{ needs.deploy.outputs.environment_url }}
|
|
184
|
-
fail_on_threshold: false # Don't fail the deployment
|
|
185
|
-
secrets: inherit
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
This pattern ensures:
|
|
189
|
-
- Releases are created first with proper versioning
|
|
190
|
-
- Deployments happen after successful releases
|
|
191
|
-
- Load tests run automatically for staging deployments
|
|
192
|
-
- Production deployments skip load testing (run manually if needed)
|
|
193
|
-
|
|
194
|
-
## File Structure
|
|
195
|
-
|
|
196
|
-
```
|
|
197
|
-
.github/
|
|
198
|
-
├── workflows/
|
|
199
|
-
│ └── k6-load-test.yml # This workflow
|
|
200
|
-
└── k6/
|
|
201
|
-
├── scripts/ # Test scripts
|
|
202
|
-
├── scenarios/ # Scenario configs
|
|
203
|
-
├── thresholds/ # Threshold configs
|
|
204
|
-
└── examples/ # Usage examples
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
## Workflow Steps
|
|
208
|
-
|
|
209
|
-
1. **Checkout**: Get repository code
|
|
210
|
-
2. **Setup k6**: Install specified k6 version
|
|
211
|
-
3. **Prepare Environment**: Set up test variables
|
|
212
|
-
4. **Run Test**: Execute k6 with parameters
|
|
213
|
-
5. **Generate Summary**: Create test report
|
|
214
|
-
6. **Upload Results**: Store artifacts
|
|
215
|
-
7. **Comment on PR**: Add results to PR (if applicable)
|
|
216
|
-
|
|
217
|
-
## Best Practices
|
|
218
|
-
|
|
219
|
-
1. Start with smoke tests
|
|
220
|
-
2. Use appropriate scenarios per environment
|
|
221
|
-
3. Set realistic thresholds
|
|
222
|
-
4. Monitor resource usage during tests
|
|
223
|
-
5. Review results regularly
|
|
224
|
-
6. Update tests as application evolves
|
|
225
|
-
|
|
226
|
-
## Support
|
|
227
|
-
|
|
228
|
-
- [k6 Documentation](https://k6.io/docs/)
|
|
229
|
-
- [GitHub Actions Documentation](https://docs.github.com/en/actions)
|
|
230
|
-
- Project-specific guides in `.github/k6/`
|
|
File without changes
|