-
Notifications
You must be signed in to change notification settings - Fork 105
185 lines (167 loc) · 6.22 KB
/
ci.yml
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: CI
on:
push:
branches: ["main"]
pull_request:
workflow_dispatch: # Allows triggering the workflow manually in GitHub UI
# If another push to the same PR or branch happens while this workflow is still running,
# cancel the earlier run in favor of the next run.
#
# There's no point in testing an outdated version of the code. GitHub only allows
# a limited number of job runners to be active at the same time, so it's better to cancel
# pointless jobs early so that more useful jobs can run sooner.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
NODE_VERSION: "22.4.1"
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
- name: Build
run: yarn build
lint:
name: Check linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
- name: Check linting
run: yarn run lint
format:
name: Check formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
- name: Check formatting
run: yarn run format:check
test:
name: Unit Tests
strategy:
matrix:
# See Node.js release schedule at https://nodejs.org/en/about/releases/
os: [ubuntu-latest]
node-version: [18.x, 20.x, "22.4.1"]
include:
- os: windows-latest
node-version: "22.4.1"
- os: macos-latest
node-version: "22.4.1"
runs-on: ${{ matrix.os }}
env:
PUPPETEER_SKIP_DOWNLOAD: "true"
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true"
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
- name: Install dependencies
run: yarn install --immutable
- name: Test
run: yarn run test
check-readmes-synced:
# This checks that the repo README.md is identical to the libs/langgraph/README.md
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Check README.md is in sync
run: |
if ! diff -q README.md libs/langgraph/README.md >/dev/null; then
echo "README.md is out of sync with langgraph/README.md"
diff -C 3 README.md langgraph/README.md
exit 1
fi
validate-dep-files:
name: Validate Deno and Node dependencies in sync
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get changed files
id: changed_files
uses: tj-actions/changed-files@v44
- name: Check for deno.json changes
id: check_deno_json
run: |
deno_json=$(echo '${{ steps.changed_files.outputs.all_changed_files }}' | tr ' ' '\n' | grep -E '^./deno.json$' || true)
echo "has_deno_json_changes=$([ -n "$deno_json" ] && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
- name: Use Node.js ${{ env.NODE_VERSION }}
if: steps.check_deno_json.outputs.has_deno_json_changes == 'true'
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
- name: Install dependencies
if: steps.check_deno_json.outputs.has_deno_json_changes == 'true'
run: yarn install --immutable
- name: Validate
if: steps.check_deno_json.outputs.has_deno_json_changes == 'true'
run: yarn tsx --experimental-wasm-modules ./scripts/validate_deps_sync.ts
validate-new-notebooks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get changed files
id: changed_files
uses: tj-actions/changed-files@v44
- name: Check for new or modified notebooks
id: check_notebooks
run: |
notebooks=$(echo '${{ steps.changed_files.outputs.all_changed_files }}' | tr ' ' '\n' | grep -E '^(docs/docs|examples)/.*\.ipynb$' || true)
echo "Affected notebooks: $notebooks"
echo "has_affected_notebooks=$([ -n "$notebooks" ] && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
- name: Use Node.js ${{ env.NODE_VERSION }}
if: steps.check_notebooks.outputs.has_affected_notebooks == 'true'
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
- name: Install dependencies
if: steps.check_notebooks.outputs.has_affected_notebooks == 'true'
run: yarn install --immutable
- name: Build LangGraph
if: steps.check_notebooks.outputs.has_affected_notebooks == 'true'
run: yarn build
- name: Validate affected notebooks
if: steps.check_notebooks.outputs.has_affected_notebooks == 'true'
run: |
notebooks=$(echo '${{ steps.changed_files.outputs.all_changed_files }}' | tr ' ' '\n' | grep -E '^(docs/docs|examples)/.*\.ipynb$' || true)
if [ -n "$notebooks" ]; then
cd ./libs/langgraph
for notebook in $notebooks; do
absolute_path="$GITHUB_WORKSPACE/$notebook"
yarn notebook_validate "$absolute_path"
done
else
echo "No notebooks to validate."
fi