Skip to content

Docs/inline code formatting #51

Docs/inline code formatting

Docs/inline code formatting #51

Workflow file for this run

name: Build and test
on:
push:
branches: [main]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
BASE_NODE_VERSION: 24
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-node@v6
with:
node-version: ${{ env.BASE_NODE_VERSION }}
cache: npm
- run: npm ci
- run: npm run build
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-node@v6
with:
node-version: ${{ env.BASE_NODE_VERSION }}
cache: npm
- run: npm ci
- run: npm run typecheck
- run: npm run format:check
- run: npm run lint
- run: npm run check:error-codes
test:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
strategy:
fail-fast: false
matrix:
node-version: [20, 22, 24]
name: test node ${{ matrix.node-version }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
# Only collect coverage on the base Node version to avoid redundant work
- name: test with coverage
if: ${{ matrix.node-version == env.BASE_NODE_VERSION }}
run: npm test -- --coverage
- name: test
if: ${{ matrix.node-version != env.BASE_NODE_VERSION }}
run: npm test
# Post coverage summary as a PR comment. Restricted to PRs from the main
# repo (not forks) because the action needs write permissions that fork
# PRs don't have. Runs even if tests fail so we still get the report.
- uses: davelosert/vitest-coverage-report-action@v2
if: >-
github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == 'ably/ably-ai-transport-js' &&
matrix.node-version == env.BASE_NODE_VERSION &&
(failure() || success())
test-integration:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [20, 22, 24]
name: test-integration node ${{ matrix.node-version }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
- run: npm run test:integration
demo-app:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
demo:
- demo/vercel/react/use-chat
- demo/vercel/react/use-client-transport
name: demo ${{ matrix.demo }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-node@v6
with:
node-version: ${{ env.BASE_NODE_VERSION }}
cache: npm
- name: npm ci (lib)
run: npm ci
- name: npm run build (lib)
run: npm run build
- name: npm ci (demo)
run: npm ci
working-directory: ${{ matrix.demo }}
- name: npm run build (demo)
run: npm run build
working-directory: ${{ matrix.demo }}
# Dummy keys for Next.js build - module-level SDK client initialization
# runs during bundling even though the routes are never called at build time
env:
ABLY_API_KEY: dummy:key