-
Notifications
You must be signed in to change notification settings - Fork 19
214 lines (204 loc) · 9.66 KB
/
win_test_template.yml
File metadata and controls
214 lines (204 loc) · 9.66 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
name: Windows Test Template
on:
workflow_call:
inputs:
CTEST_START:
required: false
type: number
default: 1
CTEST_END:
required: false
type: number
default: 999999
artifact_name:
required: true
type: string
MANTICORE_LOCATOR:
required: false
type: string
default: ""
USE_AVX2:
required: false
type: boolean
default: true
USE_AVX512:
required: false
type: boolean
default: false
jobs:
test_windows:
name: ${{ inputs.CTEST_START }}_${{ inputs.CTEST_END }}
runs-on: windows-2022
env:
CTEST_CMAKE_GENERATOR: "Visual Studio 17 2022"
CTEST_CONFIGURATION_TYPE: Debug
CTEST_START: ${{ inputs.CTEST_START }}
CTEST_END: ${{ inputs.CTEST_END }}
MANTICORE_LOCATOR: ${{ inputs.MANTICORE_LOCATOR }}
# The following is useful to test a specific test, just uncomment it, no need to disable CTEST_START/END
# CTEST_REGEX: test_234
NO_BUILD: 1
steps:
- name: Checkout repository # We have to checkout to access .github/workflows/ in further steps
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Print Manticore Locator
shell: pwsh
run: |
$locator = "${{ inputs.MANTICORE_LOCATOR }}"
Write-Host "Using MANTICORE_LOCATOR: '$locator'"
if ($locator) {
Write-Host "Manticore locator is set and will be used for testing"
} else {
Write-Host "Manticore locator is empty, using default manticore sources"
}
- name: Determine branch name for cache
id: branch
run: |
if ("${{ github.event_name }}" -eq "pull_request") {
echo "branch_name=${{ github.head_ref }}" >> $env:GITHUB_OUTPUT
} else {
echo "branch_name=${{ github.ref_name }}" >> $env:GITHUB_OUTPUT
}
- name: Determine current disk and set environment variables
shell: powershell
run: |
# Get the current working directory and extract the drive letter
$currentPath = Get-Location
$driveLetter = $currentPath.Drive.Name
Write-Host "Current drive: $driveLetter"
# Set environment variables with the correct drive letter
$env:CACHEB = "$driveLetter`:/a/columnar/columnar/cache"
$env:LIBS_BUNDLE = "$driveLetter`:/a/columnar/columnar/bundle"
$env:BOOST_ROOT = "$driveLetter`:/a/columnar/columnar/boost_1_75_0"
# Output the environment variables for debugging
Write-Host "CACHEB: $env:CACHEB"
Write-Host "LIBS_BUNDLE: $env:LIBS_BUNDLE"
Write-Host "BOOST_ROOT: $env:BOOST_ROOT"
# Set these as step outputs for use in subsequent steps
"CACHEB=$env:CACHEB" >> $env:GITHUB_ENV
"LIBS_BUNDLE=$env:LIBS_BUNDLE" >> $env:GITHUB_ENV
"BOOST_ROOT=$env:BOOST_ROOT" >> $env:GITHUB_ENV
- name: Download build artifacts
uses: manticoresoftware/download_artifact_with_retries@v4
with:
name: build_windows_Debug_x64
path: .
- name: Cache Windows bundle
id: bundle_cache
uses: actions/cache@v4
with:
path: |
bundle
boost_1_75_0
key: win_bundle_v1
- name: Download bundle if cache missed
if: steps.bundle_cache.outputs.cache-hit != 'true'
shell: bash
run: |
curl -sL -o sysroot_windows_x64.tar.xz https://repo.manticoresearch.com/repository/sysroots/roots_nov22/sysroot_windows_x64.tar.xz
tar -xf sysroot_windows_x64.tar.xz diskc/winbundle
mv diskc/winbundle bundle
curl -sL -o boost_1_75_0.tgz https://repo.manticoresearch.com/repository/ci/boost_1_75_0.tgz
tar -xf boost_1_75_0.tgz
- name: Remove ZSTD # cross-OS build/deps caches saved on Linux without zstd; must match compression method
run: rm C:\tools\zstd\zstd.exe
- name: Check out main cache
uses: actions/cache@v4
with:
path: cache
enableCrossOsArchive: true
key: build_windows_x64_${{ steps.branch.outputs.branch_name }}
restore-keys: build_windows_x64_master
- name: Check out deps cache
uses: actions/cache@v4
with:
path: build/_deps/cache
enableCrossOsArchive: true
key: build_windows_x64_deps_${{ steps.branch.outputs.branch_name }}
restore-keys: build_windows_x64_deps_master
- run: mv build/_deps/cache/windows-amd64/* cache/windows-amd64/
- name: Copy libraries close to the binaries
run: |
cp bundle/mysql-x64/lib/debug/libmysql* build/_deps/manticore-build/src/Debug/
cp bundle/Expat-1.95.8-x64/Libs/libexpat* build/_deps/manticore-build/src/Debug/
cp bundle/libiconv-1.9.1-x64/lib/iconv* build/_deps/manticore-build/src/Debug/
- name: Setup Flex and Bison
run: Install-ChocoPackage winflexbison3
- name: Run mysql
run: |
C:\PROGRA~1\MySQL\"MySQL Server 8.0"\bin\mysqld.exe --initialize-insecure
C:\PROGRA~1\MySQL\"MySQL Server 8.0"\bin\mysqld.exe --install mysql
net start mysql
mysql -e "create user 'test'@'localhost' IDENTIFIED WITH mysql_native_password BY ''; create database test; grant all on test.* to 'test'@'localhost'; flush privileges;" -uroot
# TODO: Uncomment the below if there's no more OpenSSL in the runner like it happened in Sep 2023 (https://github.com/actions/runner-images/issues/8344)
# - name: Install OpenSSL
# run: powershell.exe ./.github/workflows/Install-OpenSSL.ps1
- name: Setup PHP and mysqli
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mysqli
- name: Download embeddings lib
uses: manticoresoftware/download_artifact_with_retries@v4
continue-on-error: true
with:
name: embeddings_windows_x86_64
path: ./embeddings-lib/
- name: Initialization of embeddings lib
run: |
mkdir embeddings\target
mkdir embeddings\target\release
mv .\embeddings-lib\build\* embeddings\target\release\
rm -r ./embeddings-lib
$embeddingsDir = (Resolve-Path "embeddings\target\release").Path
$env:PATH = "$embeddingsDir;$env:PATH"
echo $embeddingsDir | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
Write-Host "Added embeddings runtime directory to PATH: $embeddingsDir"
- name: Replace standard libs to AVX2
if: ${{ inputs.USE_AVX2 == true }}
run: |
if (Test-Path -Path "D:\a\columnar\columnar\build\columnar\Debug\") {
Write-Host "Moving Windows-based AVX2 libs"
Move-Item -Path "D:\a\columnar\columnar\build\columnar\Debug\lib_manticore_columnar_avx2.dll" -Destination "D:\a\columnar\columnar\build\columnar\Debug\lib_manticore_columnar.dll" -Force
Move-Item -Path "D:\a\columnar\columnar\build\secondary\Debug\lib_manticore_secondary_avx2.dll" -Destination "D:\a\columnar\columnar\build\secondary\Debug\lib_manticore_secondary.dll" -Force
Move-Item -Path "D:\a\columnar\columnar\build\knn\Debug\lib_manticore_knn_avx2.dll" -Destination "D:\a\columnar\columnar\build\knn\Debug\lib_manticore_knn.dll" -Force
} else {
Write-Host "Directory D:\a\columnar\columnar\build\columnar\Debug\ does not exist"
}
- name: Replace standard libs to AVX-512
if: ${{ inputs.USE_AVX512 == true }}
run: |
if (Test-Path -Path "D:\a\columnar\columnar\build\columnar\Debug\") {
Write-Host "Moving Windows-based AVX-512 libs"
Move-Item -Path "D:\a\columnar\columnar\build\columnar\Debug\lib_manticore_columnar_avx512.dll" -Destination "D:\a\columnar\columnar\build\columnar\Debug\lib_manticore_columnar.dll" -Force
Move-Item -Path "D:\a\columnar\columnar\build\secondary\Debug\lib_manticore_secondary_avx512.dll" -Destination "D:\a\columnar\columnar\build\secondary\Debug\lib_manticore_secondary.dll" -Force
Move-Item -Path "D:\a\columnar\columnar\build\knn\Debug\lib_manticore_knn_avx512.dll" -Destination "D:\a\columnar\columnar\build\knn\Debug\lib_manticore_knn.dll" -Force
} else {
Write-Host "Directory D:\a\columnar\columnar\build\columnar\Debug\ does not exist"
}
- name: 🚀 Test
id: test
# --timeout may be not working https://gitlab.kitware.com/cmake/cmake/-/issues/23979
# Add -VV to ctest to display extra debug info
run: ctest -VV -S cmake/citest.cmake -C $CTEST_CONFIGURATION_TYPE --no-compress-output --timeout 60
continue-on-error: true
- name: Remember status
if: always()
run: echo "${{ steps.test.outcome }}" > build/status_${{ inputs.CTEST_START }}_${{ inputs.CTEST_END }}
continue-on-error: true
- name: Prepare test results
if: always()
run: |
mkdir build/xml_${{ inputs.CTEST_START }}_${{ inputs.CTEST_END }}
cp build/Testing/2*/Test.xml build/xml_${{ inputs.CTEST_START }}_${{ inputs.CTEST_END }}/
mv build/_deps/manticore-build/test build/test_${{ inputs.CTEST_START }}_${{ inputs.CTEST_END }}
continue-on-error: true
- name: Upload test artifacts
if: always()
continue-on-error: true
uses: manticoresoftware/upload_artifact_with_retries@main
with:
name: ${{ inputs.artifact_name }}
path: "build/xml* build/test_*/test_*/report* build/test_*/error*.txt build/test_*/*log build/status*"