Skip to content

Commit 1f59c25

Browse files
committed
Implement packaging tests
1 parent 694afc9 commit 1f59c25

File tree

5 files changed

+677
-3
lines changed

5 files changed

+677
-3
lines changed

.github/workflows/build-cpack-packages.yml

Lines changed: 177 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
- name: Install tooling
4646
run: |
4747
sudo apt-get update
48-
sudo apt-get install -y rpm ninja-build
48+
sudo apt-get install -y rpm ninja-build pkg-config
4949
5050
- name: Configure
5151
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ inputs.build-type }} ${{ inputs.extra-cmake-flags }}
@@ -59,12 +59,61 @@ jobs:
5959
cpack -G DEB -C ${{ inputs.build-type }}
6060
cpack -G RPM -C ${{ inputs.build-type }}
6161
62+
- name: Install driver package (DEB)
63+
if: runner.os == 'Linux'
64+
run: |
65+
set -euo pipefail
66+
shopt -s nullglob
67+
DRIVER_PACKAGES=(build/*.deb)
68+
if [ "${#DRIVER_PACKAGES[@]}" -eq 0 ]; then
69+
echo "No driver DEB packages produced"
70+
exit 1
71+
fi
72+
sudo dpkg -i "${DRIVER_PACKAGES[@]}"
73+
sudo apt-get install -f -y
74+
75+
- name: Build smoke-test application package
76+
if: runner.os == 'Linux'
77+
run: |
78+
set -euo pipefail
79+
cmake -S packaging/smoke-test-app -B packaging/smoke-test-app/build \
80+
-G Ninja -DCMAKE_BUILD_TYPE=${{ inputs.build-type }}
81+
cmake --build packaging/smoke-test-app/build --config ${{ inputs.build-type }}
82+
(cd packaging/smoke-test-app/build && cpack -G DEB -C ${{ inputs.build-type }})
83+
(cd packaging/smoke-test-app/build && cpack -G RPM -C ${{ inputs.build-type }})
84+
85+
- name: Install smoke-test application package (DEB)
86+
if: runner.os == 'Linux'
87+
run: |
88+
set -euo pipefail
89+
shopt -s nullglob
90+
APP_PACKAGES=(packaging/smoke-test-app/build/*.deb)
91+
if [ "${#APP_PACKAGES[@]}" -eq 0 ]; then
92+
echo "No smoke-test DEB packages produced"
93+
exit 1
94+
fi
95+
sudo dpkg -i "${APP_PACKAGES[@]}"
96+
sudo apt-get install -f -y
97+
98+
- name: Run smoke-test application against local Scylla
99+
if: runner.os == 'Linux'
100+
run: |
101+
set -euo pipefail
102+
cleanup() {
103+
sudo docker compose -f tests/examples_cluster/docker-compose.yml down --remove-orphans
104+
}
105+
trap cleanup EXIT
106+
sudo docker compose -f tests/examples_cluster/docker-compose.yml up -d --wait
107+
/usr/bin/scylla-cpp-driver-smoke-test 172.43.0.2
108+
62109
- name: Collect artifacts
63110
run: |
64111
set -euo pipefail
65112
shopt -s nullglob
66113
mkdir -p artifacts/linux
67-
for file in build/*.deb build/*.rpm; do
114+
for file in build/*.deb build/*.rpm \
115+
packaging/smoke-test-app/build/*.deb \
116+
packaging/smoke-test-app/build/*.rpm; do
68117
cp "$file" artifacts/linux/
69118
done
70119
@@ -93,12 +142,63 @@ jobs:
93142
cpack -G productbuild -C ${{ inputs.build-type }}
94143
cpack -G DragNDrop -C ${{ inputs.build-type }}
95144
145+
- name: Install driver package (pkg)
146+
if: runner.os == 'macOS'
147+
run: |
148+
set -euo pipefail
149+
shopt -s nullglob
150+
packages=(build/*.pkg)
151+
if [ "${#packages[@]}" -eq 0 ]; then
152+
echo "No driver pkg packages produced"
153+
exit 1
154+
fi
155+
for pkg in "${packages[@]}"; do
156+
sudo installer -pkg "$pkg" -target /
157+
done
158+
159+
- name: Build smoke-test application package
160+
if: runner.os == 'macOS'
161+
run: |
162+
set -euo pipefail
163+
cmake -S packaging/smoke-test-app -B packaging/smoke-test-app/build \
164+
-DCMAKE_BUILD_TYPE=${{ inputs.build-type }}
165+
cmake --build packaging/smoke-test-app/build --config ${{ inputs.build-type }}
166+
(cd packaging/smoke-test-app/build && cpack -G productbuild -C ${{ inputs.build-type }})
167+
(cd packaging/smoke-test-app/build && cpack -G DragNDrop -C ${{ inputs.build-type }})
168+
169+
- name: Install smoke-test application package (pkg)
170+
if: runner.os == 'macOS'
171+
run: |
172+
set -euo pipefail
173+
shopt -s nullglob
174+
packages=(packaging/smoke-test-app/build/*.pkg)
175+
if [ "${#packages[@]}" -eq 0 ]; then
176+
echo "No smoke-test pkg packages produced"
177+
exit 1
178+
fi
179+
for pkg in "${packages[@]}"; do
180+
sudo installer -pkg "$pkg" -target /
181+
done
182+
183+
- name: Run smoke-test application against local Scylla
184+
if: runner.os == 'macOS'
185+
run: |
186+
set -euo pipefail
187+
cleanup() {
188+
docker compose -f tests/examples_cluster/docker-compose.yml down --remove-orphans
189+
}
190+
trap cleanup EXIT
191+
docker compose -f tests/examples_cluster/docker-compose.yml up -d --wait
192+
/usr/local/bin/scylla-cpp-driver-smoke-test 172.43.0.2
193+
96194
- name: Collect artifacts
97195
run: |
98196
set -euo pipefail
99197
shopt -s nullglob
100198
mkdir -p artifacts/macos
101-
for file in build/*.pkg build/*.dmg; do
199+
for file in build/*.pkg build/*.dmg \
200+
packaging/smoke-test-app/build/*.pkg \
201+
packaging/smoke-test-app/build/*.dmg; do
102202
cp "$file" artifacts/macos/
103203
done
104204
@@ -142,6 +242,11 @@ jobs:
142242
"OPENSSL_LIB_DIR=$libPath" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
143243
"OPENSSL_INCLUDE_DIR=$(Join-Path $opensslRoot 'include')" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
144244
245+
- name: Install pkg-config
246+
shell: pwsh
247+
run: |
248+
choco install pkgconfiglite --no-progress -y
249+
145250
- name: Configure
146251
shell: pwsh
147252
run: |
@@ -156,12 +261,81 @@ jobs:
156261
working-directory: build
157262
run: cpack -G WIX -C ${{ inputs.build-type }}
158263

264+
- name: Install driver package (MSI)
265+
if: runner.os == 'Windows'
266+
shell: pwsh
267+
run: |
268+
$ErrorActionPreference = 'Stop'
269+
$packages = Get-ChildItem build -Filter *.msi
270+
if (-not $packages) {
271+
throw "No driver MSI packages produced"
272+
}
273+
foreach ($pkg in $packages) {
274+
$process = Start-Process msiexec.exe -ArgumentList "/i `"$($pkg.FullName)`" /qn /norestart" -Wait -PassThru
275+
if ($process.ExitCode -ne 0) {
276+
throw "Failed to install driver package $($pkg.Name): exit code $($process.ExitCode)"
277+
}
278+
}
279+
280+
- name: Build smoke-test application package
281+
if: runner.os == 'Windows'
282+
shell: pwsh
283+
run: |
284+
$ErrorActionPreference = 'Stop'
285+
$env:PKG_CONFIG_PATH = "C:/Program Files/ScyllaDB/Scylla CPP Driver/lib/pkgconfig"
286+
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 }}
287+
cmake --build packaging/smoke-test-app/build --config ${{ inputs.build-type }}
288+
Push-Location packaging/smoke-test-app/build
289+
cpack -G WIX -C ${{ inputs.build-type }}
290+
Pop-Location
291+
292+
- name: Install smoke-test application package (MSI)
293+
if: runner.os == 'Windows'
294+
shell: pwsh
295+
run: |
296+
$ErrorActionPreference = 'Stop'
297+
$packages = Get-ChildItem packaging/smoke-test-app/build -Filter *.msi
298+
if (-not $packages) {
299+
throw "No smoke-test MSI packages produced"
300+
}
301+
foreach ($pkg in $packages) {
302+
$process = Start-Process msiexec.exe -ArgumentList "/i `"$($pkg.FullName)`" /qn /norestart" -Wait -PassThru
303+
if ($process.ExitCode -ne 0) {
304+
throw "Failed to install smoke-test package $($pkg.Name): exit code $($process.ExitCode)"
305+
}
306+
}
307+
308+
- name: Run smoke-test application against local Scylla
309+
if: runner.os == 'Windows'
310+
shell: pwsh
311+
run: |
312+
$ErrorActionPreference = 'Stop'
313+
$composeFile = "tests/examples_cluster/docker-compose.yml"
314+
function Cleanup {
315+
docker compose -f $composeFile down --remove-orphans | Out-Null
316+
}
317+
try {
318+
$dockerService = Get-Service -Name docker -ErrorAction SilentlyContinue
319+
if ($dockerService -and $dockerService.Status -ne 'Running') {
320+
Start-Service docker
321+
}
322+
docker compose -f $composeFile up -d --wait
323+
$smokePath = "C:\Program Files\ScyllaDB\Scylla CPP Driver Smoke Test\bin\scylla-cpp-driver-smoke-test.exe"
324+
if (-not (Test-Path $smokePath)) {
325+
throw "Smoke-test binary not found at $smokePath"
326+
}
327+
& $smokePath 172.43.0.2
328+
} finally {
329+
Cleanup
330+
}
331+
159332
- name: Collect artifacts
160333
if: inputs.save-artifacts
161334
shell: pwsh
162335
run: |
163336
New-Item -ItemType Directory -Path artifacts\windows -Force | Out-Null
164337
Get-ChildItem build -Filter *.msi | Copy-Item -Destination artifacts\windows
338+
Get-ChildItem packaging/smoke-test-app/build -Filter *.msi | Copy-Item -Destination artifacts\windows
165339
166340
- uses: actions/upload-artifact@v4
167341
if: inputs.save-artifacts

AGENTS.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Repository Guidelines
2+
3+
## Project Structure & Module Organization
4+
- `src/` holds the C++ wrapper sources; keep headers in `include/` mirrored by module.
5+
- `scylla-rust-wrapper/` contains the Rust crate exposing the FFI; MSRV is 1.85 (see `Cargo.toml`).
6+
- Tests live in `tests/src/integration` (GoogleTest harness) and `scylla-rust-wrapper/tests` for Rust. CPack packaging config lives in `CMakeLists.txt`, GitHub workflows under `.github/workflows/`, and reusable examples under `examples/`.
7+
8+
## Build, Test, and Development Commands
9+
- `mkdir build && cd build && cmake .. && make -j` builds the driver; pass CMake options such as `-DCASS_BUILD_INTEGRATION_TESTS=ON` when needed.
10+
- `make check` runs clang-format, `cargo check`, `cargo clippy` (with integration flags), and `cargo fmt --check`.
11+
- `make run-test-unit` executes the Rust unit suite; `make run-test-integration-scylla` spins up a CCM cluster and runs `build/cassandra-integration-tests` against Scylla. Use `DONT_REBUILD_INTEGRATION_BIN=1` to reuse an existing build.
12+
13+
## Coding Style & Naming Conventions
14+
- C and C++ sources follow `.clang-format` (2-space indent, 100 column limit, no tabs). Keep C API names stable (e.g., `cass_*`) to preserve downstream compatibility.
15+
- Rust code must satisfy `cargo fmt` and `cargo clippy -- -D warnings -Aclippy::uninlined_format_args`; avoid the disallowed pointer conversions listed in `scylla-rust-wrapper/clippy.toml`.
16+
- Prefer descriptive snake_case for internal helpers, PascalCase for types, and mirror header/implementation filenames between `include/` and `src/`.
17+
18+
## Testing Guidelines
19+
- Place new C++ integration cases under `tests/src/integration` and register them with GoogleTest. Update `{SCYLLA,CASSANDRA}_TEST_FILTER` in the `Makefile` when enabling suites.
20+
- Rust-facing logic should gain coverage via `cargo test`; add integration fixtures under `scylla-rust-wrapper/tests` when exercising FFI.
21+
- When touching docker-based examples, verify with `make run-examples-scylla`; clean fixtures by rerunning the target to tear down the compose stack.
22+
23+
## Commit & Pull Request Guidelines
24+
- Follow the existing history style: concise, present-tense summaries with optional area prefixes (`docs:`, `README.md:`). Split unrelated changes into separate commits.
25+
- Before opening a PR, run `make check` and the relevant test targets, then complete the checklist in `.github/pull_request_template.md`.
26+
- PR descriptions should detail the rationale, list manual test evidence, and link issues via `Fixes: #123`. Include configuration notes (e.g., CMake flags) or screenshots when behavior changes.

0 commit comments

Comments
 (0)