Test for Emacs compiler warnings

Setup

Your .gitignore:

*.elc

A Makefile containing:

.PHONY: compile
compile:
	@emacs -q -batch \
	  --eval '(setq byte-compile-error-on-warn t)' \
	  -f batch-byte-compile \
	  *.el

The first indentation is a tab, the following two are spaces. Makefiles just work this way for reasons beyond human comprehension.

Run

Executing make compile will compile all your .el files and error in case there are any warnings.

CI

compile:
  image: silex/emacs:${EMACS_VERSION}-alpine-ci
  parallel:
    matrix:
      - EMACS_VERSION:
          - 26.1
          - 26.2
          - 26.3
          - 27.1
          - 27.2
          - 28.1
          - master
  script:
    - make compile
name: CI

on: [push, pull_request]

jobs:
  compile:
    name: 'Compile code and check for warnings'
    runs-on: debian-latest
    strategy:
      matrix:
        emacs_version:
          - 26.1
          - 26.2
          - 26.3
          - 27.1
          - 27.2
          - 28.1
          - snapshot
    steps:
      - name: 'Install Emacs'
        uses: purcell/setup-emacs@master
        with:
          version: ${{ matrix.emacs_version }}
      - name: 'Checkout code'
        uses: actions/checkout@v2
      - name: 'Byte compile and check for warnings'
        run: make compile