Skip to content

Commit d5bdeeb

Browse files
committed
build: fix native Maven build CI
1 parent e15d6ef commit d5bdeeb

3 files changed

Lines changed: 109 additions & 13 deletions

File tree

ci/run_tests_pipeline.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ stages:
2828
- checkout: self
2929
fetchDepth: 0
3030
lfs: false
31-
submodules: false
31+
submodules: recursive
3232
- bash: |
3333
git fetch origin $(System.PullRequest.SourceBranch)
3434
git checkout FETCH_HEAD
@@ -58,7 +58,7 @@ stages:
5858
imageName: "macos-15"
5959
poolName: "Azure Pipelines"
6060
jdkArch: "x64"
61-
windows-msvc-2022-x64:
61+
windows-mingw-2022-x64:
6262
imageName: "windows-2022"
6363
poolName: "Azure Pipelines"
6464
jdkArch: "x64"
@@ -70,7 +70,7 @@ stages:
7070
- checkout: self
7171
fetchDepth: 1
7272
lfs: false
73-
submodules: false
73+
submodules: recursive
7474
- template: setup.yaml
7575
- bash: echo "##vso[task.setvariable variable=HOME]$USERPROFILE"
7676
displayName: "Set HOME on Windows"
@@ -139,7 +139,7 @@ stages:
139139
- checkout: self
140140
fetchDepth: 1
141141
lfs: false
142-
submodules: false
142+
submodules: recursive
143143
persistCredentials: true
144144
- template: setup.yaml
145145
- task: Cache@2

ci/setup.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
steps:
2+
- bash: git submodule update --init --recursive
3+
displayName: "Initialize native submodules"
4+
condition: ne(variables['Agent.OS'], 'Windows_NT')
5+
6+
- powershell: git submodule update --init --recursive
7+
displayName: "Initialize native submodules"
8+
condition: eq(variables['Agent.OS'], 'Windows_NT')
9+
210
- bash: |
311
set -eux
412
case "$(jdkArch)" in
@@ -44,6 +52,43 @@ steps:
4452
displayName: "Install GraalVM JDK 25 (Windows)"
4553
condition: eq(variables['Agent.OS'], 'Windows_NT')
4654
55+
- bash: |
56+
set -eux
57+
sudo apt-get update
58+
sudo apt-get install -y cmake nasm build-essential
59+
displayName: "Install native build tools (Linux)"
60+
condition: eq(variables['Agent.OS'], 'Linux')
61+
62+
- bash: |
63+
set -eux
64+
for pkg in cmake nasm; do
65+
brew list "$pkg" >/dev/null 2>&1 || brew install "$pkg"
66+
done
67+
displayName: "Install native build tools (macOS)"
68+
condition: eq(variables['Agent.OS'], 'Darwin')
69+
70+
- powershell: |
71+
$ErrorActionPreference = "Stop"
72+
73+
choco install msys2 --no-progress -y
74+
75+
$msysRoot = @("C:\tools\msys64", "C:\msys64") |
76+
Where-Object { Test-Path (Join-Path $_ "usr\bin\bash.exe") } |
77+
Select-Object -First 1
78+
if (-not $msysRoot) {
79+
throw "MSYS2 installation was not found"
80+
}
81+
82+
$bash = Join-Path $msysRoot "usr\bin\bash.exe"
83+
& $bash -lc "pacman --noconfirm -Sy --needed mingw-w64-x86_64-gcc mingw-w64-x86_64-nasm mingw-w64-x86_64-ninja"
84+
if ($LASTEXITCODE -ne 0) {
85+
exit $LASTEXITCODE
86+
}
87+
88+
Write-Host "##vso[task.prependpath]$msysRoot\mingw64\bin"
89+
displayName: "Install native build tools (Windows)"
90+
condition: eq(variables['Agent.OS'], 'Windows_NT')
91+
4792
- bash: sudo sysctl -w fs.file-max=500000
4893
displayName: "Increase file count on Linux"
4994
condition: startsWith(variables['imageName'], 'ubuntu')

core/pom.xml

Lines changed: 60 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
<questdb.client.native.build.type>Release</questdb.client.native.build.type>
4242
<questdb.client.native.build.dir>${project.build.directory}/cmake-build-${platform.dir.name}</questdb.client.native.build.dir>
4343
<questdb.client.native.output.dir>${project.build.outputDirectory}/io/questdb/client/bin/${platform.dir.name}</questdb.client.native.output.dir>
44+
<questdb.client.native.configure.extra.args></questdb.client.native.configure.extra.args>
4445
</properties>
4546

