-
Notifications
You must be signed in to change notification settings - Fork 14
256 lines (224 loc) · 8.75 KB
/
build-cpack-packages.yml
File metadata and controls
256 lines (224 loc) · 8.75 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
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
name: Build CPack Packages
on:
workflow_call:
inputs:
build-type:
description: CMake build type used for packaging
type: string
default: Release
extra-cmake-flags:
description: Additional flags passed to CMake configure step
type: string
default: ""
save-artifacts:
description: Save built packages as artifacts
type: boolean
default: false
secrets: {}
workflow_dispatch:
inputs:
build-type:
description: CMake build type used for packaging
type: string
default: Release
extra-cmake-flags:
description: Additional flags passed to CMake configure step
type: string
default: ""
save-artifacts:
description: Save built packages as artifacts
type: boolean
default: false
secrets: {}
env:
CARGO_TERM_COLOR: always
CMAKE_BUILD_TYPE: ${{ inputs.build-type }}
CMAKE_FLAGS: ${{ inputs.extra-cmake-flags }}
jobs:
linux:
name: Linux packages
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Build packages
run: make build-package
- name: Install driver dev package
run: make -C packaging/smoke-test-app install-driver-dev
- name: Install driver package
run: gmake -C packaging/smoke-test-app install-driver
- name: Build smoke-test application package
run: make -C packaging/smoke-test-app build-package
- name: Install smoke-test application package
run: make -C packaging/smoke-test-app install-app
- name: Test smoke-test application
run: make -C packaging/smoke-test-app test-app-package
- name: Collect artifacts
run: |
set -euo pipefail
shopt -s nullglob
mkdir -p artifacts/linux
for file in build/*.deb build/*.rpm; do
cp "$file" artifacts/linux/
done
- uses: actions/upload-artifact@v4
if: inputs.save-artifacts
with:
name: linux-packages
path: artifacts/linux
retention-days: 7
macos:
name: macOS packages
runs-on: macos-15-intel
steps:
- uses: actions/checkout@v4
- name: Install GNU make
run: brew install make
- name: Build packages
run: gmake build-package
- name: Install driver dev package
run: gmake -C packaging/smoke-test-app install-driver-dev
- name: Install driver package
run: gmake -C packaging/smoke-test-app install-driver
- name: Build smoke-test application package
run: gmake -C packaging/smoke-test-app build-package
- name: Install smoke-test application package
run: gmake -C packaging/smoke-test-app install-app
- name: Test smoke-test application
run: gmake -C packaging/smoke-test-app test-app-package
- name: Collect artifacts
run: |
set -euo pipefail
shopt -s nullglob
mkdir -p artifacts/macos
for file in build/*.pkg build/*.dmg \
packaging/smoke-test-app/build/*.pkg \
packaging/smoke-test-app/build/*.dmg; do
cp "$file" artifacts/macos/
done
- uses: actions/upload-artifact@v4
if: inputs.save-artifacts
with:
name: macos-packages
path: artifacts/macos
retention-days: 7
windows:
name: Windows packages
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Install Docker
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$dockerService = Get-Service -Name docker -ErrorAction SilentlyContinue
if (-not $dockerService) {
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
Install-Package -Name docker -ProviderName DockerMsftProvider -Force
}
try {
Start-Service docker -ErrorAction Stop
} catch {
Write-Warning "Docker service failed to start: $($_.Exception.Message)"
}
- name: Add WiX to PATH
shell: pwsh
run: |
$wixPath = "C:\\Program Files (x86)\\WiX Toolset v3.11\\bin"
if (Test-Path $wixPath) { Add-Content -Path $env:GITHUB_PATH -Value $wixPath }
- name: Build packages
run: make build-package
- name: Install driver packages (MSI)
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$packages = Get-ChildItem build -Filter *.msi
if (-not $packages) {
throw "No driver MSI packages produced"
}
Write-Host "Installing $($packages.Count) MSI package(s):"
foreach ($pkg in $packages) {
Write-Host " - $($pkg.Name)"
}
# Install all packages (Windows WIX creates a single MSI with components)
foreach ($pkg in $packages) {
$process = Start-Process msiexec.exe -ArgumentList "/i `"$($pkg.FullName)`" /qn /norestart" -Wait -PassThru
if ($process.ExitCode -ne 0) {
throw "Failed to install driver package $($pkg.Name): exit code $($process.ExitCode)"
}
}
- name: Verify dev package installation
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$installPath = "C:\Program Files\ScyllaDB\Scylla CPP Driver"
# Verify headers are installed
$headerPath = Join-Path $installPath "include\cassandra.h"
if (-not (Test-Path $headerPath)) {
throw "ERROR: cassandra.h header not found at $headerPath - dev package may not be installed"
}
# Verify pkg-config file is installed
$pkgConfigPath = Join-Path $installPath "lib\pkgconfig\scylla-cpp-driver.pc"
if (-not (Test-Path $pkgConfigPath)) {
throw "ERROR: scylla-cpp-driver.pc not found at $pkgConfigPath - dev package may not be installed"
}
Write-Host "Dev package verification successful"
- name: Build smoke-test application package
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$env:PKG_CONFIG_PATH = "C:/Program Files/ScyllaDB/Scylla CPP Driver/lib/pkgconfig"
cmake -S packaging/smoke-test-app -B packaging/smoke-test-app/build -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=${{ inputs.build-type }}
cmake --build packaging/smoke-test-app/build --config ${{ inputs.build-type }}
Push-Location packaging/smoke-test-app/build
cpack -G WIX -C ${{ inputs.build-type }}
Pop-Location
- name: Install smoke-test application package (MSI)
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$packages = Get-ChildItem packaging/smoke-test-app/build -Filter *.msi
if (-not $packages) {
throw "No smoke-test MSI packages produced"
}
foreach ($pkg in $packages) {
$process = Start-Process msiexec.exe -ArgumentList "/i `"$($pkg.FullName)`" /qn /norestart" -Wait -PassThru
if ($process.ExitCode -ne 0) {
throw "Failed to install smoke-test package $($pkg.Name): exit code $($process.ExitCode)"
}
}
- name: Run smoke-test application against local Scylla
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$composeFile = "tests/examples_cluster/docker-compose.yml"
function Cleanup {
docker compose -f $composeFile down --remove-orphans | Out-Null
}
try {
$dockerService = Get-Service -Name docker -ErrorAction SilentlyContinue
if ($dockerService -and $dockerService.Status -ne 'Running') {
Start-Service docker
}
docker compose -f $composeFile up -d --wait
$smokePath = "C:\Program Files\ScyllaDB\Scylla CPP Driver Smoke Test\bin\scylla-cpp-driver-smoke-test.exe"
if (-not (Test-Path $smokePath)) {
throw "Smoke-test binary not found at $smokePath"
}
& $smokePath 172.43.0.2
} finally {
Cleanup
}
- name: Collect artifacts
if: inputs.save-artifacts
shell: pwsh
run: |
New-Item -ItemType Directory -Path artifacts\windows -Force | Out-Null
Get-ChildItem build -Filter *.msi | Copy-Item -Destination artifacts\windows
Get-ChildItem packaging/smoke-test-app/build -Filter *.msi | Copy-Item -Destination artifacts\windows
- uses: actions/upload-artifact@v4
if: inputs.save-artifacts
with:
name: windows-packages
path: artifacts/windows
retention-days: 7