@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
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
on:
|
|
3
|
+
workflow_call:
|
|
4
|
+
inputs:
|
|
5
|
+
version:
|
|
6
|
+
type: string
|
|
7
|
+
required: true
|
|
8
|
+
package:
|
|
9
|
+
type: string
|
|
10
|
+
required: true
|
|
11
|
+
cargo-release-args:
|
|
12
|
+
type: string
|
|
13
|
+
required: false
|
|
14
|
+
default: ''
|
|
15
|
+
jobs:
|
|
16
|
+
config:
|
|
17
|
+
runs-on: ${{ inputs.runner || vars.RUNNER }}
|
|
18
|
+
name: generate config
|
|
19
|
+
outputs:
|
|
20
|
+
config: ${{ steps.config.outputs.config }}
|
|
21
|
+
steps:
|
|
22
|
+
- name: config
|
|
23
|
+
id: config
|
|
24
|
+
uses: dougefresh/ci/.github/actions/rust-config@main
|
|
25
|
+
with:
|
|
26
|
+
arm64: ${{ vars.RUNNER_ARM64 }}
|
|
27
|
+
amd64: ${{ vars.RUNNER_AMD64 }}
|
|
28
|
+
# win: "windows-latest"
|
|
29
|
+
# mac: "macos-latest"
|
|
30
|
+
git_token: ${{ github.token }}
|
|
31
|
+
release:
|
|
32
|
+
needs: [config]
|
|
33
|
+
outputs:
|
|
34
|
+
tag: ${{ steps.release.outputs.tag }}
|
|
35
|
+
runs-on: ${{ vars.RUNNER }}
|
|
36
|
+
permissions:
|
|
37
|
+
contents: write
|
|
38
|
+
steps:
|
|
39
|
+
- name: Init
|
|
40
|
+
uses: dougefresh/ci/.github/actions/rust-init@main
|
|
41
|
+
with:
|
|
42
|
+
packages: ${{ toJSON(fromJSON(needs.config.outputs.config).global.packages) }}
|
|
43
|
+
- name: Install cargo-release
|
|
44
|
+
uses: taiki-e/install-action@v2
|
|
45
|
+
with:
|
|
46
|
+
tool: cargo-release
|
|
47
|
+
- name: Configure Git
|
|
48
|
+
run: |
|
|
49
|
+
git config --global user.name "github-actions[bot]"
|
|
50
|
+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
51
|
+
- name: Release
|
|
52
|
+
id: release
|
|
53
|
+
env:
|
|
54
|
+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
|
55
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
56
|
+
NO_PUBLISH: ${{ fromJSON(needs.config.outputs.config).release.cargoPublish && '' || '--no-publish' }}
|
|
57
|
+
run: |
|
|
58
|
+
cargo release \
|
|
59
|
+
--package ${{ inputs.package }} \
|
|
60
|
+
--execute \
|
|
61
|
+
--no-confirm ${NO_PUBLISH} \
|
|
62
|
+
${{ inputs.cargo-release-args }} ${{ inputs.version }}
|
|
63
|
+
|
|
64
|
+
TAG=$(git describe --tags --abbrev=0)
|
|
65
|
+
echo "tag=$TAG" >> $GITHUB_OUTPUT
|
|
66
|
+
make_latest="true"
|
|
67
|
+
case ${{ inputs.version }} in
|
|
68
|
+
alpha|beta|rc)
|
|
69
|
+
make_latest="false"
|
|
70
|
+
prerelease="true"
|
|
71
|
+
;;
|
|
72
|
+
*)
|
|
73
|
+
make_latest="true"
|
|
74
|
+
prerelease="false"
|
|
75
|
+
;;
|
|
76
|
+
esac
|
|
77
|
+
echo "make_latest=$make_latest" >> $GITHUB_OUTPUT
|
|
78
|
+
echo "prerelease=$prerelease" >> $GITHUB_OUTPUT
|
|
79
|
+
- name: Create GitHub Release
|
|
80
|
+
uses: softprops/action-gh-release@v2
|
|
81
|
+
with:
|
|
82
|
+
tag_name: ${{ steps.release.outputs.tag }}
|
|
83
|
+
generate_release_notes: true
|
|
84
|
+
make_latest: ${{ steps.release.outputs.make_latest }}
|
|
85
|
+
prerelease: ${{ steps.release.outputs.prerelease == 'true' }}
|
|
86
|
+
bin:
|
|
87
|
+
name: assets / ${{ matrix.target }}
|
|
88
|
+
if: ${{ fromJSON(needs.config.outputs.config).release.bin }}
|
|
89
|
+
needs: [config, release]
|
|
90
|
+
strategy:
|
|
91
|
+
matrix:
|
|
92
|
+
include: ${{ fromJSON(toJSON(fromJSON(needs.config.outputs.config).release.os)) }}
|
|
93
|
+
runs-on: ${{ matrix.os }}
|
|
94
|
+
steps:
|
|
95
|
+
- name: Init / ${{ matrix.target }}
|
|
96
|
+
uses: dougefresh/ci/.github/actions/rust-init@main
|
|
97
|
+
with:
|
|
98
|
+
packages: ${{ toJSON(fromJSON(needs.config.outputs.config).global.packages) }}
|
|
99
|
+
ref: ${{ needs.release.outputs.tag }}
|
|
100
|
+
- name: Build / ${{ matrix.target }}
|
|
101
|
+
id: build
|
|
102
|
+
run: |
|
|
103
|
+
if [ ${{ fromJSON(needs.config.outputs.config).release.debian }} == "true" ] && [ "${RUNNER_OS}" != "macOS" ]; then
|
|
104
|
+
cargo install cargo-deb
|
|
105
|
+
cargo deb --target ${{ matrix.target }}
|
|
106
|
+
echo _dpkg="$(ls target/debian/*.deb)" >> $GITHUB_OUTPUT
|
|
107
|
+
else
|
|
108
|
+
cargo build --release --target ${{ matrix.target }}
|
|
109
|
+
fi
|
|
110
|
+
echo _bin=target/${{ matrix.target }}/release/${{ fromJSON(needs.config.outputs.config).release.bin }} >> $GITHUB_OUTPUT
|
|
111
|
+
- name: Package / ${{ matrix.target }}
|
|
112
|
+
run: |
|
|
113
|
+
tar czf ${{ steps.build.outputs._bin }}-${{ matrix.target }}.tar.gz ${{ steps.build.outputs._bin }}
|
|
114
|
+
sha256sum ${{ steps.build.outputs._bin }}-${{ matrix.target }}.tar.gz > ${{ steps.build.outputs._bin }}-${{ matrix.target }}.tar.gz.sha256
|
|
115
|
+
- name: Hash Deb / ${{ matrix.target }}
|
|
116
|
+
if: ${{ steps.build.outputs._dpkg }}
|
|
117
|
+
run: |
|
|
118
|
+
sha256sum ${{ steps.build.outputs._dpkg }} > ${{ steps.build.outputs._dpkg }}.sha256
|
|
119
|
+
- name: Upload / ${{ matrix.target }}
|
|
120
|
+
uses: softprops/action-gh-release@v2
|
|
121
|
+
with:
|
|
122
|
+
tag_name: ${{ needs.release.outputs.tag }}
|
|
123
|
+
files: |
|
|
124
|
+
${{ steps.build.outputs._bin }}-${{ matrix.target }}.tar.gz
|
|
125
|
+
${{ steps.build.outputs._bin }}-${{ matrix.target }}.tar.gz.sha256
|
|
126
|
+
- name: Deb Upload / ${{ matrix.target }}
|
|
127
|
+
if: ${{ steps.build.outputs._dpkg }}
|
|
128
|
+
uses: softprops/action-gh-release@v2
|
|
129
|
+
with:
|
|
130
|
+
tag_name: ${{ needs.release.outputs.tag }}
|
|
131
|
+
files: |
|
|
132
|
+
${{ steps.build.outputs._dpkg }}
|
|
133
|
+
${{ steps.build.outputs._dpkg }}.sha256
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
on:
|
|
2
|
+
workflow_call:
|
|
3
|
+
inputs:
|
|
4
|
+
runner:
|
|
5
|
+
type: string
|
|
6
|
+
required: false
|
|
7
|
+
concurrency:
|
|
8
|
+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
9
|
+
cancel-in-progress: true
|
|
10
|
+
name: check test
|
|
11
|
+
jobs:
|
|
12
|
+
config:
|
|
13
|
+
runs-on: ${{ inputs.runner || vars.RUNNER }}
|
|
14
|
+
name: generate config
|
|
15
|
+
outputs:
|
|
16
|
+
config: ${{ steps.config.outputs.config }}
|
|
17
|
+
steps:
|
|
18
|
+
- name: config
|
|
19
|
+
id: config
|
|
20
|
+
uses: dougefresh/ci/.github/actions/rust-config@main
|
|
21
|
+
with:
|
|
22
|
+
arm64: ${{ vars.RUNNER_ARM64 }}
|
|
23
|
+
amd64: ${{ vars.RUNNER_AMD64 }}
|
|
24
|
+
# win: "windows-latest"
|
|
25
|
+
# mac: "macos-latest"
|
|
26
|
+
git_token: ${{ github.token }}
|
|
27
|
+
coverage:
|
|
28
|
+
runs-on: ${{ matrix.os }}
|
|
29
|
+
needs: [config]
|
|
30
|
+
if: ${{ fromJSON(needs.config.outputs.config).jobs.coverage.if }}
|
|
31
|
+
name: coverage / ${{ matrix.features }} / ${{ matrix.os }} / ${{ matrix.toolchains }}
|
|
32
|
+
strategy:
|
|
33
|
+
fail-fast: false
|
|
34
|
+
matrix: ${{ fromJSON(toJSON(fromJSON(needs.config.outputs.config).jobs.coverage.matrix)) }}
|
|
35
|
+
steps:
|
|
36
|
+
- name: Init
|
|
37
|
+
uses: dougefresh/ci/.github/actions/rust-init@main
|
|
38
|
+
with:
|
|
39
|
+
packages: ${{ toJSON(fromJSON(needs.config.outputs.config).global.packages) }}
|
|
40
|
+
- name: llvm-tools
|
|
41
|
+
shell: bash
|
|
42
|
+
run: |
|
|
43
|
+
rustup default ${{ matrix.toolchains }}
|
|
44
|
+
rustup component add llvm-tools-preview
|
|
45
|
+
cargo install cargo-llvm-cov
|
|
46
|
+
- name: cargo generate-lockfile
|
|
47
|
+
if: hashFiles('Cargo.lock') == ''
|
|
48
|
+
run: cargo generate-lockfile
|
|
49
|
+
- name: llvm-cov (${{ matrix.features }})
|
|
50
|
+
run: |
|
|
51
|
+
${{ fromJSON(needs.config.outputs.config).jobs.coverage.run }}
|
|
52
|
+
env:
|
|
53
|
+
FEATURES: ${{ matrix.features }}
|
|
54
|
+
LLVM_ARGS: ${{ fromJSON(needs.config.outputs.config).jobs.coverage.args.llvm || '' }}
|
|
55
|
+
CARGO_ARGS: ${{ fromJSON(needs.config.outputs.config).jobs.coverage.args.test || '' }}
|
|
56
|
+
RUST_LOG: "${{ fromJSON(needs.config.outputs.config).global.rustlog || 'info' }}"
|
|
57
|
+
- name: Record Rust version
|
|
58
|
+
run: echo "RUST=$(rustc --version)" >> "$GITHUB_ENV"
|
|
59
|
+
- name: Upload to codecov.io
|
|
60
|
+
uses: codecov/codecov-action@v5
|
|
61
|
+
with:
|
|
62
|
+
fail_ci_if_error: true
|
|
63
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
64
|
+
files: lcov-${{ matrix.features }}.info
|
|
65
|
+
flags: ${{ matrix.features }}
|
|
66
|
+
env_vars: OS,RUST
|
|
67
|
+
fmt:
|
|
68
|
+
needs: [config]
|
|
69
|
+
runs-on: ${{ vars.RUNNER }}
|
|
70
|
+
name: fmt
|
|
71
|
+
if: ${{ fromJSON(needs.config.outputs.config).jobs.fmt.if }}
|
|
72
|
+
steps:
|
|
73
|
+
- name: Init
|
|
74
|
+
uses: dougefresh/ci/.github/actions/rust-init@main
|
|
75
|
+
- name: fmt
|
|
76
|
+
run: |
|
|
77
|
+
${{ fromJSON(needs.config.outputs.config).jobs.fmt.run }}
|
|
78
|
+
clippy:
|
|
79
|
+
needs: [config]
|
|
80
|
+
runs-on: ${{ matrix.os }}
|
|
81
|
+
if: ${{ fromJSON(needs.config.outputs.config).jobs.clippy.if }}
|
|
82
|
+
name: clippy / ${{ matrix.features }} / ${{ matrix.os }}
|
|
83
|
+
permissions:
|
|
84
|
+
contents: read
|
|
85
|
+
checks: write
|
|
86
|
+
strategy:
|
|
87
|
+
fail-fast: false
|
|
88
|
+
matrix: ${{ fromJSON(toJSON(fromJSON(needs.config.outputs.config).jobs.clippy.matrix)) }}
|
|
89
|
+
steps:
|
|
90
|
+
- name: Init
|
|
91
|
+
uses: dougefresh/ci/.github/actions/rust-init@main
|
|
92
|
+
with:
|
|
93
|
+
packages: ${{ toJSON(fromJSON(needs.config.outputs.config).global.packages) }}
|
|
94
|
+
- name: clippy / ${{ matrix.features }}
|
|
95
|
+
uses: giraffate/clippy-action@v1
|
|
96
|
+
with:
|
|
97
|
+
reporter: 'github-pr-check'
|
|
98
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
99
|
+
tool_name: clippy-${{ matrix.toolchains }}-${{ matrix.features }}
|
|
100
|
+
clippy_flags: ${{ matrix.features != 'default' && format('--features {0}', matrix.features) || '' }}
|
|
101
|
+
semver:
|
|
102
|
+
needs: [config]
|
|
103
|
+
runs-on: ${{ vars.RUNNER_AMD64 }}
|
|
104
|
+
name: semver
|
|
105
|
+
if: ${{ fromJSON(needs.config.outputs.config).jobs.semver.if }}
|
|
106
|
+
steps:
|
|
107
|
+
- name: Init
|
|
108
|
+
uses: dougefresh/ci/.github/actions/rust-init@main
|
|
109
|
+
with:
|
|
110
|
+
packages: ${{ toJSON(fromJSON(needs.config.outputs.config).global.packages) }}
|
|
111
|
+
- name: cargo-semver-checks
|
|
112
|
+
uses: obi1kenobi/cargo-semver-checks-action@v2
|
|
113
|
+
hack:
|
|
114
|
+
needs: [config]
|
|
115
|
+
# cargo-hack checks combinations of feature flags to ensure that features are all additive
|
|
116
|
+
# which is required for feature unification
|
|
117
|
+
runs-on: ${{ vars.RUNNER }}
|
|
118
|
+
name: hack
|
|
119
|
+
if: ${{ fromJSON(needs.config.outputs.config).jobs.hack.if }}
|
|
120
|
+
steps:
|
|
121
|
+
- name: Init
|
|
122
|
+
uses: dougefresh/ci/.github/actions/rust-init@main
|
|
123
|
+
with:
|
|
124
|
+
packages: ${{ toJSON(fromJSON(needs.config.outputs.config).global.packages) }}
|
|
125
|
+
- name: Install cargo-hack
|
|
126
|
+
uses: baptiste0928/cargo-install@v3
|
|
127
|
+
with:
|
|
128
|
+
crate: cargo-hack
|
|
129
|
+
locked: false
|
|
130
|
+
# intentionally no target specifier; see https://github.com/jonhoo/rust-ci-conf/pull/4
|
|
131
|
+
# --feature-powerset runs for every combination of features
|
|
132
|
+
- name: cargo hack
|
|
133
|
+
run: cargo hack --feature-powerset check
|
|
134
|
+
doc:
|
|
135
|
+
needs: [config]
|
|
136
|
+
runs-on: ${{ vars.RUNNER }}
|
|
137
|
+
name: doc
|
|
138
|
+
if: ${{ fromJSON(needs.config.outputs.config).jobs.docCheck.if }}
|
|
139
|
+
steps:
|
|
140
|
+
- name: Init
|
|
141
|
+
uses: dougefresh/ci/.github/actions/rust-init@main
|
|
142
|
+
with:
|
|
143
|
+
packages: ${{ toJSON(fromJSON(needs.config.outputs.config).global.packages) }}
|
|
144
|
+
- name: Install cargo-docs-rs
|
|
145
|
+
uses: baptiste0928/cargo-install@v3
|
|
146
|
+
with:
|
|
147
|
+
crate: cargo-docs-rs
|
|
148
|
+
locked: false
|
|
149
|
+
- name: cargo docs-rs
|
|
150
|
+
run: |
|
|
151
|
+
${{ fromJSON(needs.config.outputs.config).jobs.dockCheck.run }}
|
|
152
|
+
cargo-sort:
|
|
153
|
+
needs: [config]
|
|
154
|
+
runs-on: ${{ vars.RUNNER }}
|
|
155
|
+
name: cargo-sort
|
|
156
|
+
if: ${{ fromJSON(needs.config.outputs.config).jobs.cargoSort.if }}
|
|
157
|
+
steps:
|
|
158
|
+
- name: Init
|
|
159
|
+
uses: dougefresh/ci/.github/actions/rust-init@main
|
|
160
|
+
- name: Install cargo-sort
|
|
161
|
+
uses: baptiste0928/cargo-install@v3
|
|
162
|
+
with:
|
|
163
|
+
crate: cargo-sort
|
|
164
|
+
locked: false
|
|
165
|
+
- name: Check `Cargo.toml` sort
|
|
166
|
+
run: |
|
|
167
|
+
${{ fromJSON(needs.config.outputs.config).jobs.cargoSort.run }}
|
|
168
|
+
dependencies:
|
|
169
|
+
needs: [config]
|
|
170
|
+
runs-on: ${{ vars.RUNNER }}
|
|
171
|
+
name: check unused deps
|
|
172
|
+
if: ${{ fromJSON(needs.config.outputs.config).jobs.dependencies.if }}
|
|
173
|
+
steps:
|
|
174
|
+
- name: Init
|
|
175
|
+
uses: dougefresh/ci/.github/actions/rust-init@main
|
|
176
|
+
- name: Install cargo-machete
|
|
177
|
+
uses: baptiste0928/cargo-install@v3
|
|
178
|
+
with:
|
|
179
|
+
crate: cargo-machete
|
|
180
|
+
locked: false
|
|
181
|
+
- name: Check unused Cargo dependencies
|
|
182
|
+
run: |
|
|
183
|
+
${{ fromJSON(needs.config.outputs.config).jobs.dependencies.run }}
|
|
184
|
+
sanitizers:
|
|
185
|
+
if: ${{ fromJSON(needs.config.outputs.config).jobs.sanitizers.enabled }}
|
|
186
|
+
name: sanitizers
|
|
187
|
+
runs-on: ${{ vars.RUNNER }}
|
|
188
|
+
needs: [config, coverage]
|
|
189
|
+
steps:
|
|
190
|
+
- name: Init
|
|
191
|
+
uses: dougefresh/ci/.github/actions/rust-init@main
|
|
192
|
+
with:
|
|
193
|
+
packages: ${{ toJSON(fromJSON(needs.config.outputs.config).global.packages) }}
|
|
194
|
+
- name: Enable debug symbols
|
|
195
|
+
run: |
|
|
196
|
+
#rustup target add x86_64-unknown-linux-gnu
|
|
197
|
+
echo _rust_target=aarch64-unknown-linux-gnu >> $GITHUB_ENV
|
|
198
|
+
rustup default nightly
|
|
199
|
+
# to get the symbolizer for debug symbol resolution
|
|
200
|
+
sudo apt install llvm
|
|
201
|
+
# to fix buggy leak analyzer:
|
|
202
|
+
# https://github.com/japaric/rust-san#unrealiable-leaksanitizer
|
|
203
|
+
# ensure there's a profile.dev section
|
|
204
|
+
if ! grep -qE '^[ \t]*[profile.dev]' Cargo.toml; then
|
|
205
|
+
echo >> Cargo.toml
|
|
206
|
+
echo '[profile.dev]' >> Cargo.toml
|
|
207
|
+
fi
|
|
208
|
+
# remove pre-existing opt-levels in profile.dev
|
|
209
|
+
sed -i '/^\s*\[profile.dev\]/,/^\s*\[/ {/^\s*opt-level/d}' Cargo.toml
|
|
210
|
+
# now set opt-level to 1
|
|
211
|
+
sed -i '/^\s*\[profile.dev\]/a opt-level = 1' Cargo.toml
|
|
212
|
+
- name: cargo test -Zsanitizer=address
|
|
213
|
+
if: ${{ fromJSON(needs.config.outputs.config).jobs.sanitizers.address.if }}
|
|
214
|
+
# only --lib --tests b/c of https://github.com/rust-lang/rust/issues/53945
|
|
215
|
+
run: |
|
|
216
|
+
cargo test --lib --tests --no-fail-fast --target ${_rust_target} -- --no-capture
|
|
217
|
+
env:
|
|
218
|
+
ASAN_OPTIONS: 'detect_odr_violation=0:detect_leaks=0'
|
|
219
|
+
RUSTFLAGS: '-Z sanitizer=address'
|
|
220
|
+
- name: cargo test -Zsanitizer=leak
|
|
221
|
+
if: ${{ fromJSON(needs.config.outputs.config).jobs.sanitizers.leak.if }}
|
|
222
|
+
run: |
|
|
223
|
+
cargo test --target ${_rust_target} -- --no-capture
|
|
224
|
+
env:
|
|
225
|
+
LSAN_OPTIONS: 'suppressions=lsan-suppressions.txt'
|
|
226
|
+
RUSTFLAGS: '-Z sanitizer=leak'
|
|
227
|
+
- name: cargo test -Zsanitizer=thread
|
|
228
|
+
if: ${{ fromJSON(needs.config.outputs.config).jobs.sanitizers.thread.if }}
|
|
229
|
+
run: cargo test --target ${_rust_target} -- --test-threads=1 --no-capture
|
|
230
|
+
env:
|
|
231
|
+
RUSTFLAGS: '-Z sanitizer=thread'
|
|
232
|
+
extra:
|
|
233
|
+
needs: [config]
|
|
234
|
+
runs-on: ${{ matrix.os }}
|
|
235
|
+
name: ${{ fromJSON(needs.config.outputs.config).jobs.extra.name }}
|
|
236
|
+
if: ${{ fromJSON(needs.config.outputs.config).jobs.extra.if }}
|
|
237
|
+
strategy:
|
|
238
|
+
fail-fast: false
|
|
239
|
+
matrix: ${{ fromJSON(toJSON(fromJSON(needs.config.outputs.config).jobs.extra.matrix)) }}
|
|
240
|
+
steps:
|
|
241
|
+
- name: Init
|
|
242
|
+
uses: dougefresh/ci/.github/actions/rust-init@main
|
|
243
|
+
with:
|
|
244
|
+
packages: ${{ toJSON(fromJSON(needs.config.outputs.config).global.packages) }}
|
|
245
|
+
- name: ${{ fromJSON(needs.config.outputs.config).jobs.extra.name }} / ${{ matrix.os }}
|
|
246
|
+
run: |
|
|
247
|
+
${{ fromJSON(needs.config.outputs.config).jobs.extra.run }}
|
package/.node-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
24
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Key Design Principles
|
|
2
|
+
- TypeScript-based CI config generation (not traditional YAML)
|
|
3
|
+
- Config flows: User TS → JSON generation → Workflow consumption
|
|
4
|
+
- Focus on logical errors and unintended consequences, not design critique, unless your critique reduces maintenance cost or greater flexibility
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Note, this is a personal action / tool. It isn't meant for widespread use.
|
|
8
|
+
It isn't perfect, nor will this ever be perfect.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
Review README.md for design flow
|
|
12
|
+
|
|
13
|
+
|
package/Cargo.toml
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright GitHub
|
|
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
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Typescript all the things
|
|
2
|
+
|
|
3
|
+
TypeScript-based CI configuration for Rust projects. Replaces static YAML configs with type-safe builders.
|
|
4
|
+
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+
### Config Generation Flow
|
|
8
|
+
|
|
9
|
+
1. **User defines config** in `.github/rust-ci.ts` using `createRustWorkflow()` builder
|
|
10
|
+
2. **Action generates JSON** via `dougefresh/ci@main` (runs `scripts/generate-rust.ts`)
|
|
11
|
+
3. **Workflow consumes JSON** using `fromJSON()` to populate job matrices and conditionals
|
|
12
|
+
|
|
13
|
+
### Actions
|
|
14
|
+
|
|
15
|
+
**`dougefresh/ci@main`** (this repo's `action.yml`)
|
|
16
|
+
- Copies `.github/rust-ci.ts` from calling repo
|
|
17
|
+
- Executes `scripts/generate-rust.ts` with Bun
|
|
18
|
+
- Outputs JSON config string
|
|
19
|
+
|
|
20
|
+
**`.github/actions/rust-config/action.yml`**
|
|
21
|
+
- Wraps `dougefresh/ci@main`
|
|
22
|
+
- Replaces runner placeholders (`vars.RUNNER_ARM64`, `vars.RUNNER_AMD64`) with actual runner names
|
|
23
|
+
- Used by workflows to get final config with resolved runners
|
|
24
|
+
|
|
25
|
+
**`.github/actions/rust-init/action.yml`**
|
|
26
|
+
- Checks out code
|
|
27
|
+
- Sets up Rust toolchains (stable + nightly)
|
|
28
|
+
- Installs OS-specific packages from config
|
|
29
|
+
- Configures caching
|
|
30
|
+
|
|
31
|
+
### Workflow Pattern
|
|
32
|
+
|
|
33
|
+
`.github/workflows/rust.yml` demonstrates the pattern:
|
|
34
|
+
|
|
35
|
+
1. **config job**: Calls `rust-config` action → outputs JSON
|
|
36
|
+
2. **downstream jobs**: Use `fromJSON(needs.config.outputs.config)` to:
|
|
37
|
+
- Control job execution (`if` conditions)
|
|
38
|
+
- Populate matrices (toolchains, features, OS)
|
|
39
|
+
- Extract run commands and flags
|
|
40
|
+
|
|
41
|
+
Each job checks `fromJSON(needs.config.outputs.config).jobs.<job_name>.if` before running.
|
|
42
|
+
|
|
43
|
+
### Example Config
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
// .github/rust-ci.ts
|
|
47
|
+
import { createRustWorkflow } from '@dougefresh/ci';
|
|
48
|
+
|
|
49
|
+
export default function () {
|
|
50
|
+
return createRustWorkflow()
|
|
51
|
+
.semver(false)
|
|
52
|
+
.clippy({ flags: '-D warnings' })
|
|
53
|
+
.extra('integration-tests', 'cargo test --test integration')
|
|
54
|
+
.build();
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Generates JSON consumed by workflow jobs via `fromJSON()`.
|
package/action.yml
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: ci-config
|
|
2
|
+
description: config ci config
|
|
3
|
+
author: dougEfresh
|
|
4
|
+
branding:
|
|
5
|
+
icon: scissors
|
|
6
|
+
color: black
|
|
7
|
+
outputs:
|
|
8
|
+
config:
|
|
9
|
+
description: JSON string of the config
|
|
10
|
+
value: ${{ steps.generate.outputs.config }}
|
|
11
|
+
runs:
|
|
12
|
+
using: composite
|
|
13
|
+
steps:
|
|
14
|
+
- name: setup bun
|
|
15
|
+
uses: oven-sh/setup-bun@v2
|
|
16
|
+
- id: generate
|
|
17
|
+
name: generate
|
|
18
|
+
shell: bash
|
|
19
|
+
run: |
|
|
20
|
+
if [ ! -f .github/rust-ci.ts ]; then
|
|
21
|
+
echo "::error::Missing .github/rust-ci.ts config file"
|
|
22
|
+
exit 1
|
|
23
|
+
fi
|
|
24
|
+
if [ .github/rust-ci.ts -ef ${{ github.action_path }}/.github/rust-ci.ts ]; then
|
|
25
|
+
echo "Running in action repo, skipping copy"
|
|
26
|
+
else
|
|
27
|
+
cp -v .github/rust-ci.ts ${{ github.action_path }}/.github/
|
|
28
|
+
fi
|
|
29
|
+
cat ${{ github.action_path }}/.github/rust-ci.ts
|
|
30
|
+
cd ${{ github.action_path }}
|
|
31
|
+
CONFIG="$(bun run ./scripts/generate-rust.ts | jq . --compact-output )"
|
|
32
|
+
echo "config=$CONFIG" >> $GITHUB_OUTPUT
|
package/biome.jsonc
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
|
|
3
|
+
"json": {
|
|
4
|
+
"formatter": {
|
|
5
|
+
"enabled": true,
|
|
6
|
+
"indentStyle": "space",
|
|
7
|
+
"indentWidth": 2
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"vcs": {
|
|
11
|
+
"enabled": false,
|
|
12
|
+
"clientKind": "git",
|
|
13
|
+
"useIgnoreFile": false
|
|
14
|
+
},
|
|
15
|
+
"files": {
|
|
16
|
+
"ignoreUnknown": false,
|
|
17
|
+
"includes": ["**", "!dist/*", "!coverage/"]
|
|
18
|
+
},
|
|
19
|
+
"formatter": {
|
|
20
|
+
"enabled": true,
|
|
21
|
+
"indentStyle": "space",
|
|
22
|
+
"formatWithErrors": true,
|
|
23
|
+
"indentWidth": 2
|
|
24
|
+
},
|
|
25
|
+
"assist": {
|
|
26
|
+
"actions": {
|
|
27
|
+
"source": {
|
|
28
|
+
"organizeImports": "on"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"linter": {
|
|
33
|
+
"enabled": true,
|
|
34
|
+
"rules": {
|
|
35
|
+
"recommended": true,
|
|
36
|
+
"correctness": {
|
|
37
|
+
"noConstantMathMinMaxClamp": "error",
|
|
38
|
+
"noUndeclaredVariables": "error",
|
|
39
|
+
"noUnusedImports": "error",
|
|
40
|
+
"noUnusedFunctionParameters": "error",
|
|
41
|
+
"noUnusedPrivateClassMembers": "error",
|
|
42
|
+
"useExhaustiveDependencies": {
|
|
43
|
+
"level": "error",
|
|
44
|
+
"options": {
|
|
45
|
+
"reportUnnecessaryDependencies": false
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"noUnusedVariables": "error"
|
|
49
|
+
},
|
|
50
|
+
"style": {
|
|
51
|
+
"noParameterProperties": "error",
|
|
52
|
+
"noYodaExpression": "error",
|
|
53
|
+
"useConsistentBuiltinInstantiation": "error",
|
|
54
|
+
"useFragmentSyntax": "error",
|
|
55
|
+
"useShorthandAssign": "error",
|
|
56
|
+
"noNonNullAssertion": "off",
|
|
57
|
+
"noParameterAssign": "error",
|
|
58
|
+
"useAsConstAssertion": "error",
|
|
59
|
+
"useDefaultParameterLast": "error",
|
|
60
|
+
"useEnumInitializers": "error",
|
|
61
|
+
"useSelfClosingElements": "error",
|
|
62
|
+
"useSingleVarDeclarator": "error",
|
|
63
|
+
"noUnusedTemplateLiteral": "error",
|
|
64
|
+
"useNumberNamespace": "error",
|
|
65
|
+
"noInferrableTypes": "error",
|
|
66
|
+
"noUselessElse": "error",
|
|
67
|
+
"useArrayLiterals": "error"
|
|
68
|
+
},
|
|
69
|
+
"suspicious": {
|
|
70
|
+
"useAwait": "off",
|
|
71
|
+
"noEvolvingTypes": "off",
|
|
72
|
+
"noExplicitAny": "off"
|
|
73
|
+
},
|
|
74
|
+
"complexity": {
|
|
75
|
+
"noUselessStringConcat": "error",
|
|
76
|
+
"noUselessUndefinedInitialization": "error",
|
|
77
|
+
"noVoid": "error",
|
|
78
|
+
"useDateNow": "error",
|
|
79
|
+
"noBannedTypes": "off",
|
|
80
|
+
"noForEach": "off",
|
|
81
|
+
"useOptionalChain": "off",
|
|
82
|
+
"useLiteralKeys": "off"
|
|
83
|
+
},
|
|
84
|
+
"performance": {
|
|
85
|
+
"noAccumulatingSpread": "off"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"javascript": {
|
|
90
|
+
"globals": ["Bun", "structuredClone"],
|
|
91
|
+
"formatter": {
|
|
92
|
+
"arrowParentheses": "always",
|
|
93
|
+
"quoteStyle": "single",
|
|
94
|
+
"bracketSameLine": false,
|
|
95
|
+
"semicolons": "always",
|
|
96
|
+
"bracketSpacing": true,
|
|
97
|
+
"trailingCommas": "all",
|
|
98
|
+
"quoteProperties": "asNeeded",
|
|
99
|
+
"enabled": true,
|
|
100
|
+
"attributePosition": "auto",
|
|
101
|
+
"indentWidth": 2,
|
|
102
|
+
"indentStyle": "space",
|
|
103
|
+
"jsxQuoteStyle": "double",
|
|
104
|
+
"lineEnding": "lf",
|
|
105
|
+
"lineWidth": 120
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
package/bun.lock
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lockfileVersion": 1,
|
|
3
|
+
"configVersion": 0,
|
|
4
|
+
"workspaces": {
|
|
5
|
+
"": {
|
|
6
|
+
"name": "@carteramesh/ci",
|
|
7
|
+
"devDependencies": {
|
|
8
|
+
"@types/bun": "^1.3.6",
|
|
9
|
+
"@types/node": "^24.10.1",
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
"packages": {
|
|
14
|
+
"@types/bun": ["@types/bun@1.3.6", "", { "dependencies": { "bun-types": "1.3.6" } }, "sha512-uWCv6FO/8LcpREhenN1d1b6fcspAB+cefwD7uti8C8VffIv0Um08TKMn98FynpTiU38+y2dUO55T11NgDt8VAA=="],
|
|
15
|
+
|
|
16
|
+
"@types/node": ["@types/node@24.10.4", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-vnDVpYPMzs4wunl27jHrfmwojOGKya0xyM3sH+UE5iv5uPS6vX7UIoh6m+vQc5LGBq52HBKPIn/zcSZVzeDEZg=="],
|
|
17
|
+
|
|
18
|
+
"bun-types": ["bun-types@1.3.6", "", { "dependencies": { "@types/node": "*" } }, "sha512-OlFwHcnNV99r//9v5IIOgQ9Uk37gZqrNMCcqEaExdkVq3Avwqok1bJFmvGMCkCE0FqzdY8VMOZpfpR3lwI+CsQ=="],
|
|
19
|
+
|
|
20
|
+
"undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
|
|
21
|
+
}
|
|
22
|
+
}
|
package/dist/ai.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface AiJob {
|
|
2
|
+
enabled: boolean;
|
|
3
|
+
allowed_bots: string;
|
|
4
|
+
claude_args: string;
|
|
5
|
+
use_sticky_comment: boolean;
|
|
6
|
+
track_progress: boolean;
|
|
7
|
+
prompt: string;
|
|
8
|
+
additional: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const PROMPT = "\nPerform a comprehensive code review with the following focus areas:\nProvide detailed feedback using inline comments for ONLY issues, no praise inline comments.\nUse top-level comments for general observations or praise\nDo not be shy, I am a big boy and can handle criticism gracefully. I welcome feedback and suggestions.\n\n\n## Rust tooling\n\nYou should have access to cargo cli. You can use this to verify the build yourself, or use it to run tests (or a specific test)\nIf you encounter an error running cargo, please comment on this PR. If you desire more rust tools, such as rust-analyzer, or any cargo plugin to help review then please notify on pull request\n\n\n## Permissions\n\nIf you are denied access to a tool, shell command, or github API resource (via gh cli) then notify the pull request author that you would like access to that tool.\nAs an example, we use CodeCov to our test coverage, if you like to have access to historical data, we can provide you with the CodeCov CLI tool and access.\nIn general, if you need something, just ask.\n\n\nReview this PR against our team checklist:\n\n## Code Quality\n- [ ] Code follows our style guide\n- [ ] No commented-out code\n- [ ] Meaningful variable names\n- [ ] DRY principle followed\n\n## Testing\n- [ ] Unit tests for new functions\n- [ ] Integration tests for new endpoints\n- [ ] Edge cases covered\n- [ ] Test coverage > 80%\n\n## Documentation\n- [ ] README updated if needed\n- [ ] API docs updated\n- [ ] Inline comments for complex logic\n- [ ] CHANGELOG.md updated\n\n## Security\n- [ ] No hardcoded credentials\n- [ ] Input validation implemented\n- [ ] Proper error handling\n- [ ] No sensitive data in logs\n\nFor each item, check if it is satisfied and comment on any that need attention.\nPost a summary comment with checklist results.\n\n\n";
|
|
11
|
+
//# sourceMappingURL=ai.d.ts.map
|
package/dist/ai.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../src/ai.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,cAAc,EAAE,OAAO,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,MAAM,yyDAkDlB,CAAC"}
|