-
Notifications
You must be signed in to change notification settings - Fork 154
284 lines (252 loc) · 7.71 KB
/
prerelease.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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
name: Pre-Release
on:
push:
branches: ["main-dev"]
pull_request:
branches: ["main-dev"]
env:
BUILD_TYPE: Release
GH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
PYTHONUTF8: 1
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
jobs:
test_c:
name: Test C
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: main-dev
- run: git submodule update --init --recursive
- name: Prepare Environment
run: |
sudo apt update &&
sudo apt install -y cmake g++-12 build-essential libjemalloc-dev
- name: Build
run: |
cmake -B ./build_release \
-DCMAKE_CXX_COMPILER="g++-12" \
-DCMAKE_BUILD_TYPE=Release \
-DUSEARCH_BUILD_CTEST=1 \
-DUSEARCH_USE_OPENMP=1 \
-DUSEARCH_USE_SIMSIMD=1 \
-DUSEARCH_USE_JEMALLOC=1 \
-DUSEARCH_BUILD_BENCHMARK=0 &&
make -C ./build_release -j
- name: Run tests
run: ./build_release/test_c
test_cpp:
name: Test C++
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: main-dev
- run: git submodule update --init --recursive
- name: Prepare Environment
run: |
sudo apt update &&
sudo apt install -y cmake g++-12 build-essential libjemalloc-dev
- name: Build
run: |
cmake -B ./build_release \
-DCMAKE_CXX_COMPILER="g++-12" \
-DCMAKE_BUILD_TYPE=Release \
-DUSEARCH_BUILD_TEST=1 \
-DUSEARCH_USE_OPENMP=1 \
-DUSEARCH_USE_SIMSIMD=1 \
-DUSEARCH_USE_JEMALLOC=1 \
-DUSEARCH_BUILD_BENCHMARK=0 &&
make -C ./build_release -j
- name: Run tests
run: ./build_release/test
test_python_311:
name: Test Python
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macOS-11, windows-2022]
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
- run: git submodule update --init --recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest numpy
- name: Build locally on Ubuntu
run: |
export CC=/usr/bin/gcc-12
export CXX=/usr/bin/g++-12
export LD_LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/12/:$LD_LIBRARY_PATH
python -m pip install .
if: ${{ matrix.os == 'ubuntu-22.04' }}
- name: Build locally
run: python -m pip install .
if: ${{ matrix.os != 'ubuntu-22.04' }}
- name: Test with PyTest
run: pytest python/scripts/ -s -x
test_python_37:
name: Test Python 3.7
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
python-version: ["3.7"]
steps:
- uses: actions/checkout@v3
- run: git submodule update --init --recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest numpy
- name: Build locally
run: |
export CC=/usr/bin/gcc-12
export CXX=/usr/bin/g++-12
export LD_LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/12/:$LD_LIBRARY_PATH
python -m pip install .
if: ${{ matrix.os == 'ubuntu-22.04' }}
- name: Test with PyTest
run: pytest python/scripts/ -s -x
test_javascript:
name: Test JavaScript
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: git submodule update --init --recursive
- uses: actions/setup-node@v3
with:
node-version: 18
- run: |
export CC=/usr/bin/gcc-12
export CXX=/usr/bin/g++-12
npm install
- run: npm ci
- run: npm test
test_rust:
name: Test Rust
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: git submodule update --init --recursive
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
test_java:
name: Test Java
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: git submodule update --init --recursive
- uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
- name: Setup Gradle
uses: gradle/[email protected]
- name: Execute Gradle build
run:
export CC=/usr/bin/gcc-12
export CXX=/usr/bin/g++-12
gradle clean build
test_swift:
name: Test ObjC & Swift
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- run: git submodule update --init --recursive
- name: Build
run: swift build
- name: Run tests
run: swift test
test_csharp:
name: Test C#
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
dotnet-version: ['7.0.x']
steps:
- uses: actions/checkout@v3
- run: git submodule update --init --recursive
- name: Setup .NET ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Ubuntu/macOS build native lib
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: ./build_lib.sh
shell: bash
working-directory: ${{ github.workspace }}/csharp/eng/
# Use cl.exe https://www.appveyor.com/docs/lang/cpp/#visual-studio-2017
# There is no support for c++11
- name: Windows MSVC build
if: matrix.os == 'windows-latest'
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
where cl
cl /EHsc /std:c++14 /O2 /LD /Fe:libusearch_c.dll lib.cpp /I. /I../include/ /I../fp16/include/
working-directory: ${{ github.workspace }}/c
shell: cmd
- name: Windows move dll to lib dir
if: matrix.os == 'windows-latest'
run: |
mkdir -p "${GITHUB_WORKSPACE}/csharp/lib/runtimes/win-x64/native"
mv "${GITHUB_WORKSPACE}/c/libusearch_c.dll" "${GITHUB_WORKSPACE}/csharp/lib/runtimes/win-x64/native"
shell: bash
- name: Build and test
run: dotnet test -c Release
shell: bash
working-directory: ${{ github.workspace }}/csharp/
test_golang:
name: Test Golang
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
ref: 'main-dev'
- run: git submodule update --init --recursive
- name: Prepare environment
run: |
sudo apt update &&
sudo apt install -y cmake g++-12 build-essential libjemalloc-dev
- name: Build library
run: |
cd golang/
export CC=/usr/bin/gcc-12
export CXX=/usr/bin/g++-12
make -C ../c libusearch_c.so
sudo mv ../c/libusearch_c.so /usr/local/lib/libusearch.a
sudo mv ../c/usearch.h /usr/local/include/usearch.h
- name: Run test
run: |
cd golang
go test -v
build_docker:
name: Test Docker Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: git submodule update --init --recursive
- name: Build
uses: docker/build-push-action@v4
with:
context: .
load: true
push: false