Skip to content

Fix prod/CI Makefile targets and run image build on PRs#818

Draft
malberts wants to merge 7 commits into
masterfrom
fix-prod-ci-makefile
Draft

Fix prod/CI Makefile targets and run image build on PRs#818
malberts wants to merge 7 commits into
masterfrom
fix-prod-ci-makefile

Conversation

@malberts
Copy link
Copy Markdown
Contributor

@malberts malberts commented May 12, 2026

PR #811 made install-db, load-neo4j-users, and wait-for-neo4j depend on
test_neo, which is profile-gated to dev. Both CI (against docker-compose.ci.yml)
and the VPS upgrade flow (against docker-compose.yml) now fail at the 60s
test_neo wait. CI on master has been red since the merge.

Decouple test_neo from the shared targets:

  • wait-for-neo4j and load-neo4j-users now wait/configure only neo.
  • A new dev-only setup-test-neo target waits for and seeds test_neo. It is
    explicitly chained by _first-run-seed and reset (the only dev call sites).
  • EXEC_MW_ROOT/EXEC_MW switch from $(DC_DEV) to $(DC). docker compose exec
    attaches by project+service to the already-running mediawiki container, so
    this works in both dev and prod without overlay coupling.

Add two new targets:

  • update for VPS upgrades: pull, up -d with --profile server, wait for db
    and neo readiness, then update.php.
  • smoke-test wrapping Docker/test.sh for CI.

Update build-docker.yml: drop working-directory: Docker from the make steps
so they pick up the top-level Makefile, switch the start step to make up so
the docker compose project name matches subsequent make invocations, rename
the test step to make smoke-test. Add pull_request trigger so the build
runs (without ghcr push) on every PR and catches regressions like this one
before merge.

Test plan

  • Full make dev cycle from a fresh /tmp checkout (port 8500). Wiki
    responds 200; setup-test-neo seeded test_neo.
  • Full prod sequence from a separate fresh /tmp checkout (port 8501):
    make up && make install-db && make load-neo4j-users && make smoke-test && make import-demo-data. Wiki responds 200.
  • make reset after a dev setup. Chain completes including the new
    setup-test-neo step.
  • make update end-to-end against a fresh prod stack (with Caddy ports
    remapped to 8080/8443 to avoid host conflicts on a dev machine).
    Pull + up + db/neo readiness wait + update.php all succeed.
  • CI (this PR) goes green.

alistair3149 added a commit that referenced this pull request May 12, 2026
Establishes Docker/tests/ as the home for shell-script tests at the
Docker layer, keeping the top-level tests/ subtree PHP-only.

* Docker/test.sh -> Docker/tests/smoke.sh. Renamed to a descriptive
  name (was ambiguous "test.sh"), and now resolves Docker/.env relative
  to its own script directory so it can be invoked from anywhere.
* Docker/tests/test-set-port.sh added. Locks in the coverage matrix
  from the previous commit as an executable regression suite, catching
  the Morne fresh-clone bug and the three new behaviours of the fix:
  idempotent re-run, explicit-port-validation, and out-of-range
  override protection. Uses python3 to hold contested ports
  (backlog 128 + accept-and-close loop to avoid kernel SYN drops once
  the accept queue fills). Allocates into a high MW range
  (38484-38499) so a busy 8484-8499 on the host does not perturb
  assertions.
* New `make test-scripts` target runs the regression suite. Kept out
  of `make test` / `make ci` so it does not become a CI gate on the
  first iteration. Promote to CI after a few sprints once stability
  is confirmed.

Note: PR #818's draft `smoke-test` target needs to point at
`Docker/tests/smoke.sh` after this lands.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@alistair3149
Copy link
Copy Markdown
Member

Heads-up — PR #820 renames Docker/test.shDocker/tests/smoke.sh (consolidating shell tests into Docker/tests/). The planned smoke-test target in this PR needs its path updated to match before / after merging #820, depending on which lands first.

Coordination note from work on #820.
Claude Code, Opus 4.7

malberts pushed a commit that referenced this pull request May 13, 2026
Establishes Docker/tests/ as the home for shell-script tests at the
Docker layer, keeping the top-level tests/ subtree PHP-only.

* Docker/test.sh -> Docker/tests/smoke.sh. Renamed to a descriptive
  name (was ambiguous "test.sh"), and now resolves Docker/.env relative
  to its own script directory so it can be invoked from anywhere.
