@maxoperf/cli 0.0.0-stage → 1.2.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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +90 -2
  3. package/dist/maxoperf.js +21575 -0
  4. package/package.json +41 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) MaxoPerf
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,91 @@
1
- # Temporary Holding Version
1
+ # @maxoperf/cli
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Keep MaxoPerf performance tests as code in git. `maxoperf push` mirrors the test files in your repo to MaxoPerf;
4
+ `maxoperf run` does the same, then starts each test, waits and gates your pipeline on the result.
5
+
6
+ Requires Node 20+. Runs from any CI (GitHub Actions, GitLab CI, Jenkins, CircleCI, Bitbucket Pipelines) or a laptop.
7
+
8
+ ```sh
9
+ npx @maxoperf/cli push
10
+ npx @maxoperf/cli run --config TARGET_URL=https://staging.example.com
11
+ ```
12
+
13
+ ## Configuration
14
+
15
+ | Env | |
16
+ | --- | --- |
17
+ | `MAXOPERF_API_KEY` | required, an API key (keep it in your CI secret store) |
18
+ | `MAXOPERF_ACCOUNT_ID` | required |
19
+ | `MAXOPERF_PROJECT_ID` | default project (`--project` and the file's `projectId` win) |
20
+ | `MAXOPERF_API_BASE` | default `https://app.maxoperf.com` |
21
+
22
+ ```text
23
+ maxoperf push [--tests <glob>]... [--project prj-...] [--root .] [--json] [--api-base URL]
24
+ maxoperf run [push flags] [--test-id ID]... [--tag T]... [--no-apply] [--config KEY=VALUE]... [--no-wait] [--fail-on criteria|never] [--timeout 60]
25
+ maxoperf delete <test|run|pdc|team> <id>
26
+ ```
27
+
28
+ `--tests` defaults to every resource under `.maxoperf/`; point it at one file to sync/run a single test.
29
+ `run` applies the dependency closure of the selected repo tests first (`--no-apply` skips it); `--test-id`/`--tag` (or a `maxoperf://test/...` URI) start tests that already exist in MaxoPerf, a tag matching ANY of the given tags. `run` never prunes.
30
+ `delete <test|run|pdc|team> <id>` soft-deletes one entity by id with no `--yes` (exit 0 ok, 2 usage, 3 API/network error such as a 409 with its code); `delete <resource-kind> <name|id> --yes` deletes any resource kind.
31
+ `--config KEY=VALUE` overrides a config value for this run only. Runs execute one after another.
32
+
33
+ ## Test file (`.maxoperf/tests/checkout.yml`)
34
+
35
+ ```yaml
36
+ version: 1
37
+ name: "Checkout soak" # the key: unique per project
38
+ projectId: "prj-0123456789" # optional if --project / MAXOPERF_PROJECT_ID is set
39
+ engineKind: "k6"
40
+ entrypoint: "perf/checkout/script.js" # repo-root-relative
41
+ assets: ["perf/checkout/users.csv"]
42
+ loadProfile: { virtualUsers: 50, agentCount: 1, rampUpSeconds: 30, durationSeconds: 300, maxVirtualUsersPerRunner: 25 }
43
+ locationPlan: # or privateDatacenterId: "pdc-..."
44
+ rows: [{ kind: managed, cloudProvider: aws, region: us-east-1, runnerCount: 2, weight: 1 }]
45
+ failureCriteria:
46
+ - { subject: "p95", condition: ">", threshold: 800, unit: "ms" }
47
+ failureCriteriaSettings: { scriptThresholds: copy } # optional, k6 / Taurus YAML: copy | ignore thresholds written in the script (once synced k6 runs --no-thresholds; a test that has never synced keeps k6's own thresholds; setting it syncs it)
48
+ tags: ["smoke"]
49
+ config: ["TARGET_URL"] # workspace config values to bind, by key
50
+ secrets: ["CHECKOUT_API_TOKEN"] # workspace secrets to bind, by key
51
+ ```
52
+
53
+ `failureCriteriaSettings.scriptThresholds` decides whether thresholds in the uploaded script are copied into the test's failure criteria
54
+ (`copy`) or not (`ignore`). Criteria copied from the script are kept on every push (they are not part of
55
+ `failureCriteria` in the file). Older CLI versions send the full criteria list and delete those copies, and reject
56
+ a file that contains `failureCriteriaSettings` — upgrade before adding the key.
57
+
58
+ Unknown keys are an error. Git is the source of truth: on every sync the test's config is overwritten with the
59
+ file, bindings are replaced with exactly the listed keys (console-set aliases are dropped), files not listed are
60
+ deleted, and unchanged files (same sha256) are not re-uploaded. Do not start runs of a test while a `push` of it is
61
+ in flight. If you fan out a CI matrix, run `push` once in an earlier job, then run the matrix with `needs: push`;
62
+ concurrent first-time pushes can create duplicate tests, and a later sync refuses duplicate names.
63
+
64
+ ## CI snippets
65
+
66
+ ```yaml
67
+ # GitHub Actions
68
+ - run: npx @maxoperf/cli run
69
+ env: { MAXOPERF_API_KEY: ${{ secrets.MAXOPERF_API_KEY }}, MAXOPERF_ACCOUNT_ID: acc-..., MAXOPERF_PROJECT_ID: prj-... }
70
+
71
+ # GitLab CI
72
+ perf: { image: node:22, script: [npx @maxoperf/cli run] } # set the variables in CI/CD settings
73
+
74
+ # Jenkins: sh 'npx @maxoperf/cli run' (withCredentials for MAXOPERF_API_KEY)
75
+ # CircleCI: - run: npx @maxoperf/cli run
76
+ # Bitbucket: script: [npx @maxoperf/cli run]
77
+ ```
78
+
79
+ The CI provider, repository, commit, branch, PR and run URL are detected and attached to each run.
80
+
81
+ ## Exit codes
82
+
83
+ | | |
84
+ | --- | --- |
85
+ | 0 | success / all runs passed |
86
+ | 1 | a run failed or was cancelled (`--fail-on criteria`) |
87
+ | 2 | usage, test file or validation error |
88
+ | 3 | API/network error, run start blocked, or timeout |
89
+
90
+ `--json` prints one JSON document on stdout (progress goes to stderr). The API key and presigned upload URLs are
91
+ never printed.