Skip to content

refactor: out-of-tree build - source tree stays read-only#560

Merged
satwareAG-ironMike merged 6 commits into
mainfrom
refactor/out-of-tree-build
Jul 21, 2026
Merged

refactor: out-of-tree build - source tree stays read-only#560
satwareAG-ironMike merged 6 commits into
mainfrom
refactor/out-of-tree-build

Conversation

@satwareAG-ironMike

Copy link
Copy Markdown

Summary

Source tree is never written to during builds. All build artifacts go to BUILD_DIR (default /tmp/build-firebird), which is copied from source and worked from. This prevents stale .so files, .deb version mismatches, and source tree pollution.

Changes (9 files, +134/-63)

File Change
build-extension/action.yml Copy source to BUILD_DIR, all steps cd $BUILD_DIR
ci.yml pdo_fbird build + test reference BUILD_DIR
coverage.yml / sanitizers.yml extension-path references BUILD_DIR
release-linux.yml / release-macos.yml Out-of-tree build pattern
build-precompiled.sh --build-dir parameter
packaging/debian/build.sh BUILD_DIR copy, REPO_ROOT repoint, fix find command
packaging/debian/build-matrix.sh Source /src:ro, build in /build (ephemeral), Sury PPA quoting fix

Bug Fix: PHP 8.4 .deb Version Detection

Root cause: build.sh:371 ran find "${REPO_ROOT}/.." -name "php*.deb" which inside Docker expands to find / - searching the entire container filesystem including /src/dist/ which contained stale .deb files from previous test runs (version 13.0.0-1). head -n 1 picked the stale file alphabetically (13.0.0 < 13.0.1), so the freshly-built 13.0.1-rc.1-1 .deb was never selected.

Fix: Added -maxdepth 1 (only search parent of BUILD_DIR) and ! -name "*dbgsym*" (exclude debug symbol packages) to all find calls.

Verification

=== Build Matrix (4 PHP versions x bookworm) ===
PASS: [1/4] 8.2/bookworm/x86_64: php8.2-firebird_13.0.1-rc.1-1_amd64.deb
PASS: [2/4] 8.3/bookworm/x86_64: php8.3-firebird_13.0.1-rc.1-1_amd64.deb
PASS: [3/4] 8.4/bookworm/x86_64: php8.4-firebird_13.0.1-rc.1-1_amd64.deb  <- was 13.0.0-1
PASS: [4/4] 8.5/bookworm/x86_64: php8.5-firebird_13.0.1-rc.1-1_amd64.deb
Passed: 4 / 4

Source tree verified clean after build (no .so, no debian/, no build artifacts).

Relates to

Source tree is never written to during builds. All build artifacts go to
BUILD_DIR (default /tmp/build-firebird), which is copied from source and
worked from. This prevents stale .so files, .deb version mismatches, and
source tree pollution.

Changes:
- build-extension action: copy source to BUILD_DIR, all steps cd $BUILD_DIR
- ci.yml: pdo_fbird build + test reference BUILD_DIR
- coverage.yml/sanitizers.yml: extension-path references BUILD_DIR
- release-linux.yml/release-macos.yml: out-of-tree build pattern
- build-precompiled.sh: --build-dir parameter
- packaging/debian/build.sh: BUILD_DIR copy, REPO_ROOT repoint, fix find
  command (-maxdepth 1, ! -name *dbgsym*) to prevent stale .deb selection
- packaging/debian/build-matrix.sh: source mounted /src:ro, build in /build
  (ephemeral --rm container), Sury PPA quoting fix ($distro not
  $(lsb_release -sc))

Fixes: PHP 8.4 .deb version bug (stale 13.0.0-1 file picked by find
instead of freshly built 13.0.1-rc.1-1)

Verified: 4/4 PHP versions (8.2-8.5) x bookworm pass with correct version
phpize generates run-tests.php in the directory where it runs. With
out-of-tree builds, that's BUILD_DIR, not GITHUB_WORKSPACE. Test steps
must cd to BUILD_DIR so both run-tests.php and tests/ are found.

Fixes: 'Could not open input file: run-tests.php' in CI/coverage/sanitizers

Affected test steps:
- ci.yml: Run PHPT tests
- coverage.yml: Run PHPT tests (+ cd BUILD_DIR/pdo_fbird for build)
- sanitizers.yml: LSan tests + TSan tests (+ cd BUILD_DIR/pdo_fbird for build)
Tests use __DIR__/../vendor/autoload.php which resolves to
GITHUB_WORKSPACE/vendor/ (where composer install runs). With cd BUILD_DIR,
vendor/ was not found. Fix: reference run-tests.php by full path instead of
cd-ing to BUILD_DIR.

Reverts: cd ${BUILD_DIR} in ci.yml/coverage.yml/sanitizers.yml test steps
Replaces: php run-tests.php -> php ${BUILD_DIR}/run-tests.php
Instead of running run-tests.php from BUILD_DIR (which caused path
resolution issues with vendor/autoload.php and tests/), copy it to
GITHUB_WORKSPACE and run it there. This matches the original in-source
build behavior where phpize generates run-tests.php in the source tree.

Fixes: event test failures + 40 fewer tests running vs main
Event tests spawn child PHP processes with realpath('modules/firebird.so')
which resolves relative to CWD. With out-of-tree builds, the .so is in
BUILD_DIR/modules/, not CWD. Fix: use getenv('FBIRD_SO') with fallback to
realpath() for backward compatibility.

Set FBIRD_SO in ci.yml, coverage.yml, sanitizers.yml test steps.
Out-of-tree build puts .gcno/.gcda files in BUILD_DIR, not GITHUB_WORKSPACE.
Coverage step must cd to BUILD_DIR and use GITHUB_WORKSPACE/coverage/ for
output paths.

Also: PHP 8.2/FB 4.0 'unbound variable' is a pre-existing transient issue
in install-firebird-client (get-latest-firebird.sh), not related to our changes.
@satwareAG-ironMike
satwareAG-ironMike merged commit 3058125 into main Jul 21, 2026
66 of 71 checks passed
@satwareAG-ironMike
satwareAG-ironMike deleted the refactor/out-of-tree-build branch July 21, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant