-
Notifications
You must be signed in to change notification settings - Fork 1
210 lines (172 loc) · 7.03 KB
/
main.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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
name: Main
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
concurrency:
# Cancel CI runs on a branch (other than main) on updates.defaults:
# This limits redundant runs, but also ensures we get signal on every
# merge to main.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ !contains(github.ref, 'main')}}
jobs:
quality:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4
# TODO: Caching
- name: Set up the environment
uses: ./.github/actions/setup-python-env
id: setup
- name: Install Python dependencies
run: uv sync --frozen --all-packages --all-extras
shell: bash
- name: Run `fmt-check`
run: uv run poe fmt-check
# Runs this as long as setup succeeds.
if: ${{ !cancelled() && steps.setup.conclusion == 'success' }}
- name: Run `lint-check`
run: uv run poe lint-check
# Runs this as long as setup succeeds.
if: ${{ !cancelled() && steps.setup.conclusion == 'success' }}
- name: Run `lock-check`
run: uv run poe lock-check
# Runs this as long as setup succeeds.
if: ${{ !cancelled() && steps.setup.conclusion == 'success' }}
- name: Run `dep-check`
run: uv run poe dep-check
# Runs this as long as setup succeeds.
if: ${{ !cancelled() && steps.setup.conclusion == 'success' }}
tests-and-type-check:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
fail-fast: false
defaults:
run:
shell: bash
steps:
- name: Check out
uses: actions/checkout@v4
- name: Set up the environment
uses: ./.github/actions/setup-python-env
with:
python-version: ${{ matrix.python-version }}
- name: (non-3.13) Install Python dependencies (including all extras)
if: ${{ success() && matrix.python-version != '3.13' }}
run: uv sync --frozen --all-packages --all-extras
shell: bash
- name: (3.13 only) Install Python dependencies (without extras)
if: ${{ success() && matrix.python-version == '3.13' }}
run: uv sync --frozen --all-packages
shell: bash
- name: Test graph-retriever
run:
uv run coverage run -m pytest -vs packages/graph-retriever
--junitxml=junit/test-results-gr-${{ matrix.python-version }}.xml
- name: (3.10, 3.11) Test langchain-graph-retriever (In-Memory Stores) with extras
if: ${{ success() && matrix.python-version == '3.10' || matrix.python-version == '3.11' }}
run: uv run pytest -vs --runextras packages/langchain-graph-retriever
--junitxml=junit/test-results-lgr-${{ matrix.python-version }}.xml
- name: (3.12) Test langchain-graph-retriever (All Stores) with extras
if: ${{ success() && matrix.python-version == '3.12' }}
id: test
run: uv run coverage run -a -m pytest -vs --runextras packages/langchain-graph-retriever --stores=all
--junitxml=junit/test-results-lgr-${{ matrix.python-version }}.xml
env:
ASTRA_DB_APPLICATION_TOKEN: ${{ secrets.ASTRA_DB_APPLICATION_TOKEN }}
ASTRA_DB_API_ENDPOINT: ${{ secrets.ASTRA_DB_API_ENDPOINT }}
ASTRA_DB_KEYSPACE: ci_${{ github.run_id }}_${{ strategy.job-index }}_${{ github.run_attempt }}
- name: (3.13) Test langchain-graph-retriever (In-Memory Stores) without extras
if: ${{ success() && matrix.python-version == '3.13' }}
run: uv run pytest -vs packages/langchain-graph-retriever
--junitxml=junit/test-results-lgr-${{ matrix.python-version }}.xml
- name: Drop Astra Keyspace
# Even though it seems redundant, the `always() &&` is necessary to signal to
# GitHub actions that we want this to run even if the job is cancelled.
if: ${{ always() && steps.test.conclusion != 'skipped' }}
run:
uv run scripts/drop-astra-keyspace.py
env:
ASTRA_DB_APPLICATION_TOKEN: ${{ secrets.ASTRA_DB_APPLICATION_TOKEN }}
ASTRA_DB_API_ENDPOINT: ${{ secrets.ASTRA_DB_API_ENDPOINT }}
ASTRA_DB_KEYSPACE: ci_${{ github.run_id }}_${{ strategy.job-index }}_${{ github.run_attempt }}
- name: Report Coverage
if: ${{ success() && matrix.python-version == '3.12' }}
run: |
uvx coveralls
uvx coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run `type-check`
run: uv run poe type-check
- name: Upload test results
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: pytest-results-${{ matrix.python-version }}
path: junit/test-results-*.xml
# See https://github.com/EnricoMi/publish-unit-test-result-action#support-fork-repositories-and-dependabot-branches to
# enable uploading from forks.
publish-test-results:
name: "Publish test results"
needs: tests-and-type-check
runs-on: ubuntu-latest
permissions:
checks: write
# only needed unless run with comment_mode: off
pull-requests: write
# only needed for private repository
contents: read
# only needed for private repository
issues: read
if: always()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
pattern: pytest-results-*
path: artifacts
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: "artifacts/**/*.xml"
build-docs:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4
- name: Set up the environment
uses: ./.github/actions/setup-python-env
- name: Sync Docs Dependencies
run: uv sync --all-packages --group=docs --all-extras
- name: Check if documentation can be built
run: uv run mkdocs build --strict
id: build
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ASTRA_DB_APPLICATION_TOKEN: ${{ secrets.ASTRA_DB_APPLICATION_TOKEN }}
ASTRA_DB_API_ENDPOINT: ${{ secrets.ASTRA_DB_API_ENDPOINT }}
docs-deploy:
# Deploy docs on push to main.
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write # to write to the `gh-pages` branch
steps:
- name: Check out
uses: actions/checkout@v4
- name: Set up the environment
uses: ./.github/actions/setup-python-env
- name: Sync Docs Dependencies
run: uv sync --all-packages --group=docs --all-extras
- name: Deploy Docs to gh-pages
run: uv run mkdocs gh-deploy --force
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ASTRA_DB_APPLICATION_TOKEN: ${{ secrets.ASTRA_DB_APPLICATION_TOKEN }}
ASTRA_DB_API_ENDPOINT: ${{ secrets.ASTRA_DB_API_ENDPOINT }}