-
Notifications
You must be signed in to change notification settings - Fork 0
198 lines (175 loc) · 5.93 KB
/
ci.yml
File metadata and controls
198 lines (175 loc) · 5.93 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: [master, dev]
pull_request:
branches: [master]
env:
REGISTRY: ghcr.io
DOTNET_VERSION: '10.0.x'
NODE_VERSION: '22'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
# Quick validation that everything builds
validate:
name: Validate
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
ports:
- 5432:5432
env:
POSTGRES_USER: conduit
POSTGRES_PASSWORD: conduitpass
POSTGRES_DB: conduitdb
options: >-
--health-cmd "pg_isready -U conduit -d conduitdb"
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
cache-dependency-path: |
SDKs/Node/package-lock.json
SDKs/Node/Admin/package-lock.json
SDKs/Node/Core/package-lock.json
SDKs/Node/Common/package-lock.json
WebAdmin/package-lock.json
- name: .NET Build & Test
run: |
dotnet restore
dotnet build --no-restore
# Run tests but exclude integration tests and timing-sensitive tests
dotnet test --no-build --verbosity normal --filter "FullyQualifiedName!~IntegrationTests&Category!=TimingSensitive"
env:
TEST_REDIS_CONNECTION: localhost:6379
DATABASE_URL: postgresql://conduit:conduitpass@localhost:5432/conduitdb
- name: NPM Build
run: |
cd SDKs/Node
npm ci
npm run build
npm run test:ci
- name: WebAdmin Lint & Type Check
run: |
cd WebAdmin
npm ci
# Clean any stale .next directory before type checking
rm -rf .next
npm run lint
npm run type-check
# Build Docker images (push only from master)
docker:
name: Docker - ${{ matrix.service }}
runs-on: ubuntu-latest
needs: validate
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- service: webadmin
context: .
dockerfile: WebAdmin/Dockerfile
- service: http
context: .
dockerfile: Services/ConduitLLM.Http/Dockerfile
- service: admin
context: .
dockerfile: Services/ConduitLLM.Admin/Dockerfile
steps:
- uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/knnlabs/conduit-${{ matrix.service }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=sha,prefix={{branch}}-
type=raw,value=latest,enable={{is_default_branch}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
platforms: linux/amd64
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ matrix.service }}
cache-to: type=gha,scope=${{ matrix.service }},mode=max
# Publish NPM packages (only from master)
npm-publish:
name: NPM Publish
runs-on: ubuntu-latest
needs: validate
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'
cache: npm
cache-dependency-path: |
SDKs/Node/package-lock.json
SDKs/Node/Admin/package-lock.json
SDKs/Node/Core/package-lock.json
SDKs/Node/Common/package-lock.json
- name: Build and Publish
run: |
cd SDKs/Node
npm ci
npm run build
# Generate unique timestamp suffix for continuous releases
TIMESTAMP=$(date +%s)
# Update version and publish Common first (others depend on it)
cd Common
CURRENT_VERSION=$(node -p "require('./package.json').version")
npm version "${CURRENT_VERSION}-next.${TIMESTAMP}" --no-git-tag-version
npm publish --tag next --access public
# Update version and publish Admin
cd ../Admin
CURRENT_VERSION=$(node -p "require('./package.json').version")
npm version "${CURRENT_VERSION}-next.${TIMESTAMP}" --no-git-tag-version
npm publish --tag next --access public
# Update version and publish Core
cd ../Core
CURRENT_VERSION=$(node -p "require('./package.json').version")
npm version "${CURRENT_VERSION}-next.${TIMESTAMP}" --no-git-tag-version
npm publish --tag next --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}