Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions .github/workflows/js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# 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"
- "Cargo.toml"
- "Cargo.lock"
- ".github/workflows/js.yml"
pull_request:
branches: [main]
paths:
- "crates/bashkit-js/**"
- "crates/bashkit/src/**"
- "examples/*.mjs"
- "Cargo.toml"
- "Cargo.lock"
- ".github/workflows/js.yml"
workflow_dispatch:

permissions:
contents: read

env:
CARGO_TERM_COLOR: always
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN }}

jobs:
build-and-test:
name: Node ${{ matrix.node }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node: ["20", "22", "24", "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: ${{ matrix.node }}

- 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 tests
run: npm test
working-directory: crates/bashkit-js

- name: Link package for examples
run: |
mkdir -p node_modules/@everruns
ln -s ${{ github.workspace }}/crates/bashkit-js node_modules/@everruns/bashkit

- name: Run examples (self-contained)
run: |
node examples/bash_basics.mjs
node examples/data_pipeline.mjs
node examples/llm_tool.mjs

- name: Install AI SDK dependencies and re-link
run: |
echo '{"type":"module","private":true}' > package.json
npm install --no-save openai ai @ai-sdk/openai @langchain/core @langchain/langgraph @langchain/openai zod
rm -rf node_modules/@everruns/bashkit
mkdir -p node_modules/@everruns
ln -s ${{ github.workspace }}/crates/bashkit-js node_modules/@everruns/bashkit

- name: Install Doppler CLI
if: env.DOPPLER_TOKEN != ''
uses: dopplerhq/cli-action@v3

- name: Run AI examples
if: env.DOPPLER_TOKEN != ''
run: |
doppler run -- node examples/openai_tool.mjs
doppler run -- node examples/vercel_ai_tool.mjs
doppler run -- node examples/langchain_agent.mjs

# Gate job for branch protection
js-check:
name: JS Check
if: always()
needs: [build-and-test]
runs-on: ubuntu-latest
steps:
- name: Verify all jobs passed
run: |
if [[ "${{ needs.build-and-test.result }}" != "success" ]]; then
echo "JS build/test failed"
exit 1
fi
Loading
Loading