aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-05 05:27:12 -0500
committerCraig Jennings <c@cjennings.net>2026-05-05 05:27:12 -0500
commit69d8b29f839d8fee957e644013000f90c1283be4 (patch)
tree1e003871ed3fa3a11e15e3e0b643cbf0f16d7a13
parent1487cbc03d1c447e9c4b31bfbe44330df10a6d29 (diff)
downloadchime-69d8b29f839d8fee957e644013000f90c1283be4.tar.gz
chime-69d8b29f839d8fee957e644013000f90c1283be4.zip
ci: add GitHub Actions workflow with test matrix, lint, and coverage
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.
-rw-r--r--.github/workflows/ci.yml100
-rw-r--r--Makefile22
-rw-r--r--tests/run-coverage-file.el12
3 files changed, 122 insertions, 12 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..6ad5618
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,100 @@
+name: CI
+
+on:
+ push:
+ branches: [main]
+ tags: ['v*']
+ pull_request:
+ branches: [main]
+
+jobs:
+ test:
+ name: Test (Emacs ${{ matrix.emacs_version }})
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ emacs_version: ['27.1', '28.2', '29.4', '30.1']
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Set up Emacs
+ uses: jcs090218/setup-emacs@master
+ with:
+ version: ${{ matrix.emacs_version }}
+
+ - name: Set up Eask
+ uses: emacs-eask/setup-eask@master
+ with:
+ version: 'snapshot'
+
+ - name: Install dependencies
+ run: eask install-deps --dev
+
+ - name: Byte-compile (warnings are errors)
+ run: make compile
+
+ - name: Run full test suite
+ run: make test-all
+
+ lint:
+ name: Lint (advisory)
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Set up Emacs
+ uses: jcs090218/setup-emacs@master
+ with:
+ version: '29.4'
+
+ - name: Set up Eask
+ uses: emacs-eask/setup-eask@master
+ with:
+ version: 'snapshot'
+
+ - name: Install dependencies
+ run: eask install-deps --dev
+
+ # Lint output is informational while the MELPA-prep backlog is being
+ # worked through. Tighten to required once that backlog is clear.
+ - name: package-lint
+ continue-on-error: true
+ run: eask lint package
+
+ - name: checkdoc
+ continue-on-error: true
+ run: eask lint checkdoc
+
+ - name: elisp-lint
+ continue-on-error: true
+ run: make lint
+
+ coverage:
+ name: Coverage
+ runs-on: ubuntu-latest
+ needs: test
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Set up Emacs
+ uses: jcs090218/setup-emacs@master
+ with:
+ version: '29.4'
+
+ - name: Set up Eask
+ uses: emacs-eask/setup-eask@master
+ with:
+ version: 'snapshot'
+
+ - name: Install dependencies
+ run: eask install-deps --dev
+
+ - name: Generate coverage report
+ run: make coverage
+
+ - name: Upload to Coveralls
+ uses: coverallsapp/github-action@v2
+ with:
+ file: .coverage/coveralls.json
+ format: coveralls
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; \
diff --git a/tests/run-coverage-file.el b/tests/run-coverage-file.el
index 0a07696..d96f8d2 100644
--- a/tests/run-coverage-file.el
+++ b/tests/run-coverage-file.el
@@ -31,13 +31,19 @@
;; otherwise overwrite the value.
(setq undercover-force-coverage t)
+;; Local runs emit simplecov for whatever local tooling wants it. CI sets
+;; CI=true (GitHub Actions does this automatically), so we emit a coveralls
+;; JSON instead and leave it on disk for the upload action to pick up.
;; The `undercover' macro splices each configuration list into `(list ,@it)',
;; which evaluates the elements. Wildcard strings have to stay atoms — using
;; `(:files ...)' form lets us evaluate `expand-file-name' to an absolute path.
(undercover (:files (expand-file-name "chime.el" run-coverage--project-root))
- (:report-format 'simplecov)
- (:report-file (expand-file-name ".coverage/simplecov.json"
- run-coverage--project-root))
+ (:report-format (if (getenv "CI") 'coveralls 'simplecov))
+ (:report-file (expand-file-name
+ (if (getenv "CI")
+ ".coverage/coveralls.json"
+ ".coverage/simplecov.json")
+ run-coverage--project-root))
(:merge-report t)
(:send-report nil))