Consolidate Docker build and test workflows#25
Conversation
This change removes the separate test workflow and integrates the testing steps directly into the main docker-buildx workflow. This ensures that images are built, tested, and only pushed if tests pass. - Deletes .github/workflows/test-drupal.yml - Updates .github/workflows/docker-buildx.yml to include test setup, execution, and cleanup steps. - Uses `load: true` for the test build step to verify the image locally. - Retains multi-platform build and push for the final step upon success. - Updates triggers to run on push to main and pull requests. Co-authored-by: hussainweb <1040271+hussainweb@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughConsolidates Drupal testing into the Docker BuildX workflow by replacing Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer
participant GH as GitHub Actions
participant Runner as Runner
participant Buildx as Buildx
participant Compose as Docker Compose
participant Drupal as Drupal Container
participant Registry as Registry
Dev->>GH: push / pull_request
GH->>Runner: start matrix job
Runner->>Buildx: build & load test image
Buildx-->>Runner: images available
Runner->>Compose: start test containers
Compose->>Drupal: run composer/drush, install Drupal (SQLite)
Drupal-->>Runner: run verification tests, emit logs/results
alt branch == main and tests pass
Runner->>Registry: push images
else tests fail or not main
Runner-->>GH: upload logs & artifacts, skip push
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (4)
.github/workflows/docker-buildx.yml (4)
105-114: Consider removingcache-tofrom the test build to avoid redundant cache writes.Both this step and the final "Build and push" step (Line 164) write to the same GHA cache with
cache-to: type=gha,mode=max. The test build writes single-platform layers that are immediately overwritten by the multi-platform push build. Keepingcache-fromon the test build is beneficial (it reads cached layers), butcache-tohere is wasteful and could cause minor cache churn.Proposed fix
- name: Build and load Docker image for testing uses: docker/build-push-action@v6 with: context: ${{ env.DOCKERFILE_DIR }}/${{ matrix.variant }}/ load: true tags: drupal-test:${{ matrix.php_version }}-${{ matrix.variant }} build-args: | PHP_VERSION=${{ matrix.php_version }} cache-from: type=gha - cache-to: type=gha,mode=max
116-120:sleep 10is fragile for container readiness.Consider replacing the fixed sleep with a polling loop that checks container health (e.g.,
docker compose exec drupal php -vor an HTTP health check with retries). A fixed sleep may be too short for slower CI runners or too long otherwise.Example: poll-based readiness check
- name: Start Docker containers run: | docker compose up -d - sleep 10 + echo "Waiting for containers to be ready..." + for i in $(seq 1 30); do + if docker compose exec -T drupal php -v > /dev/null 2>&1; then + echo "Container ready after ${i}s" + break + fi + sleep 1 + done docker compose ps
154-164: On PRs, this step builds for two platforms but never pushes — consider skipping it.When
github.ref != 'refs/heads/main', this step still runs a full multi-platform build (linux/amd64,linux/arm64) withpush: false. Since the single-platform test build already validated the image, this is redundant on PRs and roughly doubles CI time per matrix entry.Proposed fix: gate the push step on main
- name: Build and push Docker image for PHP ${{ matrix.php_version }} + if: github.ref == 'refs/heads/main' uses: docker/build-push-action@v6 with: context: ${{ env.DOCKERFILE_DIR }}/${{ matrix.variant }}/ - push: ${{ github.ref == 'refs/heads/main' }} + push: true tags: ${{ steps.tags.outputs.tags }} build-args: | PHP_VERSION=${{ matrix.php_version }} platforms: linux/amd64,linux/arm64 cache-from: type=gha cache-to: type=gha,mode=max
78-88: Composer/PHP availability on the runner is an implicit dependency.The
composer create-projectandcomposer requirecommands run directly on the GitHub Actions runner, relying on the pre-installed PHP and Composer onubuntu-latest. This works today but is fragile across runner image updates. If you later need a specific PHP version for Composer resolution, consider adding asetup-phpstep.
This commit fixes a runtime error in the apache-bookworm image where Apache/PHP failed to start due to `undefined symbol: sqlite3_column_table_name`. This was caused by the manual SQLite compilation missing the `SQLITE_ENABLE_COLUMN_METADATA` flag, which is required by Drupal. The workflow consolidation changes from the previous attempt are also included here as they were part of the same PR branch. - Modifies `php8/apache-bookworm/Dockerfile` to add `CPPFLAGS="-DSQLITE_ENABLE_COLUMN_METADATA=1"` to the SQLite configure command. - Consolidates testing logic into `docker-buildx.yml`. - Removes `test-drupal.yml`. Co-authored-by: hussainweb <1040271+hussainweb@users.noreply.github.com>
This commit addresses a CI failure where Drupal 11 (which requires PHP 8.3+)
was being installed on PHP 8.2 environments, causing a Composer dependency
error.
- Updates `.github/workflows/docker-buildx.yml` to conditionally install:
- `drupal/recommended-project:^10` for PHP 8.2 builds.
- The latest `drupal/recommended-project` (currently Drupal 11) for all other PHP versions.
- Passes the appropriate version string ("10.x" or "11.x") to the `install-drupal.sh` script.
This builds upon previous commits that consolidated the testing workflow
and fixed SQLite compilation for apache-bookworm.
Co-authored-by: hussainweb <1040271+hussainweb@users.noreply.github.com>
This commit fixes a CI failure where dependencies for Drupal were being resolved against the GitHub Runner's PHP version (e.g., 8.3/8.4) instead of the target container's PHP version (e.g., 8.2). This caused incompatibility errors when running the tests on older PHP versions. - Reorders the `docker-buildx.yml` workflow to build the image *before* downloading Drupal. - Updates the "Download Drupal" step to run `composer create-project` inside a temporary container using the just-built image. This ensures that the generated `composer.lock` and `platform_check.php` match the container's environment. - Maintains the conditional logic to install Drupal 10 for PHP 8.2 and Drupal 11 for newer versions. Previous fixes included in this PR: - Enable `SQLITE_ENABLE_COLUMN_METADATA` for apache-bookworm builds. - Consolidate testing logic into the main build workflow. Co-authored-by: hussainweb <1040271+hussainweb@users.noreply.github.com>
There was a problem hiding this comment.
🧹 Nitpick comments (3)
.github/workflows/docker-buildx.yml (3)
92-92:CONTAINER_NAMEis set but never referenced in subsequent steps.The variable is written to
GITHUB_ENVbut no later step uses${CONTAINER_NAME}. If the compose service name is alwaysdrupal, this line is dead configuration. Consider removing it or actually using it (e.g., indocker compose execcommands) to keep the workflow self-documenting.
119-126: Quote the volume-mount path to guard against spaces.
$(pwd)is unquoted. While GitHub-hosted runner paths don't normally contain spaces, it's a good defensive habit.Suggested fix
- docker run --rm \ - -v $(pwd)/drupal-root:${WEB_ROOT} \ + docker run --rm \ + -v "$(pwd)/drupal-root:${WEB_ROOT}" \
170-180: Skip the multi-platform build entirely on PRs to save CI time.When
pushisfalse(non-main), this step still executes a full multi-platform build (linux/amd64,linux/arm64) whose output is discarded. On PRs you've already validated the image via theloadbuild + tests. Adding anifguard avoids ~doubling build time on every PR matrix entry.Suggested fix
- name: Build and push Docker image for PHP ${{ matrix.php_version }} + if: github.ref == 'refs/heads/main' uses: docker/build-push-action@v6 with: context: ${{ env.DOCKERFILE_DIR }}/${{ matrix.variant }}/ - push: ${{ github.ref == 'refs/heads/main' }} + push: true tags: ${{ steps.tags.outputs.tags }} build-args: | PHP_VERSION=${{ matrix.php_version }} platforms: linux/amd64,linux/arm64 cache-from: type=gha cache-to: type=gha,mode=max
This commit simplifies the workflow by running the Drupal download step inside the running container using `docker compose exec` instead of running a separate `docker run` command before bringing up the stack. This addresses feedback from the PR review and maintains the PHP version compatibility fix. - Updates the "Download Drupal" step in `docker-buildx.yml` to run *after* `Start Docker containers`. - Uses `docker compose exec` to run `composer create-project`. - Maintains the conditional logic to install Drupal 10 for PHP 8.2. Previous fixes included in this PR: - Enable `SQLITE_ENABLE_COLUMN_METADATA` for apache-bookworm builds. - Consolidate testing logic into the main build workflow. - Ensure dependency resolution matches the target container environment. Co-authored-by: hussainweb <1040271+hussainweb@users.noreply.github.com>
There was a problem hiding this comment.
🧹 Nitpick comments (2)
.github/workflows/docker-buildx.yml (2)
110-114:sleep 10is a fragile wait mechanism.Consider replacing the fixed sleep with a retry loop that polls for container readiness (e.g., checking health status or a simple HTTP probe). This avoids both unnecessary waiting and flaky failures when containers are slow to start.
♻️ Suggested improvement
- name: Start Docker containers run: | docker compose up -d - sleep 10 + # Wait for container to be ready (up to 60s) + for i in $(seq 1 30); do + if docker compose exec -T drupal true 2>/dev/null; then + echo "Container is ready" + break + fi + echo "Waiting for container... ($i)" + sleep 2 + done docker compose ps
164-174: Final build runs even on PRs (just without push) — intentional redundancy.On PRs,
push: falsemeans this step still performs the multi-platform build without pushing. This validates the multi-platform build works but doubles build time. If CI cost is a concern, you could gate this step withif: github.ref == 'refs/heads/main'to skip it entirely on PRs.
.github/workflows/docker-buildx.yml
Outdated
| # Determine Drupal version constraint | ||
| if [ "${{ matrix.php_version }}" = "8.2" ]; then | ||
| DRUPAL_PROJECT="drupal/recommended-project:^10" | ||
| else | ||
| DRUPAL_PROJECT="drupal/recommended-project" | ||
| fi | ||
|
|
||
| # Run composer inside the running container to ensure PHP version compatibility | ||
| docker compose exec -T drupal sh -c "composer create-project $DRUPAL_PROJECT . --no-interaction --no-dev && composer require drush/drush --no-interaction" |
There was a problem hiding this comment.
Let's move this step inside install-drupal.sh. This simplifies our workflows and also ensures the file permissions are correct. This is important because the reason for errors is file permissions for the SQLite database.
…logic
This commit consolidates the Docker build and test workflow into a single file (`docker-buildx.yml`), removing the redundant `test-drupal.yml`.
Key changes:
- Moves the `composer create-project` logic into `tests/install-drupal.sh` to ensure it runs inside the container with correct PHP version resolution and file permissions.
- Updates `tests/install-drupal.sh` to parse the Drupal version argument (e.g., "10.x") and apply the appropriate Composer constraint (`^10`).
- Updates `docker-buildx.yml` to call `install-drupal.sh` with the correct version constraint ("10.x" for PHP 8.2, "11.x" for others).
- Ensures `drupal-root` directory is cleaned before starting containers.
- Adds `SQLITE_ENABLE_COLUMN_METADATA=1` to `php8/apache-bookworm/Dockerfile` (from previous attempt) to fix Drupal compatibility.
Fixes issues with PHP 8.2 builds failing due to incorrect Drupal 11 dependencies being installed.
Co-authored-by: hussainweb <1040271+hussainweb@users.noreply.github.com>
tests/install-drupal.sh
Outdated
| HAS_COMPOSER=$(docker compose exec -T $SERVICE sh -c "if [ -f ${WEBROOT}/composer.json ]; then echo 'yes'; else echo 'no'; fi") | ||
|
|
||
| if [ "$HAS_COMPOSER" = "no" ]; then |
There was a problem hiding this comment.
Our tests will never have a composer.json. Let's remove this.
There was a problem hiding this comment.
Agreed. Removed the HAS_COMPOSER check and made the project creation unconditional (which correctly handles the clean state assumption).
tests/install-drupal.sh
Outdated
| # Determine version constraint from argument (e.g. 10.x -> ^10) | ||
| CONSTRAINT="" | ||
| MAJOR=${DRUPAL_VERSION%%.*} | ||
| if [[ "$MAJOR" =~ ^[0-9]+$ ]]; then | ||
| CONSTRAINT="^${MAJOR}" | ||
| fi |
There was a problem hiding this comment.
Let's pass in the constraint instead of having to determine it. The parameter is not used for any functional purporse anyway.
There was a problem hiding this comment.
Good point. I've updated the script to accept the constraint directly (e.g., ^10) and removed the parsing logic. Also updated the workflow to pass the constraints explicitly.
This commit consolidates the Docker build and test workflow into a single file (`docker-buildx.yml`), removing the redundant `test-drupal.yml`. It also improves the Drupal installation script to be more robust and explicitly accept version constraints.
Key changes:
- `docker-buildx.yml`:
- Merged test steps from `test-drupal.yml`.
- Passes explicit Drupal version constraints (`^10` for PHP 8.2, `^11` for others) to the install script.
- Cleans `drupal-root` before starting containers.
- `tests/install-drupal.sh`:
- Removed `HAS_COMPOSER` check; the script now assumes a clean state and unconditionally creates the project.
- Accepts the version constraint directly as the second argument (e.g., `^10`), removing internal parsing logic.
- Uses `rm -rf` to ensure the directory is clean before `composer create-project`.
- `php8/apache-bookworm/Dockerfile`:
- Added `SQLITE_ENABLE_COLUMN_METADATA=1` to `CPPFLAGS` to fix Drupal compatibility with the custom SQLite build.
This ensures a reliable "Build -> Test -> Push" pipeline where the push only happens if tests pass.
Co-authored-by: hussainweb <1040271+hussainweb@users.noreply.github.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tests/install-drupal.sh (1)
63-69:⚠️ Potential issue | 🔴 CriticalCritical: nested double-quote quoting breaks the
sh -ccommand.The inner
"..."around the--db-urland--site-namevalues toggle the outersh -c "..."quoting, causing bash to split the argument incorrectly. Specifically,Drupal Test Sitebecomes positional parameters toshinstead of part of the command, and everything from--account-nameonward is lost from the command string. This means drush runs without--yes/--no-interaction(likely hanging) and without account credentials.Use escaped inner quotes or single quotes inside the double-quoted
sh -cstring:🐛 Proposed fix
-docker compose exec -T $SERVICE sh -c "cd ${WEBROOT} && vendor/bin/drush site:install minimal \ - --db-url="sqlite://localhost/sites/default/files/.ht.sqlite" \ - --site-name="Drupal Test Site" \ - --account-name=admin \ - --account-pass=admin \ - --yes \ - --no-interaction" +docker compose exec -T $SERVICE sh -c "cd ${WEBROOT} && vendor/bin/drush site:install minimal \ + --db-url='sqlite://localhost/sites/default/files/.ht.sqlite' \ + --site-name='Drupal Test Site' \ + --account-name=admin \ + --account-pass=admin \ + --yes \ + --no-interaction"
🧹 Nitpick comments (3)
tests/install-drupal.sh (1)
40-50:composer create-project .relies on the image's WORKDIR matchingWEBROOT.The
rm -rfon line 42 targets${WEBROOT}, butcomposer create-project ... .on lines 47/49 installs into the container's current working directory (WORKDIR), not necessarily${WEBROOT}. If any image variant sets a different WORKDIR, the project lands in the wrong place. Consider explicitly using${WEBROOT}as the target path instead of., or wrapping withcd:♻️ Suggested fix
if [ -n "$CONSTRAINT" ]; then - docker compose exec -T $SERVICE composer create-project drupal/recommended-project . "$CONSTRAINT" --no-interaction --no-dev + docker compose exec -T $SERVICE sh -c "cd ${WEBROOT} && composer create-project drupal/recommended-project . '$CONSTRAINT' --no-interaction --no-dev" else - docker compose exec -T $SERVICE composer create-project drupal/recommended-project . --no-interaction --no-dev + docker compose exec -T $SERVICE sh -c "cd ${WEBROOT} && composer create-project drupal/recommended-project . --no-interaction --no-dev" fi.github/workflows/docker-buildx.yml (2)
78-92: Quote$GITHUB_ENVand remove the unusedCONTAINER_NAMEvariable.Per static analysis (SC2086),
$GITHUB_ENVshould be double-quoted in eachecho ... >> $GITHUB_ENVline. Also,CONTAINER_NAME(line 92) is set but never referenced —install-drupal.shhardcodesSERVICE="drupal"instead.♻️ Suggested fix (showing a few representative lines)
run: | - echo "PHP_VERSION=${{ matrix.php_version }}" >> $GITHUB_ENV - echo "VARIANT=${{ matrix.variant }}" >> $GITHUB_ENV + echo "PHP_VERSION=${{ matrix.php_version }}" >> "$GITHUB_ENV" + echo "VARIANT=${{ matrix.variant }}" >> "$GITHUB_ENV" if [ "${{ matrix.variant }}" = "frankenphp-trixie" ]; then - echo "WEB_ROOT=/app" >> $GITHUB_ENV + echo "WEB_ROOT=/app" >> "$GITHUB_ENV" else - echo "WEB_ROOT=/var/www/html" >> $GITHUB_ENV + echo "WEB_ROOT=/var/www/html" >> "$GITHUB_ENV" fi if [ "${{ matrix.variant }}" = "fpm-alpine" ]; then - echo "COMPOSE_FILE=tests/docker-compose.fpm.yml" >> $GITHUB_ENV + echo "COMPOSE_FILE=tests/docker-compose.fpm.yml" >> "$GITHUB_ENV" else - echo "COMPOSE_FILE=tests/docker-compose.yml" >> $GITHUB_ENV + echo "COMPOSE_FILE=tests/docker-compose.yml" >> "$GITHUB_ENV" fi - echo "CONTAINER_NAME=drupal" >> $GITHUB_ENV
154-164: Consider skipping the multi-platform build on PRs to save CI time.This step always runs (no
if:guard), so on PRs it performs a full multi-platform build (amd64 + arm64) but discards the result (push: false). Since the single-platform test build (line 94) already validates the image, you could gate this step withif: github.ref == 'refs/heads/main'to avoid redundant ~2× build time on every PR. If you intentionally want to validate multi-platform builds on PRs, this is fine as-is.
This commit consolidates the Docker build and test workflow into a single file (`docker-buildx.yml`), removing the redundant `test-drupal.yml`. It also improves the Drupal installation script to be more robust, explicitly accept version constraints, and fixes the SQLite database URL.
Key changes:
- `docker-buildx.yml`:
- Merged test steps from `test-drupal.yml`.
- Passes explicit Drupal version constraints (`^10` for PHP 8.2, `^11` for others) to the install script.
- Cleans `drupal-root` before starting containers.
- `tests/install-drupal.sh`:
- Removed `HAS_COMPOSER` check; the script now assumes a clean state and unconditionally creates the project.
- Accepts the version constraint directly as the second argument (e.g., `^10`), removing internal parsing logic.
- Uses `rm -rf` to ensure the directory is clean before `composer create-project`.
- Fixed `drush site:install` command to use `sqlite://sites/default/files/.ht.sqlite` (removed `localhost`) to prevent permission issues.
- `php8/apache-bookworm/Dockerfile`:
- Added `SQLITE_ENABLE_COLUMN_METADATA=1` to `CPPFLAGS` to fix Drupal compatibility with the custom SQLite build.
This ensures a reliable "Build -> Test -> Push" pipeline where the push only happens if tests pass.
Co-authored-by: hussainweb <1040271+hussainweb@users.noreply.github.com>
This commit consolidates the Docker build and test workflow into a single file (`docker-buildx.yml`), removing the redundant `test-drupal.yml`. It also improves the Drupal installation script to be more robust, explicitly accept version constraints, fixes the SQLite database URL, and ensures the database directory is writable.
Key changes:
- `docker-buildx.yml`:
- Merged test steps from `test-drupal.yml`.
- Passes explicit Drupal version constraints (`^10` for PHP 8.2, `^11` for others) to the install script.
- Cleans `drupal-root` before starting containers.
- `tests/install-drupal.sh`:
- Removed `HAS_COMPOSER` check; the script now assumes a clean state and unconditionally creates the project.
- Accepts the version constraint directly as the second argument (e.g., `^10`), removing internal parsing logic.
- Uses `rm -rf` to ensure the directory is clean before `composer create-project`.
- Fixed `drush site:install` command to use `sqlite://sites/default/files/.ht.sqlite` (removed `localhost`) to prevent permission issues.
- Added logic to parse `drush status --format=json` to find the actual SQLite database path and `chmod 777` its directory, resolving write permission errors during testing.
- `php8/apache-bookworm/Dockerfile`:
- Added `SQLITE_ENABLE_COLUMN_METADATA=1` to `CPPFLAGS` to fix Drupal compatibility with the custom SQLite build.
This ensures a reliable "Build -> Test -> Push" pipeline where the push only happens if tests pass.
Co-authored-by: hussainweb <1040271+hussainweb@users.noreply.github.com>
This commit consolidates the Docker build and test workflow into a single file (`docker-buildx.yml`), removing the redundant `test-drupal.yml`. It ensures the build is tested before pushing.
Additionally, it fixes several issues with the Drupal installation and testing:
- **SQLite Installation:**
- `tests/install-drupal.sh`: Corrected the Drush SQLite connection string to remove `localhost` (`sqlite://sites/default/files/.ht.sqlite`).
- Added logic to parse `drush status` JSON output to find the exact database path and `chmod 777` its directory, resolving write permission errors.
- **Workflow Logic:**
- `docker-buildx.yml`: Passes explicit version constraints (`^10`, `^11`) to the install script.
- Cleans `drupal-root` before starting containers.
- **Debugging:**
- `tests/verify-drupal.sh`: Updated to log the permissions of the SQLite database file and its directory specifically, rather than a generic `ls -la`.
- **Image Compatibility:**
- `php8/apache-bookworm/Dockerfile`: Added `SQLITE_ENABLE_COLUMN_METADATA=1` to fix Drupal compatibility.
Co-authored-by: hussainweb <1040271+hussainweb@users.noreply.github.com>
This commit consolidates the Docker build and test workflow into a single file (`docker-buildx.yml`), ensuring images are tested before being pushed. It also implements a robust solution for Drupal SQLite installation permissions.
Key changes:
- **Workflow Consolidation:**
- `docker-buildx.yml`: Merged logic from `test-drupal.yml`. Uses `load: true` for testing and `push: true` on success.
- `test-drupal.yml`: Deleted.
- **Robust Drupal Installation (`tests/install-drupal.sh`):**
- Accepts explicit version constraints (`^10`, `^11`) to prevent PHP/Drupal version mismatches.
- Corrected SQLite connection string to remove `localhost` (`sqlite://sites/default/files/.ht.sqlite`).
- **Dynamic Permission Fix:** Parses `drush status --format=json` to find the exact location of the SQLite database and `chmod 777` its directory, ensuring the web server can write to it during tests.
- **Improved Verification (`tests/verify-drupal.sh`):**
- Updated debugging logic to dynamically find the SQLite database via Drush and log its specific permissions, rather than listing generic directories.
- **Image Compatibility (`php8/apache-bookworm/Dockerfile`):**
- Added `SQLITE_ENABLE_COLUMN_METADATA=1` to support Drupal requirements.
Co-authored-by: hussainweb <1040271+hussainweb@users.noreply.github.com>
This commit consolidates the Docker build and test workflow into a single file (`docker-buildx.yml`), ensuring images are tested before being pushed. It also implements a robust solution for Drupal SQLite installation permissions.
Key changes:
- **Workflow Consolidation:**
- `docker-buildx.yml`: Merged logic from `test-drupal.yml`. Uses `load: true` for testing and `push: true` on success.
- `test-drupal.yml`: Deleted.
- **Robust Drupal Installation (`tests/install-drupal.sh`):**
- Accepts explicit version constraints (`^10`, `^11`) to prevent PHP/Drupal version mismatches.
- Corrected SQLite connection string to remove `localhost` (`sqlite://sites/default/files/.ht.sqlite`).
- **Dynamic Permission Fix:** Parses `drush status --format=json` to find the exact location of the SQLite database. It now runs `chmod 777` on the directory AND `chmod 666` on the database file itself, ensuring full write access.
- **Improved Verification (`tests/verify-drupal.sh`):**
- Updated debugging logic to dynamically find the SQLite database via Drush and log its specific permissions.
- **Image Compatibility (`php8/apache-bookworm/Dockerfile`):**
- Added `SQLITE_ENABLE_COLUMN_METADATA=1` to support Drupal requirements.
Co-authored-by: hussainweb <1040271+hussainweb@users.noreply.github.com>
This commit consolidates the Docker build and test workflow into a single file (`docker-buildx.yml`), ensuring images are tested before being pushed. It also implements a robust solution for Drupal SQLite installation permissions, handling both absolute and relative paths returned by Drush.
Key changes:
- **Workflow Consolidation:**
- `docker-buildx.yml`: Merged logic from `test-drupal.yml`. Uses `load: true` for testing and `push: true` on success.
- `test-drupal.yml`: Deleted.
- **Robust Drupal Installation (`tests/install-drupal.sh`):**
- Accepts explicit version constraints (`^10`, `^11`) to prevent PHP/Drupal version mismatches.
- Corrected SQLite connection string to remove `localhost` (`sqlite://sites/default/files/.ht.sqlite`).
- **Dynamic Permission Fix:** Parses `drush status --format=json` to find the exact location of the SQLite database.
- **Path Handling:** Added logic to detect relative paths (e.g. from Drupal 11) and prepend `${WEBROOT}/web/` to resolve them correctly.
- Explicitly sets `chmod 777` on the directory and `chmod 666` on the database file.
- **Improved Verification (`tests/verify-drupal.sh`):**
- Updated debugging logic to dynamically find the SQLite database via Drush, handle relative paths, and log its specific permissions.
- **Image Compatibility (`php8/apache-bookworm/Dockerfile`):**
- Added `SQLITE_ENABLE_COLUMN_METADATA=1` to support Drupal requirements.
Co-authored-by: hussainweb <1040271+hussainweb@users.noreply.github.com>
Consolidated the Drupal testing workflow into the main Docker build workflow.
Deleted
.github/workflows/test-drupal.ymland updated.github/workflows/docker-buildx.ymlto include:install-drupal.shandverify-drupal.shusingdocker compose.mainbranch and after successful tests.push(main) andpull_request.PR created automatically by Jules for task 14732200155072337463 started by @hussainweb
Summary by CodeRabbit
Chores
Tests
Bug Fixes