PoC: Use Firebird embedded mode for CI on all platforms#39
Conversation
|
@asfernandes This is just a proof of concept and not priority. Just to demonstrate my ideas from #33. Whenever you have some time to review it, I’d really appreciate your thoughts. I asked Claude to measure the time difference twice, and in both runs the Linux times were actually higher when using cache. I’m having trouble understanding why 😟 |
|
Ugh! Both Linux and macOS are caching As a result, the cache is targeting the wrong directory ( Working on it. |
|
Here's the summary of the investigation and fix: Root cause: The vcpkg cache paths in main.yml for Linux and macOS were set to Windows worked correctly because its cache path was already vcpkg_installed. Fix (commit
"Configure CMake" step timing improvement (with cache hit):
|
|
When you have a moment, please share your thoughts on this PR. It should significantly speed up the build and testing process. |
|
My GitHub account is with a problem (wrong billing) and no actions are working. |
Replace Firebird server installation and service management with embedded mode using cached Firebird distributions on all platforms. Linux: - Download Firebird tarball, extract buildroot.tar.gz to /tmp/firebird - Set LD_LIBRARY_PATH and FIREBIRD env vars at test time - Cache /tmp/firebird with actions/cache Windows: - Download Firebird zip, extract to C:\Firebird - Configure Providers=Engine13 in firebird.conf (force embedded mode) - Remove vcpkg client-only fbclient.dll from build tree so PATH resolves to full Firebird distribution DLL - Cache C:\Firebird with actions/cache macOS: - Extract .pkg payload with pkgutil + tar (no sudo installer needed) - Replace vcpkg client-only libfbclient.dylib with full distribution version and configure RPATH for dependencies - Set FIREBIRD and DYLD_LIBRARY_PATH at test time - Cache /tmp/firebird with actions/cache New CMakeUserPresets templates for embedded mode omit FBCPP_TEST_SERVER so tests use local filesystem paths instead of TCP connections. Closes asfernandes#33.
The vcpkg cache was configured with build/Release/vcpkg_installed but CMakePresets.json sets VCPKG_INSTALLED_DIR to build/vcpkg_installed (shared across all presets). This caused a cache miss on every run, rebuilding all vcpkg packages from source (~9 min). Fixed: - main.yml: use build/vcpkg_installed for Linux and macOS (matching VCPKG_INSTALLED_DIR in CMakePresets.json) - pull-request.yml: add missing vcpkg cache steps for all platforms - Bump cache key version to invalidate stale entries
Hmm. I have to admit I didn’t measure the timings without the embedded version. The cache path issue was only discovered later. Anyway, is there any reason NOT to use the embedded version instead of the installed/service version? (Sorry if you already mentioned it -- it’s been a few weeks since I worked on this.) |
|
P.S.: Rebased onto latest |
It's clear seeing lines added and removed in this PR that it make things more complex. |
Got it. I’ll just fix the cache paths then, in a separate PR and close this one. Give me a few hours. |
|
Moved to #43. |

Summary
Replaces Firebird server installation and service management with embedded mode using cached Firebird distributions on all three platforms (Linux, Windows, macOS).
This eliminates the need for
sudo installer,install_service.bat,launchctl,isqlpassword setup, and running Firebird as a system service during CI. Tests use local filesystem database paths instead of TCP connections.What changed
Linux (
build-linux)wget+tar+install.sh -silentwget+tar(extractbuildroot.tar.gzonly)systemctl stop/start+isqlpassword setupactions/cachefor/tmp/firebirdCMakeUserPresets.json.posix.templateCMakeUserPresets.json.embedded-posix.templateFBCPP_TEST_SERVER=localhost(TCP)FBCPP_TEST_SERVER(embedded — local filesystem paths)LD_LIBRARY_PATH=/tmp/firebird/lib+FIREBIRD=/tmp/firebirdat test timeWindows (
build-windows)Invoke-WebRequest+7z+install_service.batInvoke-WebRequest+Expand-Archiveisqlpassword setup +install_service.batactions/cacheforC:\FirebirdCMakeUserPresets.json.windows.templateCMakeUserPresets.json.embedded-windows.templateFBCPP_TEST_SERVER=localhost(TCP)FBCPP_TEST_SERVER(embedded)Providers = Engine13infirebird.conf(force embedded engine)fbclient.dllfrom build tree (force PATH resolution to full Firebird distribution)macOS (
build-macos)wget+sudo installer -pkgwget+pkgutil --expand+tar(no sudo needed)launchctl unload/load+isqlpassword setupactions/cachefor/tmp/firebirdCMakeUserPresets.json.posix.templateCMakeUserPresets.json.embedded-posix.templateFBCPP_TEST_SERVER=localhost(TCP)FBCPP_TEST_SERVER(embedded)libfbclient.dylibwith full distribution versionDYLD_LIBRARY_PATH+FIREBIRD+ RPATH configuration for dependenciesNew files
CMakeUserPresets.json.embedded-posix.template— same as posix template, withoutFBCPP_TEST_SERVER(shared by Linux and macOS)CMakeUserPresets.json.embedded-windows.template— same as windows template, withoutFBCPP_TEST_SERVERHow it works
The existing test code in
TestUtil.cppalready supports embedded mode — whenFBCPP_TEST_SERVERis unset,testServerPrefixstays empty and database URIs become plain filesystem paths, triggering the embedded engine provider.At runtime,
LD_LIBRARY_PATH(Linux) /DYLD_LIBRARY_PATH(macOS) /PATH(Windows) is configured so the process loads the full Firebird distribution's client library (with embedded engine support) instead of vcpkg's client-only version. TheFIREBIRDenv var tells the engine where to findplugins/,firebird.conf, andsecurity5.fdb.On Windows and macOS, an extra step is needed because vcpkg installs its client-only library into the build tree, which takes priority in library search order. The workflow removes/replaces the vcpkg copy so the full Firebird distribution library is loaded instead.
Build time comparison
Timing data from
issue-33branch runs onfdcastel/fb-cpp:build-linuxbuild-windowsbuild-macosOn cache hit, the Firebird download step is skipped entirely. The Install Firebird, Configure Firebird, and Start Firebird Server steps are all eliminated across all platforms.
Linux shows a slight increase due to runner variance — the Firebird setup was already fast there. Windows and macOS see significant improvements from eliminating service setup.
Notes
FBCPP_TEST_SERVERenv varpull-request.ymlworkflow has the same changes appliedWorkflow runs