ci: prek linters, lint and test workflows #7

Merged
ivuorinen merged 10 commits from prek-linters into main 2026-10-01 05:58:27 +00:00
Owner

Summary

Lint and test in one place, locally and in CI.

  • prek hooks (.pre-commit-config.yaml, pinned; Renovate's pre-commit manager keeps them current): pre-commit-hooks basics, shellcheck, shfmt, hadolint, yamllint, actionlint, markdownlint-cli2, editorconfig-checker. All ship Python/Node-packaged tools: no Docker-image hooks (bind mounts don't resolve inside DinD jobs) and no system hooks.
  • Rules: .editorconfig (LF, UTF-8, final newline, 2-space indent including *.sh; Markdown indentation unset so tab-indented shell samples in docs/ stay valid), .yamllint.yml (document-start off, line length 160, on: keys allowed, one space before comments), .markdownlint-cli2.jsonc (no line length, tabs allowed in code blocks).
  • One-time cleanup: shfmt re-indented the four scripts to two spaces (git diff -w shows only the split bad() helpers); 14 missing blank lines before lists and one table separator fixed in docs/.
  • lint workflow: every push and PR; installs a checksum-verified prek 0.5.3 into a temp dir on $GITHUB_PATH (no root needed), runs every hook.
  • test workflow: only when Dockerfile, entrypoint.sh, healthcheck.sh, compose.yaml, tests/** or the workflow change; PyYAML in a venv, then both test scripts against the runner's DinD.
  • Test isolation: tests/entrypoint.test.sh names its image and container per run (RUN_ID from /dev/urandom) and removes them in an EXIT trap, so concurrent jobs on one runner's shared daemon don't collide.
  • README: Testing becomes Development (prek install, prek run --all-files, the two workflows).

Spec and plan: docs/superpowers/specs/2026-09-27-prek-linters-design.md, docs/superpowers/plans/2026-09-27-prek-linters.md.

Verification

  • prek run --all-files passes; both test scripts pass after the re-indent.
  • Negative checks: a trailing space and an undefined workflow expression make the hooks fail.
  • Before the isolation fix, two concurrent tests/entrypoint.test.sh runs collided (conflict: unable to remove repository reference); after it, both pass and leave no coolify-forgejo-runner:test-* images or cfr-entrypoint-test-* containers, including after an early exit.
  • CI on the runners: lint and test green for 6efeffd; the docs-only push f181095 ran lint only (green) and no test.
  • First CI run (task 1171) failed installing prek to /usr/local/bin on a runner still on the non-root image; the install no longer needs root.
## Summary Lint and test in one place, locally and in CI. - **prek hooks** (`.pre-commit-config.yaml`, pinned; Renovate's pre-commit manager keeps them current): pre-commit-hooks basics, shellcheck, shfmt, hadolint, yamllint, actionlint, markdownlint-cli2, editorconfig-checker. All ship Python/Node-packaged tools: no Docker-image hooks (bind mounts don't resolve inside DinD jobs) and no system hooks. - **Rules:** `.editorconfig` (LF, UTF-8, final newline, 2-space indent including `*.sh`; Markdown indentation unset so tab-indented shell samples in `docs/` stay valid), `.yamllint.yml` (document-start off, line length 160, `on:` keys allowed, one space before comments), `.markdownlint-cli2.jsonc` (no line length, tabs allowed in code blocks). - **One-time cleanup:** shfmt re-indented the four scripts to two spaces (`git diff -w` shows only the split `bad()` helpers); 14 missing blank lines before lists and one table separator fixed in `docs/`. - **`lint` workflow:** every push and PR; installs a checksum-verified prek 0.5.3 into a temp dir on `$GITHUB_PATH` (no root needed), runs every hook. - **`test` workflow:** only when `Dockerfile`, `entrypoint.sh`, `healthcheck.sh`, `compose.yaml`, `tests/**` or the workflow change; PyYAML in a venv, then both test scripts against the runner's DinD. - **Test isolation:** `tests/entrypoint.test.sh` names its image and container per run (`RUN_ID` from `/dev/urandom`) and removes them in an `EXIT` trap, so concurrent jobs on one runner's shared daemon don't collide. - README: **Testing** becomes **Development** (`prek install`, `prek run --all-files`, the two workflows). Spec and plan: `docs/superpowers/specs/2026-09-27-prek-linters-design.md`, `docs/superpowers/plans/2026-09-27-prek-linters.md`. ## Verification - `prek run --all-files` passes; both test scripts pass after the re-indent. - Negative checks: a trailing space and an undefined workflow expression make the hooks fail. - Before the isolation fix, two concurrent `tests/entrypoint.test.sh` runs collided (`conflict: unable to remove repository reference`); after it, both pass and leave no `coolify-forgejo-runner:test-*` images or `cfr-entrypoint-test-*` containers, including after an early exit. - CI on the runners: `lint` and `test` green for `6efeffd`; the docs-only push `f181095` ran `lint` only (green) and no `test`. - First CI run (task 1171) failed installing prek to `/usr/local/bin` on a runner still on the non-root image; the install no longer needs root.
ivuorinen deleted branch prek-linters 2026-10-01 05:58:28 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ivuorinen/coolify-forgejo-runners!7
No description provided.