* Docker/tests/test-set-port.sh added. Locks in the coverage matrix
  from the previous commit as an executable regression suite, catching
  the Morne fresh-clone bug and the three new behaviours of the fix:
  idempotent re-run, explicit-port-validation, and out-of-range
  override protection. Uses python3 to hold contested ports
  (backlog 128 + accept-and-close loop to avoid kernel SYN drops once
  the accept queue fills). Allocates into a high MW range
  (38484-38499) so a busy 8484-8499 on the host does not perturb
  assertions.
* New `make test-scripts` target runs the regression suite. Kept out
  of `make test` / `make ci` so it does not become a CI gate on the
  first iteration. Promote to CI after a few sprints once stability
  is confirmed.

Note: PR #818's draft `smoke-test` target needs to point at
`Docker/tests/smoke.sh` after this lands.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@malberts malberts force-pushed the fix-prod-ci-makefile branch from e00ca44 to 2fa17a6 Compare May 13, 2026 19:17
malberts and others added 6 commits May 17, 2026 01:52
PR #811 made install-db, load-neo4j-users, and wait-for-neo4j depend on
test_neo, which is profile-gated to dev. Both CI (against docker-compose.ci.yml)
and the VPS upgrade flow (against docker-compose.yml) now fail at the 60s
test_neo wait. CI on master has been red since the merge.

Decouple test_neo from the shared targets:

- wait-for-neo4j and load-neo4j-users now wait/configure only `neo`.
- A new dev-only setup-test-neo target waits for and seeds test_neo. It is
  explicitly chained by _first-run-seed and reset (the only dev call sites).
- EXEC_MW_ROOT/EXEC_MW switch from $(DC_DEV) to $(DC). docker compose exec
  attaches by project+service to the already-running mediawiki container, so
  this works in both dev and prod without overlay coupling.

Add two new targets:

- `update` for VPS upgrades: pull, up -d with --profile server, update.php.
- `smoke-test` wrapping Docker/test.sh for CI.

Update build-docker.yml: drop working-directory: Docker from the make steps so
they pick up the top-level Makefile, switch the start step to `make up` so the
docker compose project name matches subsequent make invocations, rename the
test step to `make smoke-test`. Add pull_request trigger and concurrency
cancellation so the build runs (without ghcr push) on every PR and catches
regressions like this one before merge.

Verified locally: full `make dev` cycle succeeds (including setup-test-neo);
`make up && make install-db && make load-neo4j-users && make smoke-test`
succeeds end-to-end against the prod stack.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
GitHub Actions defaults to 360 min per job. Successful runs of this workflow
take ~5 min, and the internal wait-for-it.sh / docker healthcheck timeouts
already bound runtime, so an explicit 20-min cap added nothing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
docker compose up -d returns when containers are started, not when they are
ready. update.php would race the db on the first invocation after a recreate
and fail with "Connection refused (db:3306)". Add the same wait-for-it.sh
pattern install-db uses.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The repo is public, so GitHub Actions minutes are effectively unlimited and
the stale-run savings are symbolic. No other workflow in the repo uses
concurrency, so introducing it just here was inconsistent for no real gain.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the complicated `docker compose --profile server -p neowiki-neowiki
--project-directory Docker up -d` invocation in Docker/README.md. The explicit
project name was needed so that subsequent `make install-db` etc. would attach
to the same containers; wrapping it in a target keeps the project-name
plumbing out of the docs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The script moved from Docker/test.sh to Docker/tests/smoke.sh and now
resolves Docker/.env relative to its own location, so it can be invoked
from any directory.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@malberts malberts force-pushed the fix-prod-ci-makefile branch from 2fa17a6 to 99769ad Compare May 16, 2026 23:52
PR #829 (88a1121) dropped `--project-directory Docker` from the DC
line to unblock podman-compose, but only DC_DEV carried the
compensating `-f Docker/docker-compose.yml`. Bare $(DC) (used by
`up`, `server-up`, `load-neo4j-users`, EXEC_MW_ROOT) was left with
no way to locate the compose file when invoked from the repo root,
so the CI "Start containers" step (`make up`) failed with
"no configuration file provided: not found".

Move `-f Docker/docker-compose.yml` onto the DC line and drop the
now-duplicate flag from DC_DEV. DC_DEV/DC_TOOLS render identically
to before (verified via `make -n`); bare $(DC) now resolves from
root, podman-safe (no --project-directory).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants