-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (115 loc) · 3.51 KB
/
ci.yaml
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
name: CI
on:
push:
branches: [main]
pull_request:
merge_group:
workflow_dispatch:
env:
UV_VERSION: "0.5.21"
PNPM_VERSION: "9.7.0"
NODE_VERSION: "22.7.0"
jobs:
lint:
name: "lint"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
cache-dependency-glob: "uv.lock"
# The official GitHub setup-python action can be faster, because GitHub caches the Python
# versions alongside the runner.
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('uv.lock') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install project, validate lockfile
run: uv sync --locked --all-packages --all-extras --dev
- name: Ruff format
run: uv run ruff format --check
- name: Ruff check
run: uv run --all-packages ruff check --output-format=github
- name: Enable venv
run: echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: Pyright
uses: jakebailey/pyright-action@v2
with:
version: PATH
test:
name: "test"
runs-on: ubuntu-latest
strategy:
matrix:
chainlit-version:
- "chainlit"
- "git+https://github.com/Chainlit/chainlit.git#subdirectory=backend/"
python-version:
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: pnpm/action-setup@v4
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('uv.lock') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Set Chainlit version
run: uv add --no-sync ${{ matrix.chainlit-version }}
- name: Install the project
run: uv sync --locked --all-packages --all-extras --dev
- name: Run tests
run: uv run --all-packages pytest
ci:
runs-on: ubuntu-latest
name: CI
if: always() # This ensures the job always runs
needs: [lint, test]
steps:
# Propagate failure
- name: Check dependent jobs
if: contains(needs.*.result, 'success') != true || contains(needs.*.result, 'skipped')
run: |
echo "Not all required jobs succeeded"
exit 1