Skip to content

ci: add GitHub Actions CI with ShellCheck, bats unit tests, and a host-prep matrix#48

Merged
mrrobot47 merged 4 commits into
masterfrom
test/add-ci-and-test-suite
Jun 29, 2026
Merged

ci: add GitHub Actions CI with ShellCheck, bats unit tests, and a host-prep matrix#48
mrrobot47 merged 4 commits into
masterfrom
test/add-ci-and-test-suite

Conversation

@mrrobot47

Copy link
Copy Markdown
Member

What this adds

The installer had no automated testing. This adds a first test layer plus CI, with no changes to the installer's production code (setup.sh / functions are untouched — purely additive).

CI — .github/workflows/ci.yml + .shellcheckrc

  • ShellCheck — gates setup.sh + functions at error severity (both are error-clean today); reports the migration scripts informationally until their findings are triaged.
  • shfmt — informational formatting diff.
  • Unit tests — bats suite.
  • Integration matrix — host-prep run across Ubuntu 22.04 / 24.04 / 26.04 / rolling / devel and Debian 12 / 13.

Unit tests — tests/unit/*.bats (31 tests)

External commands (apt-get, curl, sleep, …) are stubbed on PATH, so nothing touches the host:

  • parse_args flag handling
  • ee_apt_update — retries only on apt/dpkg lock contention, aborts on any other error
  • get_ondrej_php_ppa_release_status — 200 / 404 / curl failure
  • ee_select_and_install_php — native vs third-party PPA, version-first ordering, no-candidate
  • download_and_install_easyengine — checksum match / mismatch / empty phar / empty checksum / download failure

Integration — tests/integration/host-prep.sh (+ run-matrix.sh)

Runs the host-prep stage against a distro's real apt repos in a container, bounded before the phar download / image pull (docker stubbed). That step (ee cli info → global service image pulls) is EasyEngine-core behaviour, needs a Docker daemon, and is slow/flaky in CI — so it's out of scope here. What remains is the OS-version-dependent surface that has actually regressed before (PHP selection across releases + the required PHP extensions), which can only be validated against real distro repos and the real ondrej/sury PPAs.

Verification

  • 31/31 unit tests pass (bats/bats container).
  • ShellCheck error-gate green on the core; .shellcheckrc suppresses the unfollowable-source warnings for the runtime-sourced helpers.
  • host-prep passes on Ubuntu 24.04, 26.04, devel (26.10), and Debian 12 — PHP installed via the native repo or the ondrej/sury PPA as appropriate.

Known issues surfaced (documented in tests/README.md, not fixed here)

  • --dry-run is documented and parsed (EE_DRY_RUN) but read nowhereee migrate --dry-run performs a real migration.
  • --trace sets EE_TRACE, but the migration scripts check $TRACE → no-op. --all (EE_SITE_ALL) is also unused.
  • migration/migrate.sh:156 references $new_site_name, which is never assigned.
  • migration/{migrate,remote-migrate} reference undefined $migrate / $Red / $RCol, plus 8 error-level SC2068 unquoted array expansions.

Possible follow-ups

  • An EE_LOCAL_PHAR seam (mirroring the existing EE_LOCAL_FUNCTIONS hook) to enable a full setup.sh end-to-end + idempotency test, and to support air-gapped/mirror installs.
  • add_ssl_renew_cron coverage (incl. the no-existing-crontab case).
  • Fix the migration-script issues above and ratchet ShellCheck to gating for them.
  • Optionally add debian:testing (Forky/14) as the Debian analog of ubuntu:devel for next-release early warning.

Cover the pure-ish logic in `functions` with external commands stubbed on
PATH so nothing touches the host: parse_args flag handling, ee_apt_update
lock-retry behaviour, ondrej PPA status probing, the host-PHP selection
algorithm (native vs third-party, version-first ordering), and the phar
checksum-verification path (match/mismatch/empty/download-failure).
Run the installer's host-preparation stage against a distro's real apt
repos inside a container, bounded before the phar download / image pull
(docker stubbed). Validates PHP selection and the required PHP extensions
across Ubuntu and Debian releases — the OS-version-dependent surface that
stubs cannot reproduce. Includes run-matrix.sh for running the matrix
locally.
GitHub Actions runs ShellCheck (gating setup.sh and functions at error
severity; migration scripts informational), the bats unit suite, and the
host-prep integration matrix across Ubuntu 22.04/24.04/rolling/devel and
Debian 12/13. .shellcheckrc disables the unfollowable-source warnings for
the runtime-sourced helper files. tests/README.md documents the layout,
how to run, the phar-boundary rationale, and the known issues surfaced.
`ubuntu:rolling` resolves to 26.04 today but floats forward to the next
stable release. Pin 26.04 explicitly so the release that drove the host-PHP
fixes keeps a dedicated matrix leg once `rolling` moves on.
@mrrobot47 mrrobot47 merged commit 6297881 into master Jun 29, 2026
11 checks passed
@mrrobot47 mrrobot47 deleted the test/add-ci-and-test-suite branch June 29, 2026 16:27
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