saga-ci 1.0.1 → 1.0.3
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/README.md +19 -52
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
# saga-ci
|
|
2
2
|
|
|
3
3
|
[](LICENSE)
|
|
4
|
-
[](package.json)
|
|
5
5
|
|
|
6
6
|
A lightweight, zero-dependency **Saga-pattern CI/CD workflow runner** for Node.js and TypeScript.
|
|
7
7
|
Wrap deployment and automation steps in a `do()` / `undo()` command contract, compose nested sequential or parallel execution groups, automatically roll back in reverse order on failure, and stream aligned status tables straight to `$GITHUB_STEP_SUMMARY`.
|
|
8
8
|
|
|
9
|
-
**Documentation Wiki & Live Simulator:** [https://thisispennyleung.github.io/saga-ci/](https://thisispennyleung.github.io/saga-ci/)
|
|
9
|
+
**Documentation Wiki & Live Simulator:** [https://thisispennyleung.github.io/saga-ci/](https://thisispennyleung.github.io/saga-ci/)
|
|
10
|
+
**Install:** `npm install saga-ci`
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
## Background
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
Splitting a deployment pipeline across native GitHub Actions jobs (`needs:`, `strategy.matrix`, `if: failure()`) quickly becomes slow and brittle when you need parallel fan-outs, conditional steps, or reliable rollbacks:
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Works with Node.js `>=18.0.0` (compiled ESM `.js` + `.d.ts` type declarations included).
|
|
16
|
+
- **Per-job startup overhead:** Every separate GitHub Actions job pays runner queue wait time, VM boot, `actions/checkout`, and toolchain/dependency setup—turning fine-grained parallel steps into minutes of waiting.
|
|
17
|
+
- **Awkward cross-job rollback:** GitHub Actions has no built-in Saga/compensation model; tracking which steps actually ran, skipping converged work, and unwinding partial failures across jobs requires passing outputs or artifacts and writing fragile `if: failure()` cleanup YAML.
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
`saga-ci` moves that orchestration inside a **single GitHub Actions job**. In one Node.js/TypeScript process, you get in-process async parallelism (`maxConcurrency`), conditional skipping (`shouldDo`), automatic reverse-order `undo()` rollback across sequential and parallel groups, and live Markdown status tables in `$GITHUB_STEP_SUMMARY`—without waiting on extra runners.
|
|
22
20
|
|
|
23
21
|
## Quick Start
|
|
24
22
|
|
|
@@ -72,8 +70,6 @@ workflow.registerParallel(
|
|
|
72
70
|
await workflow.run();
|
|
73
71
|
```
|
|
74
72
|
|
|
75
|
-
---
|
|
76
|
-
|
|
77
73
|
## Key Features
|
|
78
74
|
|
|
79
75
|
- **Reverse-Order Saga Rollback** — Automatically runs `undo()` on completed steps (and failed partial steps inside groups) in reverse order when a failure occurs.
|
|
@@ -82,8 +78,6 @@ await workflow.run();
|
|
|
82
78
|
- **Teardown / Audit Mode (`continueOnError`)** — Run all steps forward without rollback and throw a composite error at the end.
|
|
83
79
|
- **GitHub Actions `$GITHUB_STEP_SUMMARY`** — Automatically writes aligned Markdown status tables and `> [!CAUTION]` failure callouts on every state change.
|
|
84
80
|
|
|
85
|
-
---
|
|
86
|
-
|
|
87
81
|
## GitHub Step Summary Output
|
|
88
82
|
|
|
89
83
|
When `GITHUB_STEP_SUMMARY` is set in GitHub Actions, `CiWorkFlow` renders:
|
|
@@ -100,44 +94,17 @@ When `GITHUB_STEP_SUMMARY` is set in GitHub Actions, `CiWorkFlow` renders:
|
|
|
100
94
|
| 2.2 | [billing] Run Migrations | FAILED | REVERTED |
|
|
101
95
|
```
|
|
102
96
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
## Documentation
|
|
106
|
-
|
|
107
|
-
Browse the full **Wiki Documentation & Interactive Simulator**:
|
|
108
|
-
- [Overview & Concepts](https://thisispennyleung.github.io/saga-ci/#overview)
|
|
109
|
-
- [Getting Started](https://thisispennyleung.github.io/saga-ci/#getting-started)
|
|
110
|
-
- [Groups & Parallel Forks](https://thisispennyleung.github.io/saga-ci/#groups)
|
|
111
|
-
- [Rollback & Error Handling](https://thisispennyleung.github.io/saga-ci/#rollback)
|
|
112
|
-
- [API Reference](https://thisispennyleung.github.io/saga-ci/#api)
|
|
113
|
-
- [Interactive Simulator](https://thisispennyleung.github.io/saga-ci/#simulator)
|
|
114
|
-
|
|
115
|
-
---
|
|
116
|
-
|
|
117
|
-
## Development
|
|
118
|
-
|
|
119
|
-
```bash
|
|
120
|
-
npm run typecheck # Type-check src/ and examples/
|
|
121
|
-
npm run build # Compile dist/*.js and dist/*.d.ts
|
|
122
|
-
npm test # Run unit tests (31 tests, Node 24+)
|
|
123
|
-
npm run example:basic # Run basic release pipeline example
|
|
124
|
-
npm run example:rollback # Run parallel fork rollback example
|
|
125
|
-
npm run example:continue # Run continueOnError teardown example
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
## Releasing to npm
|
|
97
|
+
## Real GitHub Actions Demos (Before vs After)
|
|
129
98
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
1. Add your npm Automation/Granular Access Token as the `NPM_TOKEN` repository secret in GitHub.
|
|
133
|
-
2. Push a version tag:
|
|
134
|
-
|
|
135
|
-
```bash
|
|
136
|
-
npm version patch && git push origin main --follow-tags
|
|
137
|
-
# or for the current version:
|
|
138
|
-
git tag v1.0.0 && git push origin v1.0.0
|
|
139
|
-
```
|
|
99
|
+
Compare real GitHub Actions runs executing each wiki scenario across **multi-job YAML (Before)** vs **single-job `saga-ci` (After)**:
|
|
140
100
|
|
|
141
|
-
|
|
101
|
+
| Demo | Before (Multi-Job) | After (`saga-ci`) |
|
|
102
|
+
| :--- | :--- | :--- |
|
|
103
|
+
| **1. Happy Path** | [Run #3 (20s, 4 jobs)](https://github.com/ThisIsPennyLeung/saga-ci/actions/runs/47184205577) · [Screenshot](docs/assets/demo-1-happy-before.png) | [Run #2 (16s, 1 job)](https://github.com/ThisIsPennyLeung/saga-ci/actions/runs/47177472557) · [Screenshot](docs/assets/demo-1-happy-after.png) |
|
|
104
|
+
| **2. Rollback** | [Run #3 (47s, 6 jobs)](https://github.com/ThisIsPennyLeung/saga-ci/actions/runs/47184185918) · [Screenshot](docs/assets/demo-2-rollback-before.png) | [Run #2 (14s, 1 job)](https://github.com/ThisIsPennyLeung/saga-ci/actions/runs/47177503002) · [Screenshot](docs/assets/demo-2-rollback-after.png) |
|
|
105
|
+
| **3. Fan-out** | [Run #3 (27s, 6 jobs)](https://github.com/ThisIsPennyLeung/saga-ci/actions/runs/47184170199) · [Screenshot](docs/assets/demo-3-fan-out-before.png) | [Run #2 (18s, 1 job)](https://github.com/ThisIsPennyLeung/saga-ci/actions/runs/47177533461) · [Screenshot](docs/assets/demo-3-fan-out-after.png) |
|
|
106
|
+
| **4. Fan-out Rollback** | [Run #5 (50s, 11 jobs)](https://github.com/ThisIsPennyLeung/saga-ci/actions/runs/47184458849) · [Screenshot](docs/assets/demo-4-fan-out-rollback-before.png) | [Run #3 (20s, 1 job)](https://github.com/ThisIsPennyLeung/saga-ci/actions/runs/47189117791) · [Screenshot](docs/assets/demo-4-fan-out-rollback-after.png) |
|
|
107
|
+
| **5. Continue on Error** | [Run #3 (30s, 4 jobs)](https://github.com/ThisIsPennyLeung/saga-ci/actions/runs/47184151296) · [Screenshot](docs/assets/demo-5-continue-on-error-before.png) | [Run #2 (18s, 1 job)](https://github.com/ThisIsPennyLeung/saga-ci/actions/runs/47177592290) · [Screenshot](docs/assets/demo-5-continue-on-error-after.png) |
|
|
108
|
+
| **6. Rollback Fail** | [Run #3 (37s, 5 jobs)](https://github.com/ThisIsPennyLeung/saga-ci/actions/runs/47184135857) · [Screenshot](docs/assets/demo-6-rollback-fail-before.png) | [Run #2 (15s, 1 job)](https://github.com/ThisIsPennyLeung/saga-ci/actions/runs/47177620197) · [Screenshot](docs/assets/demo-6-rollback-fail-after.png) |
|
|
142
109
|
|
|
143
|
-
[
|
|
110
|
+
> **Note:** Each screenshot preview and interactive simulator is also embedded directly on its corresponding [Documentation Wiki example page](https://thisispennyleung.github.io/saga-ci/#example-happy).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "saga-ci",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Saga-pattern CI/CD workflow runner with sequential/parallel groups, reverse-order compensating rollback, and aligned GitHub Step Summary reporting.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"LICENSE"
|
|
34
34
|
],
|
|
35
35
|
"engines": {
|
|
36
|
-
"node": ">=
|
|
36
|
+
"node": ">=24.0.0"
|
|
37
37
|
},
|
|
38
38
|
"repository": {
|
|
39
39
|
"type": "git",
|