4647
<version>1.3.4-SNAPSHOT</version>
@@ -210,15 +211,7 @@
210211
<skip>${questdb.client.native.skip}</skip>
211212
<workingDirectory>${project.basedir}</workingDirectory>
212213
<executable>cmake</executable>
213-
<arguments>
214-
<argument>-S</argument>
215-
<argument>${project.basedir}</argument>
216-
<argument>-B</argument>
217-
<argument>${questdb.client.native.build.dir}</argument>
218-
<argument>-DCMAKE_BUILD_TYPE=${questdb.client.native.build.type}</argument>
219-
<argument>-DQUESTDB_CLIENT_NATIVE_OUTPUT_DIR=${questdb.client.native.output.dir}</argument>
220-
<argument>-DQUESTDB_CLIENT_NATIVE_COPY_BIN_LOCAL=OFF</argument>
221-
</arguments>
214+
<commandlineArgs>-S "${project.basedir}" -B "${questdb.client.native.build.dir}" -DCMAKE_BUILD_TYPE=${questdb.client.native.build.type} -DQUESTDB_CLIENT_NATIVE_OUTPUT_DIR="${questdb.client.native.output.dir}" -DQUESTDB_CLIENT_NATIVE_COPY_BIN_LOCAL=OFF ${questdb.client.native.configure.extra.args}</commandlineArgs>
222215
</configuration>
223216
</execution>
224217
<execution>
@@ -303,6 +296,7 @@
303296
<properties>
304297
<platform.dir.name>windows-x86-64</platform.dir.name>
305298
<questdb.client.native.skip>false</questdb.client.native.skip>
299+
<questdb.client.native.configure.extra.args>-G Ninja -DCMAKE_TOOLCHAIN_FILE="${project.basedir}/src/main/c/toolchains/windows-x86_64.cmake"</questdb.client.native.configure.extra.args>
306300
</properties>
307301
</profile>
308302
<profile>
@@ -403,6 +397,63 @@
403397
</properties>
404398
<build>
405399
<plugins>
400+
<plugin>
401+
<groupId>org.apache.maven.plugins</groupId>
402+
<artifactId>maven-antrun-plugin</artifactId>
403+
<version>3.1.0</version>
404+
<executions>
405+
<execution>
406+
<id>validate-release-native-artifacts</id>
407+
<phase>validate</phase>
408+
<goals>
409+
<goal>run</goal>
410+
</goals>
411+
<configuration>
412+
<target name="validate-release-native-artifacts">
413+
<condition property="native.darwin.aarch64.present">
414+
<and>
415+
<available file="${project.build.directory}/native-libs/io/questdb/client/bin/darwin-aarch64/libquestdb.dylib" type="file"/>
416+
<length file="${project.build.directory}/native-libs/io/questdb/client/bin/darwin-aarch64/libquestdb.dylib" when="greater" length="0"/>
417+
</and>
418+
</condition>
419+
<fail unless="native.darwin.aarch64.present" message="Missing or empty release native artifact: ${project.build.directory}/native-libs/io/questdb/client/bin/darwin-aarch64/libquestdb.dylib"/>
420+
421+
<condition property="native.darwin.x8664.present">
422+
<and>
423+
<available file="${project.build.directory}/native-libs/io/questdb/client/bin/darwin-x86-64/libquestdb.dylib" type="file"/>
424+
<length file="${project.build.directory}/native-libs/io/questdb/client/bin/darwin-x86-64/libquestdb.dylib" when="greater" length="0"/>
425+
</and>
426+
</condition>
427+
<fail unless="native.darwin.x8664.present" message="Missing or empty release native artifact: ${project.build.directory}/native-libs/io/questdb/client/bin/darwin-x86-64/libquestdb.dylib"/>
428+
429+
<condition property="native.linux.aarch64.present">
430+
<and>
431+
<available file="${project.build.directory}/native-libs/io/questdb/client/bin/linux-aarch64/libquestdb.so" type="file"/>
432+
<length file="${project.build.directory}/native-libs/io/questdb/client/bin/linux-aarch64/libquestdb.so" when="greater" length="0"/>
433+
</and>
434+
</condition>
435+
<fail unless="native.linux.aarch64.present" message="Missing or empty release native artifact: ${project.build.directory}/native-libs/io/questdb/client/bin/linux-aarch64/libquestdb.so"/>
436+
437+
<condition property="native.linux.x8664.present">
438+
<and>
439+
<available file="${project.build.directory}/native-libs/io/questdb/client/bin/linux-x86-64/libquestdb.so" type="file"/>
440+
<length file="${project.build.directory}/native-libs/io/questdb/client/bin/linux-x86-64/libquestdb.so" when="greater" length="0"/>
441+
</and>
442+
</condition>
443+
<fail unless="native.linux.x8664.present" message="Missing or empty release native artifact: ${project.build.directory}/native-libs/io/questdb/client/bin/linux-x86-64/libquestdb.so"/>
444+
445+
<condition property="native.windows.x8664.present">
446+
<and>
447+
<available file="${project.build.directory}/native-libs/io/questdb/client/bin/windows-x86-64/libquestdb.dll" type="file"/>
448+
<length file="${project.build.directory}/native-libs/io/questdb/client/bin/windows-x86-64/libquestdb.dll" when="greater" length="0"/>
449+
</and>
450+
</condition>
451+
<fail unless="native.windows.x8664.present" message="Missing or empty release native artifact: ${project.build.directory}/native-libs/io/questdb/client/bin/windows-x86-64/libquestdb.dll"/>
452+
</target>
453+
</configuration>
454+
</execution>
455+
</executions>
456+
</plugin>
406457
<plugin>
407458
<groupId>org.apache.maven.plugins</groupId>
408459
<artifactId>maven-resources-plugin</artifactId>

0 commit comments

Comments
 (0)