Skip to content

Initial commit (#31) #76

Initial commit (#31)

Initial commit (#31) #76

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
jobs:
build-and-lint:
name: Build & Lint (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: ["24.x"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Enable Corepack
run: corepack enable
- name: Setup pnpm
run: |
corepack prepare pnpm@10.12.1 --activate
pnpm config set store-dir ~/.pnpm-store
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-${{ matrix.node-version }}-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run ESLint
run: pnpm run eslint
- name: Run Prettier check
run: pnpm run prettier
- name: Run TypeScript type check
run: pnpm run typecheck
- name: Build SDK
run: pnpm run build
unit-tests:
name: Unit Tests (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: ["24.x"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Enable Corepack
run: corepack enable
- name: Setup pnpm
run: |
corepack prepare pnpm@10.12.1 --activate
pnpm config set store-dir ~/.pnpm-store
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-${{ matrix.node-version }}-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run unit tests
run: pnpm run test
integration-tests:
name: Integration Tests (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: ["24.x"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq
- name: Enable Corepack
run: corepack enable
- name: Setup pnpm
run: |
corepack prepare pnpm@10.12.1 --activate
pnpm config set store-dir ~/.pnpm-store
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-${{ matrix.node-version }}-
- name: Install root dependencies
run: pnpm install --frozen-lockfile
- name: Build SDK
run: pnpm run build
- name: Install test dependencies
run: |
for dir in tests/*/; do
if [ -f "$dir/bb.test.json" ]; then
echo "Installing dependencies for $(basename $dir)..."
(cd "$dir" && pnpm install --frozen-lockfile)
fi
done
- name: Make test scripts executable
run: chmod +x tests/*.sh
- name: Run all integration tests
working-directory: tests
env:
BROWSERBASE_API_KEY: ${{ secrets.BB_INTEGRATION_TEST_API_KEY }}
BROWSERBASE_PROJECT_ID: ${{ secrets.BB_INTEGRATION_TEST_PROJECT_ID }}
run: ./run-all-tests.sh