Skip to content

Add CI pipeline with linting, formatting, and smoke tests #14

Add CI pipeline with linting, formatting, and smoke tests

Add CI pipeline with linting, formatting, and smoke tests #14

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
lint-and-build:
name: Lint, Format & Build
runs-on: ubuntu-latest
env:
NPM_CONFIG_AUDIT: "false"
NPM_CONFIG_FUND: "false"
NPM_CONFIG_PREFER_OFFLINE: "true"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run lint
- run: npm run format:check
- run: npm run typecheck
- run: npm run build
- name: Upload built CLI artifact
uses: actions/upload-artifact@v4
with:
name: cli-dist
path: dist/
if-no-files-found: error
lint-python:
name: Lint Python Templates
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/ruff-action@v3
with:
args: check templates/langchain/
- uses: astral-sh/ruff-action@v3
with:
args: format --check templates/langchain/
smoke-test-templates:
name: Smoke Test — ${{ matrix.template }}
runs-on: ubuntu-latest
needs: lint-and-build
env:
NPM_CONFIG_AUDIT: "false"
NPM_CONFIG_FUND: "false"
NPM_CONFIG_PREFER_OFFLINE: "true"
PIP_DISABLE_PIP_VERSION_CHECK: "1"
strategy:
fail-fast: false
matrix:
template: [ai-sdk, mastra, langchain]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Cache npm packages
uses: actions/cache@v4
with:
path: ~/.npm
key: npm-smoke-${{ matrix.template }}-${{ hashFiles(format('templates/{0}/package.json', matrix.template), 'package-lock.json') }}
restore-keys: |
npm-smoke-${{ matrix.template }}-
npm-smoke-
- uses: actions/setup-python@v5
if: matrix.template == 'langchain'
with:
python-version: "3.12"
cache: pip
cache-dependency-path: templates/langchain/requirements.txt
- run: npm ci
- name: Download built CLI artifact
uses: actions/download-artifact@v4
with:
name: cli-dist
path: dist
- name: Scaffold template
run: node dist/index.js ci-test-${{ matrix.template }} --template ${{ matrix.template }}
- name: Create .env from example
working-directory: ci-test-${{ matrix.template }}
run: cp .env.example .env
- name: Type check (TypeScript templates)
if: matrix.template != 'langchain'
working-directory: ci-test-${{ matrix.template }}
run: npm run typecheck
- name: Build (TypeScript templates)
if: matrix.template != 'langchain'
working-directory: ci-test-${{ matrix.template }}
run: npm run build
- name: Lint (TypeScript templates)
if: matrix.template != 'langchain'
working-directory: ci-test-${{ matrix.template }}
run: npm run lint
- name: Lint (Python template)
if: matrix.template == 'langchain'
working-directory: ci-test-${{ matrix.template }}
run: |
pip install ruff ty
ruff check .
ruff format --check .
ty check .