-
Notifications
You must be signed in to change notification settings - Fork 10
210 lines (179 loc) · 5.64 KB
/
js.yml
File metadata and controls
210 lines (179 loc) · 5.64 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
# JavaScript/TypeScript CI — builds NAPI-RS bindings and runs tests
# Triggered on PRs and pushes to main when JS-related files change.
name: JS
on:
push:
branches: [main]
paths:
- "crates/bashkit-js/**"
- "crates/bashkit/src/**"
- "examples/*.mjs"
- "examples/package.json"
- "Cargo.toml"
- "Cargo.lock"
- ".github/workflows/js.yml"
pull_request:
branches: [main]
paths:
- "crates/bashkit-js/**"
- "crates/bashkit/src/**"
- "examples/*.mjs"
- "examples/package.json"
- "Cargo.toml"
- "Cargo.lock"
- ".github/workflows/js.yml"
workflow_dispatch:
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN }}
jobs:
typecheck:
name: TypeScript type-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "22"
- name: Install dependencies
run: npm ci
working-directory: crates/bashkit-js
- name: Build native binding (generates type declarations)
run: npm run build
working-directory: crates/bashkit-js
- name: Type-check (including tests)
run: npx tsc --noEmit -p tsconfig.check.json
working-directory: crates/bashkit-js
build-and-test:
name: ${{ matrix.runtime }} ${{ matrix.version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# Node.js versions
- runtime: node
version: "20"
run: "node"
- runtime: node
version: "22"
run: "node"
- runtime: node
version: "24"
run: "node"
- runtime: node
version: "latest"
run: "node"
# Bun
- runtime: bun
version: "latest"
run: "bun"
- runtime: bun
version: "canary"
run: "bun"
# Deno
- runtime: deno
version: "2.x"
run: "deno run -A"
- runtime: deno
version: "canary"
run: "deno run -A"
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Setup Node.js
if: matrix.runtime == 'node'
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.version }}
- name: Setup Node.js (for napi build)
if: matrix.runtime != 'node'
uses: actions/setup-node@v6
with:
node-version: "22"
- name: Setup Bun
if: matrix.runtime == 'bun'
uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ matrix.version }}
- name: Setup Deno
if: matrix.runtime == 'deno'
uses: denoland/setup-deno@v2
with:
deno-version: ${{ matrix.version }}
- name: Install dependencies
run: npm install
working-directory: crates/bashkit-js
- name: Build native binding
run: npm run build
working-directory: crates/bashkit-js
- name: Run ava tests (Node only)
if: matrix.runtime == 'node'
run: npm test
working-directory: crates/bashkit-js
- name: Run runtime-compat tests (Node)
if: matrix.runtime == 'node'
run: node --test __test__/runtime-compat/*.test.mjs
working-directory: crates/bashkit-js
- name: Run runtime-compat tests (Bun)
if: matrix.runtime == 'bun'
run: bun test __test__/runtime-compat/
working-directory: crates/bashkit-js
- name: Run runtime-compat tests (Deno)
if: matrix.runtime == 'deno'
run: |
for f in __test__/runtime-compat/*.test.mjs; do
echo "--- $f ---"
deno run -A "$f"
done
working-directory: crates/bashkit-js
- name: Install example dependencies and link local build
working-directory: examples
run: |
npm install
rm -rf node_modules/@everruns/bashkit
mkdir -p node_modules/@everruns
ln -s ${{ github.workspace }}/crates/bashkit-js node_modules/@everruns/bashkit
- name: Run examples (self-contained)
working-directory: examples
run: |
${{ matrix.run }} bash_basics.mjs
${{ matrix.run }} data_pipeline.mjs
${{ matrix.run }} llm_tool.mjs
${{ matrix.run }} k8s_orchestrator.mjs
${{ matrix.run }} langchain_integration.mjs
- name: Install Doppler CLI
if: env.DOPPLER_TOKEN != ''
uses: dopplerhq/cli-action@v4
- name: Run AI examples
if: env.DOPPLER_TOKEN != '' && github.event_name != 'pull_request'
working-directory: examples
run: |
doppler run -- ${{ matrix.run }} openai_tool.mjs
doppler run -- ${{ matrix.run }} vercel_ai_tool.mjs
doppler run -- ${{ matrix.run }} langchain_agent.mjs
# Gate job for branch protection
js-check:
name: JS Check
if: always()
needs: [typecheck, build-and-test]
runs-on: ubuntu-latest
steps:
- name: Verify all jobs passed
run: |
if [[ "${{ needs.typecheck.result }}" != "success" ]]; then
echo "TypeScript type-check failed"
exit 1
fi
if [[ "${{ needs.build-and-test.result }}" != "success" ]]; then
echo "JS build/test failed"
exit 1
fi