-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub-workflow.yml
More file actions
169 lines (139 loc) · 4.11 KB
/
github-workflow.yml
File metadata and controls
169 lines (139 loc) · 4.11 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
#
// workflow.yml
// VectorDataStore
//
// Created by Nicholas Reich on 10/24/25.
//
name: VectorDataStore CI/CD
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
workflow_dispatch:
env:
SWIFT_VERSION: '6.2'
jobs:
# Run tests on multiple platforms
test:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-14, ubuntu-latest]
include:
- os: macos-14
platform: macOS
- os: ubuntu-latest
platform: Linux
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Swift (macOS)
if: matrix.os == 'macos-14'
uses: swift-actions/setup-swift@v2
with:
swift-version: ${{ env.SWIFT_VERSION }}
- name: Setup Swift (Linux)
if: matrix.os == 'ubuntu-latest'
uses: swift-actions/setup-swift@v2
with:
swift-version: ${{ env.SWIFT_VERSION }}
- name: Cache Swift packages
uses: actions/cache@v4
with:
path: |
.build
~/Library/Caches/org.swift.swiftpm
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Build
run: swift build -v
- name: Run tests
run: swift test --enable-swift-testing --enable-code-coverage
- name: Generate coverage report (macOS only)
if: matrix.os == 'macos-14'
run: |
xcrun llvm-cov export -format="lcov" \
.build/debug/VectorDataStorePackageTests.xctest/Contents/MacOS/VectorDataStorePackageTests \
-instr-profile .build/debug/codecov/default.profdata > coverage.lcov
- name: Upload coverage to Codecov
if: matrix.os == 'macos-14'
uses: codecov/codecov-action@v4
with:
files: ./coverage.lcov
flags: unittests
name: codecov-${{ matrix.os }}
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
# Lint code quality
lint:
name: SwiftLint
runs-on: macos-14
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install SwiftLint
run: brew install swiftlint
- name: Run SwiftLint
run: swiftlint lint --strict --reporter github-actions-logging
# Build documentation
docs:
name: Build Documentation
runs-on: macos-14
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Swift
uses: swift-actions/setup-swift@v2
with:
swift-version: ${{ env.SWIFT_VERSION }}
- name: Build documentation
run: |
swift package generate-documentation --target VectorDataStore
# Integration test with real Qdrant (optional)
integration-test:
name: Integration Tests with Qdrant
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
services:
qdrant:
image: qdrant/qdrant:latest
ports:
- 6333:6333
options: >-
--health-cmd "curl -f http://localhost:6333/readyz || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Swift
uses: swift-actions/setup-swift@v2
with:
swift-version: ${{ env.SWIFT_VERSION }}
- name: Wait for Qdrant
run: |
timeout 60 bash -c 'until curl -f http://localhost:6333/readyz; do sleep 2; done'
- name: Run integration tests
env:
QDRANT_ENDPOINT: http://localhost:6333
run: swift test --filter IntegrationTests
# Release job (triggered on tags)
release:
name: Create Release
runs-on: macos-14
if: startsWith(github.ref, 'refs/tags/')
needs: [test, lint, docs]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}