@dougefresh/ci 0.1.11
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/.checkov.yml +7 -0
- package/.env.example +61 -0
- package/.gitattributes +3 -0
- package/.github/actions/install-yq/action.yaml +80 -0
- package/.github/actions/install-yq/scripts/unixish.sh +112 -0
- package/.github/actions/install-yq/scripts/windowsish.ps1 +99 -0
- package/.github/actions/rust-config/action.yml +34 -0
- package/.github/actions/rust-init/action.yml +75 -0
- package/.github/ci-configs/dummy.yml +24 -0
- package/.github/ci-configs/rust/ai.yml +65 -0
- package/.github/ci-configs/rust-default.yml +115 -0
- package/.github/ci-configs/test/01.yml +9 -0
- package/.github/copilot-instructions.md +118 -0
- package/.github/dependabot.yml +26 -0
- package/.github/prompts/create-release-notes.prompt.md +29 -0
- package/.github/prompts/unit-test.prompt.md +77 -0
- package/.github/rust-ci.ts +5 -0
- package/.github/workflows/action-ci.yml +39 -0
- package/.github/workflows/action-review.yml +14 -0
- package/.github/workflows/dummy-release.yml +32 -0
- package/.github/workflows/dummy-test.yml +16 -0
- package/.github/workflows/pages.yml +59 -0
- package/.github/workflows/pr-review.yml +93 -0
- package/.github/workflows/release.yml +41 -0
- package/.github/workflows/rust-release.yml +133 -0
- package/.github/workflows/rust.yml +247 -0
- package/.node-version +1 -0
- package/AGENTS.md +13 -0
- package/Cargo.toml +6 -0
- package/LICENSE +21 -0
- package/README.md +58 -0
- package/action.yml +32 -0
- package/biome.jsonc +108 -0
- package/bun.lock +22 -0
- package/dist/ai.d.ts +11 -0
- package/dist/ai.d.ts.map +1 -0
- package/dist/ai.js +52 -0
- package/dist/ai.js.map +1 -0
- package/dist/index.d.ts +106 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +212 -0
- package/dist/index.js.map +1 -0
- package/docs/SUMMARY.md +3 -0
- package/docs/book.toml +49 -0
- package/docs/index.md +32 -0
- package/package.json +30 -0
- package/pre-commit +2 -0
- package/scripts/bump-version.ts +16 -0
- package/scripts/generate-rust.ts +9 -0
- package/src/ai.ts +61 -0
- package/src/index.ts +287 -0
- package/src/lib.rs +8 -0
- package/src/main.rs +11 -0
- package/tsconfig.json +25 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { type AiJob, PROMPT } from './ai.js';
|
|
2
|
+
|
|
3
|
+
export enum Arch {
|
|
4
|
+
ARM64 = 'vars.RUNNER_ARM64',
|
|
5
|
+
AMD64 = 'vars.RUNNER_AMD64',
|
|
6
|
+
WIN = 'vars.RUNNER_WIN',
|
|
7
|
+
MAC = 'vars.RUNNER_MAC',
|
|
8
|
+
}
|
|
9
|
+
interface Global {
|
|
10
|
+
// to match $RUNNER_OS
|
|
11
|
+
packages: {
|
|
12
|
+
Linux?: string;
|
|
13
|
+
macOS?: string;
|
|
14
|
+
Windows?: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface BaseJob {
|
|
19
|
+
if: boolean | string;
|
|
20
|
+
continueOnError: boolean | string;
|
|
21
|
+
run?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface Matrix {
|
|
25
|
+
os: Arch[];
|
|
26
|
+
toolchains: string[];
|
|
27
|
+
features: string[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface Fmt extends BaseJob {}
|
|
31
|
+
interface SemVer extends BaseJob {}
|
|
32
|
+
interface Hack extends BaseJob {}
|
|
33
|
+
interface CargoSort extends BaseJob {}
|
|
34
|
+
interface DocCheck extends BaseJob {}
|
|
35
|
+
interface Dependencies extends BaseJob {}
|
|
36
|
+
interface Extra extends BaseJob {
|
|
37
|
+
name: string;
|
|
38
|
+
matrix: Matrix;
|
|
39
|
+
}
|
|
40
|
+
interface Sanitizers {
|
|
41
|
+
enabled: boolean;
|
|
42
|
+
address: BaseJob;
|
|
43
|
+
leak: BaseJob;
|
|
44
|
+
thread: BaseJob;
|
|
45
|
+
}
|
|
46
|
+
interface Clippy extends BaseJob {
|
|
47
|
+
flags: string;
|
|
48
|
+
matrix: Matrix;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface Coverage extends BaseJob {
|
|
52
|
+
matrix: Matrix;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface RustJobs {
|
|
56
|
+
clippy: Clippy;
|
|
57
|
+
coverage: Coverage;
|
|
58
|
+
cargoSort: CargoSort;
|
|
59
|
+
dependencies: Dependencies;
|
|
60
|
+
docCheck: DocCheck;
|
|
61
|
+
fmt: Fmt;
|
|
62
|
+
hack: Hack;
|
|
63
|
+
sanitizers: Sanitizers;
|
|
64
|
+
semver: SemVer;
|
|
65
|
+
extra: Extra;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
interface Release {
|
|
69
|
+
bin: boolean;
|
|
70
|
+
publish: boolean;
|
|
71
|
+
debian: boolean;
|
|
72
|
+
profile: string;
|
|
73
|
+
os: Arch[];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const JobDefaults: RustJobs = {
|
|
77
|
+
fmt: {
|
|
78
|
+
if: true,
|
|
79
|
+
continueOnError: false,
|
|
80
|
+
run: 'cargo +nightly fmt --check --all',
|
|
81
|
+
} as Fmt,
|
|
82
|
+
semver: {
|
|
83
|
+
if: true,
|
|
84
|
+
continueOnError: false,
|
|
85
|
+
} as SemVer,
|
|
86
|
+
hack: {
|
|
87
|
+
if: true,
|
|
88
|
+
continueOnError: false,
|
|
89
|
+
run: 'cargo hack --feature-powerset check',
|
|
90
|
+
} as Hack,
|
|
91
|
+
docCheck: {
|
|
92
|
+
if: true,
|
|
93
|
+
continueOnError: false,
|
|
94
|
+
run: 'cargo +nightly docs-rs',
|
|
95
|
+
} as DocCheck,
|
|
96
|
+
cargoSort: {
|
|
97
|
+
if: true,
|
|
98
|
+
continueOnError: false,
|
|
99
|
+
run: 'if [ -f ./scripts/cargo-sort.sh ]; then\n ./scripts/cargo-sort.sh\nelse\n cargo sort -c -g\nfi\n',
|
|
100
|
+
} as CargoSort,
|
|
101
|
+
dependencies: {
|
|
102
|
+
if: true,
|
|
103
|
+
continueOnError: false,
|
|
104
|
+
run: 'cargo machete --with-metadata',
|
|
105
|
+
} as Dependencies,
|
|
106
|
+
sanitizers: {
|
|
107
|
+
enabled: true,
|
|
108
|
+
address: {
|
|
109
|
+
if: true,
|
|
110
|
+
continueOnError: false,
|
|
111
|
+
run: 'cargo test --lib --tests --no-fail-fast --target x86_64-unknown-linux-gnu -- --no-capture',
|
|
112
|
+
},
|
|
113
|
+
leak: {
|
|
114
|
+
if: true,
|
|
115
|
+
continueOnError: false,
|
|
116
|
+
run: 'cargo test --target x86_64-unknown-linux-gnu -- --no-capture',
|
|
117
|
+
},
|
|
118
|
+
thread: {
|
|
119
|
+
if: false,
|
|
120
|
+
continueOnError: false,
|
|
121
|
+
run: 'cargo test --target x86_64-unknown-linux-gnu -- --test-threads=1',
|
|
122
|
+
},
|
|
123
|
+
} as Sanitizers,
|
|
124
|
+
|
|
125
|
+
coverage: {
|
|
126
|
+
if: true,
|
|
127
|
+
continueOnError: false,
|
|
128
|
+
matrix: {
|
|
129
|
+
os: [Arch.ARM64],
|
|
130
|
+
toolchains: ['stable'],
|
|
131
|
+
features: ['default'],
|
|
132
|
+
},
|
|
133
|
+
run: `
|
|
134
|
+
cmd="cargo llvm-cov \${LLVM_ARGS} --locked --lcov --output-path lcov-\${FEATURES}.info --no-fail-fast"
|
|
135
|
+
if [ "$FEATURES" == "default" ]; then
|
|
136
|
+
$cmd -- --no-capture $CARGO_ARGS
|
|
137
|
+
else
|
|
138
|
+
$cmd --features "$FEATURES" -- --no-capture $CARGO_ARGS
|
|
139
|
+
fi
|
|
140
|
+
`,
|
|
141
|
+
} as Coverage,
|
|
142
|
+
|
|
143
|
+
clippy: {
|
|
144
|
+
if: true,
|
|
145
|
+
continueOnError: false,
|
|
146
|
+
run: '',
|
|
147
|
+
flags: '',
|
|
148
|
+
matrix: {
|
|
149
|
+
os: [Arch.ARM64],
|
|
150
|
+
toolchains: ['stable'],
|
|
151
|
+
features: ['default'],
|
|
152
|
+
},
|
|
153
|
+
} as Clippy,
|
|
154
|
+
extra: {
|
|
155
|
+
if: false,
|
|
156
|
+
continueOnError: false,
|
|
157
|
+
run: '',
|
|
158
|
+
name: 'extra',
|
|
159
|
+
matrix: {
|
|
160
|
+
os: [Arch.ARM64],
|
|
161
|
+
toolchains: ['stable'],
|
|
162
|
+
features: ['default'],
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export class RustWorkflow {
|
|
168
|
+
private jobs: RustJobs;
|
|
169
|
+
private global: Global;
|
|
170
|
+
private release: Release;
|
|
171
|
+
private ai: AiJob;
|
|
172
|
+
|
|
173
|
+
constructor() {
|
|
174
|
+
this.jobs = {
|
|
175
|
+
fmt: JobDefaults.fmt,
|
|
176
|
+
docCheck: JobDefaults.docCheck,
|
|
177
|
+
semver: JobDefaults.semver,
|
|
178
|
+
dependencies: JobDefaults.dependencies,
|
|
179
|
+
hack: JobDefaults.hack,
|
|
180
|
+
cargoSort: JobDefaults.cargoSort,
|
|
181
|
+
sanitizers: JobDefaults.sanitizers,
|
|
182
|
+
clippy: JobDefaults.clippy,
|
|
183
|
+
coverage: JobDefaults.coverage,
|
|
184
|
+
extra: JobDefaults.extra,
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
this.global = { packages: {} };
|
|
188
|
+
this.release = {
|
|
189
|
+
publish: true,
|
|
190
|
+
bin: false,
|
|
191
|
+
debian: false,
|
|
192
|
+
profile: 'release',
|
|
193
|
+
os: [Arch.AMD64],
|
|
194
|
+
};
|
|
195
|
+
this.ai = {
|
|
196
|
+
prompt: PROMPT,
|
|
197
|
+
additional: '',
|
|
198
|
+
enabled: true,
|
|
199
|
+
track_progress: true,
|
|
200
|
+
allowed_bots: '*',
|
|
201
|
+
claude_args:
|
|
202
|
+
' --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(find),Bash(diff),Bash(jq),Bash(git),Bash(cargo),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"',
|
|
203
|
+
use_sticky_comment: false,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
linuxPackages(packages: string[]) {
|
|
208
|
+
this.global.packages.Linux = packages.join(',');
|
|
209
|
+
return this;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
semver(enable: boolean) {
|
|
213
|
+
this.jobs.semver.if = enable;
|
|
214
|
+
return this;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
extra(name: string, run: string) {
|
|
218
|
+
this.jobs.extra.if = true;
|
|
219
|
+
this.jobs.extra.name = name;
|
|
220
|
+
this.jobs.extra.run = run;
|
|
221
|
+
return this;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
withRelease(r: Release) {
|
|
225
|
+
this.release = r;
|
|
226
|
+
return this;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
clippy(opts?: Partial<Clippy>) {
|
|
230
|
+
if (opts?.flags) this.jobs.clippy.flags = opts.flags;
|
|
231
|
+
if (opts?.run) this.jobs.clippy.run = opts.run;
|
|
232
|
+
if (opts?.if !== undefined) this.jobs.clippy.if = opts.if;
|
|
233
|
+
if (opts?.continueOnError !== undefined) this.jobs.clippy.continueOnError = opts.continueOnError;
|
|
234
|
+
if (opts?.matrix) {
|
|
235
|
+
if (opts.matrix.toolchains) this.jobs.clippy.matrix.toolchains = opts.matrix.toolchains;
|
|
236
|
+
if (opts.matrix.features) this.jobs.clippy.matrix.features = opts.matrix.features;
|
|
237
|
+
if (opts.matrix.os) this.jobs.clippy.matrix.os = opts.matrix.os;
|
|
238
|
+
}
|
|
239
|
+
return this;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
disableSanitizers() {
|
|
243
|
+
this.jobs.sanitizers.enabled = false;
|
|
244
|
+
return this;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
disableAi() {
|
|
248
|
+
this.ai.enabled = false;
|
|
249
|
+
return this;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
additionalPrompt(prompt: string) {
|
|
253
|
+
this.ai.additional = prompt;
|
|
254
|
+
return this;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
build() {
|
|
258
|
+
// os:
|
|
259
|
+
// - target: aarch64-unknown-linux-gnu
|
|
260
|
+
// os: ubicloud-standard-8-arm
|
|
261
|
+
// - target: x86_64-unknown-linux-gnu
|
|
262
|
+
// os: ubicloud-standard-4
|
|
263
|
+
// - target: aarch64-apple-darwin
|
|
264
|
+
// os: macos-latest
|
|
265
|
+
// # - target: x86_64-pc-windows-msvc
|
|
266
|
+
// # os: windows-latest
|
|
267
|
+
return {
|
|
268
|
+
ai: this.ai,
|
|
269
|
+
release: {
|
|
270
|
+
bin: this.release.bin,
|
|
271
|
+
publish: this.release.publish,
|
|
272
|
+
debian: this.release.debian,
|
|
273
|
+
profile: this.release.profile,
|
|
274
|
+
matrix: {
|
|
275
|
+
os: [Arch.AMD64],
|
|
276
|
+
target: ['x86_64-unknown-linux-gnu'],
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
global: this.global,
|
|
280
|
+
jobs: this.jobs,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export function createRustWorkflow(): RustWorkflow {
|
|
286
|
+
return new RustWorkflow();
|
|
287
|
+
}
|
package/src/lib.rs
ADDED
package/src/main.rs
ADDED
package/tsconfig.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"lib": ["ESNext"],
|
|
5
|
+
"target": "ESNext",
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"moduleResolution": "bundler",
|
|
8
|
+
"allowImportingTsExtensions": false,
|
|
9
|
+
"verbatimModuleSyntax": true,
|
|
10
|
+
"outDir": "./dist",
|
|
11
|
+
"declaration": true,
|
|
12
|
+
"declarationMap": true,
|
|
13
|
+
"sourceMap": true,
|
|
14
|
+
"strict": true,
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"noFallthroughCasesInSwitch": true,
|
|
17
|
+
"noUncheckedIndexedAccess": true,
|
|
18
|
+
"noImplicitOverride": true,
|
|
19
|
+
"noUnusedLocals": false,
|
|
20
|
+
"noUnusedParameters": false,
|
|
21
|
+
"noPropertyAccessFromIndexSignature": false
|
|
22
|
+
},
|
|
23
|
+
"include": ["src/**/*"],
|
|
24
|
+
"exclude": ["node_modules", "dist"]
|
|
25
|
+
}
|