-
Notifications
You must be signed in to change notification settings - Fork 0
155 lines (141 loc) · 4.94 KB
/
ci.yml
File metadata and controls
155 lines (141 loc) · 4.94 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
changes:
name: Detect Changed Areas
runs-on: ubuntu-latest
outputs:
core: ${{ steps.filter.outputs.core }}
ai_sdk: ${{ steps.filter.outputs.ai_sdk }}
mastra: ${{ steps.filter.outputs.mastra }}
langchain: ${{ steps.filter.outputs.langchain }}
steps:
- uses: actions/checkout@v4
- name: Detect changed paths
id: filter
uses: dorny/paths-filter@v3
with:
filters: |
core:
- ".github/workflows/**"
- "src/**"
- "templates/_shared/**"
- "package.json"
- "bun.lock"
- "tsconfig.json"
- "eslint.config.mjs"
- ".prettierrc"
- ".prettierignore"
ai_sdk:
- "templates/ai-sdk/**"
mastra:
- "templates/mastra/**"
langchain:
- "templates/langchain/**"
lint-and-build:
name: Lint, Format & Build
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.core == 'true' || needs.changes.outputs.ai_sdk == 'true' || needs.changes.outputs.mastra == 'true' || needs.changes.outputs.langchain == 'true' }}
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- run: bun install
- run: bun run lint
- run: bun run format:check
- run: bun run typecheck
- run: bun 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
needs: changes
if: ${{ needs.changes.outputs.core == 'true' || needs.changes.outputs.langchain == 'true' }}
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: [changes, lint-and-build]
if: ${{ needs.changes.outputs.core == 'true' || (matrix.template == 'ai-sdk' && needs.changes.outputs.ai_sdk == 'true') || (matrix.template == 'mastra' && needs.changes.outputs.mastra == 'true') || (matrix.template == 'langchain' && needs.changes.outputs.langchain == 'true') }}
env:
PIP_DISABLE_PIP_VERSION_CHECK: "1"
strategy:
fail-fast: false
matrix:
template: [ai-sdk, mastra, langchain]
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- name: Cache bun packages
if: matrix.template != 'langchain'
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: bun-smoke-${{ matrix.template }}-${{ hashFiles(format('templates/{0}/package.json', matrix.template)) }}
restore-keys: |
bun-smoke-${{ matrix.template }}-
bun-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: bun install
- name: Download built CLI artifact
uses: actions/download-artifact@v4
with:
name: cli-dist
path: dist
- name: Scaffold template
run: bun 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: Doctor (Next.js + TypeScript templates)
if: matrix.template != 'langchain'
working-directory: ci-test-${{ matrix.template }}
run: bun run doctor
- name: Doctor (Python template)
if: matrix.template == 'langchain'
working-directory: ci-test-${{ matrix.template }}
run: python -m app.doctor
- name: Type check (Next.js + TypeScript templates)
if: matrix.template != 'langchain'
working-directory: ci-test-${{ matrix.template }}
run: bun run typecheck
- name: Build (Next.js + TypeScript templates)
if: matrix.template != 'langchain'
working-directory: ci-test-${{ matrix.template }}
run: bun run build
- name: Lint (Next.js + TypeScript templates)
if: matrix.template != 'langchain'
working-directory: ci-test-${{ matrix.template }}
run: bun 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 .