From 69d8b29f839d8fee957e644013000f90c1283be4 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Tue, 5 May 2026 05:27:12 -0500 Subject: ci: add GitHub Actions workflow with test matrix, lint, and coverage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I added `.github/workflows/ci.yml` with three jobs: 1. test — Emacs 27.1 / 28.2 / 29.4 / 30.1, runs `make compile` (strict warnings) and `make test-all`. fail-fast off so one version's failure doesn't hide others. 2. lint (advisory) — `eask lint package`, `eask lint checkdoc`, and `make lint` (elisp-lint). All three are `continue-on-error: true` because there's an existing MELPA-prep backlog (1 package-lint error in chime-org-contacts.el, ~17 cosmetic checkdoc/package-lint warnings) that's worth surfacing without blocking CI. Tighten to required once the backlog is cleared. 3. coverage — runs the full suite with undercover and uploads to Coveralls via the official action. No secret needed because the repo is public — GITHUB_TOKEN is enough. Two supporting changes: - `tests/run-coverage-file.el` now switches between simplecov (local) and coveralls (CI, detected via the `CI` env var GitHub Actions sets automatically) report formats. The Coveralls action expects coveralls JSON. - `Makefile`'s `coverage' target now runs ALL_TESTS with selector `t', not UNIT_TESTS with `(not (tag :slow))'. Without this the integration tests contributed nothing to the reported coverage number. --- Makefile | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index ca224e7..7c6d5e2 100644 --- a/Makefile +++ b/Makefile @@ -17,9 +17,11 @@ SOURCE_FILE = chime.el COVERAGE_DIR = .coverage COVERAGE_FILE = $(COVERAGE_DIR)/simplecov.json -# Unit-test files (used by coverage loop, mirroring tests/Makefile) -UNIT_TESTS = $(filter-out $(TEST_DIR)/test-bootstrap.el $(TEST_DIR)/test-integration-%.el, \ - $(wildcard $(TEST_DIR)/test-*.el)) +# Test-file lists used by the coverage loop, mirroring tests/Makefile. +# Coverage runs ALL_TESTS (including :slow integration tests) so the report +# represents the full suite; selector is `t' rather than `(not (tag :slow))'. +ALL_TESTS = $(filter-out $(TEST_DIR)/test-bootstrap.el, \ + $(wildcard $(TEST_DIR)/test-*.el)) # Include local overrides if present (per-machine knobs, not committed) -include makefile-local @@ -110,10 +112,10 @@ compile: coverage: coverage-clean $(COVERAGE_DIR) @echo "[i] Cleaning .elc files so undercover can instrument source..." @find . -name "*.elc" -delete - @echo "[i] Running coverage across $(words $(UNIT_TESTS)) unit-test file(s)..." - @echo " (slower than 'make test-unit' — each file runs in its own Emacs)" + @echo "[i] Running coverage across $(words $(ALL_TESTS)) test file(s)..." + @echo " (slower than 'make test' — each file runs in its own Emacs)" @failed=0; \ - for test in $(UNIT_TESTS); do \ + for test in $(ALL_TESTS); do \ echo " Coverage: $$test..."; \ testfile=$$(basename $$test); \ $(EMACS_BATCH_TESTS) \ @@ -121,14 +123,16 @@ coverage: coverage-clean $(COVERAGE_DIR) -l run-coverage-file.el \ -l ../$(SOURCE_FILE) \ -l $$testfile \ - --eval "(ert-run-tests-batch-and-exit '(not (tag :slow)))" || failed=$$((failed + 1)); \ + --eval "(ert-run-tests-batch-and-exit t)" || failed=$$((failed + 1)); \ done; \ if [ $$failed -gt 0 ]; then \ echo "[!] $$failed test file(s) failed during coverage run"; \ exit 1; \ fi - @if [ -f $(COVERAGE_FILE) ]; then \ - echo "[✓] Coverage report: $(COVERAGE_FILE) ($$(du -h $(COVERAGE_FILE) | cut -f1))"; \ + @coverage_file="$${COVERAGE_FILE_ACTUAL:-$(COVERAGE_FILE)}"; \ + [ -n "$$CI" ] && coverage_file="$(COVERAGE_DIR)/coveralls.json"; \ + if [ -f "$$coverage_file" ]; then \ + echo "[✓] Coverage report: $$coverage_file ($$(du -h $$coverage_file | cut -f1))"; \ else \ echo "[!] No coverage file produced; check that undercover is installed"; \ exit 1; \ -- cgit v1.2.3