-
-
Notifications
You must be signed in to change notification settings - Fork 11
198 lines (163 loc) · 5.01 KB
/
Copy pathci.yml
File metadata and controls
198 lines (163 loc) · 5.01 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
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
name: CI
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
permissions:
contents: read
jobs:
actionlint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
cache: true
- name: Install actionlint
run: go install github.com/rhysd/actionlint/cmd/actionlint@latest
- name: Lint GitHub workflows
run: |
"$(go env GOPATH)/bin/actionlint" -color
detect-changes:
runs-on: ubuntu-latest
outputs:
go_core: ${{ steps.filter.outputs.go_core }}
python_client: ${{ steps.filter.outputs.python_client }}
typescript_client: ${{ steps.filter.outputs.typescript_client }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Detect changed paths
id: filter
uses: dorny/paths-filter@v3
with:
filters: |
go_core:
- 'api/**'
- 'cmd/**'
- 'pkg/**'
- 'tests/**'
- 'go.mod'
- 'go.sum'
- 'Makefile'
- '.github/workflows/ci.yml'
typescript_client:
- 'clients/typescript/**'
- 'api/proto/membrane/v1/membrane.proto'
- '.github/workflows/ci.yml'
python_client:
- 'clients/python/**'
- 'api/proto/membrane/v1/membrane.proto'
- '.github/workflows/ci.yml'
build-and-test:
needs: detect-changes
if: needs.detect-changes.outputs.go_core == 'true'
runs-on: ubuntu-latest
services:
postgres:
image: pgvector/pgvector:pg16
env:
POSTGRES_DB: membrane_test
POSTGRES_USER: membrane
POSTGRES_PASSWORD: membrane
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U membrane -d membrane_test"
--health-interval=10s
--health-timeout=5s
--health-retries=10
strategy:
matrix:
go-version: ['1.24', '1.25', '1.26']
env:
TEST_POSTGRES_DSN: postgres://membrane:membrane@127.0.0.1:5432/membrane_test?sslmode=disable
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: Download dependencies
run: go mod download
- name: Wait for Postgres
run: |
for attempt in $(seq 1 30); do
if pg_isready -h 127.0.0.1 -p 5432 -U membrane -d membrane_test; then
exit 0
fi
echo "Waiting for Postgres (${attempt}/30)..."
sleep 2
done
echo "Postgres did not become ready in time" >&2
exit 1
- name: Check formatting
run: test -z "$(gofmt -l .)"
- name: Check go mod tidy
run: |
go mod tidy
git diff --exit-code go.mod go.sum
- name: Build
run: go build ./...
- name: Run tests with coverage
run: go test -v -race -count=1 -coverprofile=coverage.out ./...
- name: Vet
run: go vet ./...
- name: Install and run staticcheck
if: matrix.go-version == '1.26'
run: |
go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck ./...
typescript-client:
needs: detect-changes
if: needs.detect-changes.outputs.typescript_client == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: npm
cache-dependency-path: clients/typescript/package-lock.json
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
cache: true
- name: Download Go dependencies
run: go mod download
- name: Install TypeScript client dependencies
run: npm ci
working-directory: clients/typescript
- name: Verify proto sync
run: npm run check:proto-sync
working-directory: clients/typescript
- name: Typecheck TypeScript client
run: npm run typecheck
working-directory: clients/typescript
- name: Test TypeScript client
run: npm test
working-directory: clients/typescript
python-client:
needs: detect-changes
if: needs.detect-changes.outputs.python_client == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Python client dependencies
run: python -m pip install -e "clients/python[dev]"
- name: Test Python client
run: python -m pytest clients/python/tests/