-
Notifications
You must be signed in to change notification settings - Fork 2
119 lines (108 loc) · 3.31 KB
/
Copy pathci.yml
File metadata and controls
119 lines (108 loc) · 3.31 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
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 .