-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpipeline.ts
More file actions
251 lines (247 loc) · 7.83 KB
/
Copy pathpipeline.ts
File metadata and controls
251 lines (247 loc) · 7.83 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
import { definePipeline, env, job, sh, task, trigger } from "@async/pipeline";
const packageInputs = [
"src/**/*.ts",
"tests/**/*.test.js",
"scripts/**/*.js",
"README.md",
"ROUTING.md",
"SPEC.md",
"CHANGELOG.md",
"AGENTS.md",
"API_SURFACE.md",
"package.json",
"pnpm-lock.yaml",
"pnpm-workspace.yaml",
"tsconfig.json"
];
const buildInputs = ["src/**/*.ts", "tsconfig.json", "package.json"];
const pipelineInputs = [
"pipeline.ts",
"package.json",
".github/workflows/async-pipeline.yml",
".locks/pipeline/github-workflow.lock.json",
".locks/pipeline/tasks.lock.json"
];
export default definePipeline({
name: "cli",
cache: "file:local",
triggers: {
pr: trigger.github({ events: ["pull_request"] }),
main: trigger.github({ events: ["push"], branches: ["main"] }),
release: trigger.github({ events: ["release"], types: ["published"] }),
manual: trigger.manual()
},
sync: {
github: {
nodeVersion: 24,
runtime: ["node@24", "deno@2.7.14"],
cache: false,
dependencyCache: false,
packagePreviews: true,
pages: { target: "docs.site" },
// Receiver for the pipeline release update train (async-dep-bump):
// bump the pinned @async/pipeline, regenerate synced surfaces, verify,
// land on main when green, open a pull request when not.
dependencyBump: {
packages: ["@async/pipeline"],
verify: [
"pnpm run pipeline:sync:generate",
"pnpm run pipeline:github:generate",
"pnpm run release:check"
],
success: "push",
failure: "pull-request"
}
},
tasks: {
prefix: "pipeline",
runners: ["package"],
targets: [{ package: "@async/cli" }],
jobs: ["publish", "release-doctor", "snapshot", "verify"],
tasks: ["build", "check", "deno-smoke", "docs.site", "github.check", "pack", "sync.check", "test", "typecheck"],
scripts: {
build: "run-task build",
check: "run-task check",
"pages": "run-task docs.site",
"github:check": "github check",
"github:generate": "github generate",
pack: "run-task pack",
publish: "run publish",
"publish:github:main": "publish github main --package .",
"publish:github:pr": "publish github pr --package .",
"publish:github:release": "publish github release --package .",
"publish:npm": "publish npm --package .",
"release:doctor": "release doctor --package .",
"release:ensure": "release ensure --package .",
"release-doctor": "run release-doctor",
snapshot: "run snapshot",
"sync:check": "sync check",
"sync:generate": "sync generate",
test: "run-task test",
"test:deno": "run-task deno-smoke",
typecheck: "run-task typecheck",
verify: "run verify",
"verify:force": "run verify --force"
}
}
},
tasks: {
build: task({
description: "Compile the TypeScript CLI sources into dist.",
inputs: buildInputs,
outputs: ["dist/**"],
cache: false,
run: sh`pnpm exec tsc -p tsconfig.json && chmod +x dist/cli.js`
}),
typecheck: task({
description: "Validate the TypeScript CLI sources without writing output.",
inputs: packageInputs,
cache: false,
run: sh`pnpm exec tsc -p tsconfig.json --noEmit`
}),
check: task({
description: "Run scaffold, metadata, and public surface checks.",
dependsOn: ["build"],
inputs: packageInputs,
cache: false,
run: sh`node scripts/check.js`
}),
test: task({
description: "Run the CLI router and agent integration tests.",
dependsOn: ["build"],
inputs: packageInputs,
cache: false,
run: sh`node --test tests/*.test.js`
}),
"deno-smoke": task({
description: "Pack and run the published CLI and a Deno command through Deno.",
dependsOn: ["build"],
inputs: packageInputs,
cache: false,
requires: { runtime: "deno" },
run: sh`node scripts/deno-smoke.js`
}),
"docs.site": task({
description: "Build the GitHub Pages documentation site.",
inputs: ["README.md", "ROUTING.md", "API_SURFACE.md", "scripts/build-pages.js"],
outputs: [".async/pages/**"],
cache: false,
run: sh`node scripts/build-pages.js`
}),
"sync.check": task({
description: "Validate generated package scripts and task locks from pipeline.ts.",
inputs: pipelineInputs,
cache: false,
run: sh`pnpm async-pipeline sync check`
}),
"github.check": task({
description: "Validate generated GitHub Actions workflow and lock state from pipeline.ts.",
inputs: pipelineInputs,
cache: false,
run: sh`pnpm async-pipeline github check`
}),
pack: task({
description: "Verify the public npm package contents without publishing.",
dependsOn: ["check", "test", "deno-smoke", "sync.check", "github.check"],
inputs: [...packageInputs, ...pipelineInputs],
cache: false,
run: sh`pnpm run pack:check`
}),
snapshot: task({
description: "Publish main snapshots to GitHub Packages.",
dependsOn: ["pack"],
inputs: packageInputs,
cache: false,
run: sh`pnpm async-pipeline publish github main --package .`
}),
"release.ensure": task({
description: "Create or verify the release tag and GitHub Release before package publishing.",
dependsOn: ["pack"],
inputs: packageInputs,
cache: false,
run: sh`pnpm async-pipeline release ensure --package .`
}),
"publish.github": task({
description: "Publish the stable GitHub Packages mirror before npm publishing.",
dependsOn: ["release.ensure"],
inputs: packageInputs,
cache: false,
run: sh`pnpm async-pipeline publish github release --package .`
}),
publish: task({
description: "Publish the verified release to npm, then run release doctor.",
dependsOn: ["publish.github"],
inputs: packageInputs,
cache: false,
run: [
sh`pnpm async-pipeline publish npm --package .`,
sh`pnpm async-pipeline release doctor --package .`
]
}),
"release.doctor": task({
description: "Diagnose release consistency for the current version.",
dependsOn: ["pack"],
inputs: packageInputs,
cache: false,
run: sh`pnpm async-pipeline release doctor --package .`
})
},
jobs: {
verify: job({
description: "Build, check, test in Node and Deno, verify generated surfaces, and inspect the package.",
target: "pack",
trigger: ["pr", "main", "release", "manual"]
}),
snapshot: job({
description: "Publish a main-branch snapshot to GitHub Packages.",
target: "snapshot",
trigger: ["main"],
env: {
GITHUB_TOKEN: env.secret("GITHUB_TOKEN")
},
github: {
permissions: {
contents: "write",
packages: "write"
}
}
}),
publish: job({
description: "Publish the release to GitHub Packages and npm.",
target: "publish",
trigger: ["manual", "release"],
environment: {
name: "npm-publish",
url: "https://www.npmjs.com/package/@async/cli"
},
requires: {
provenance: true
},
env: {
GITHUB_TOKEN: env.secret("GITHUB_TOKEN"),
NODE_AUTH_TOKEN: env.secret("NPM_TOKEN")
},
github: {
permissions: {
contents: "write",
idToken: "write",
packages: "write"
}
}
}),
"release-doctor": job({
description: "Diagnose release consistency for the current version.",
target: "release.doctor",
trigger: ["manual"],
env: {
GITHUB_TOKEN: env.secret("GITHUB_TOKEN")
},
github: {
permissions: {
contents: "read",
packages: "read"
}
}
})
}
});