Skip to content

Make sure Eldev quits with a nonzero exit code when an unknown comman… #590

Make sure Eldev quits with a nonzero exit code when an unknown comman…

Make sure Eldev quits with a nonzero exit code when an unknown comman… #590

Workflow file for this run

# NOTE: The following complications are for Eldev itself. Projects
# that _use_ Eldev can have it simpler. Please see the documentation:
#
# https://emacs-eldev.github.io/eldev/#github-workflows
name: CI
on:
push:
paths-ignore: ['**.adoc']
branches-ignore: ['future-doc']
pull_request:
paths-ignore: ['**.adoc']
branches-ignore: ['future-doc']
jobs:
test:
runs-on: ${{matrix.os}}
continue-on-error: ${{matrix.emacs_version == 'snapshot'}}
strategy:
matrix:
os: [ubuntu-latest]
emacs_version: ['24.4', '24.5', '25.1', '25.2', '25.3', '26.1', '26.2', '26.3', '27.1', '27.2', '28.1', '28.2', '29.1', '29.2', 'snapshot']
include:
- os: macos-latest
emacs_version: '29.2'
- os: windows-latest
emacs_version: '29.2'
steps:
- name: Set up Emacs
uses: jcs090218/setup-emacs@master
with:
version: ${{matrix.emacs_version}}
- name: Set up additional packages (Ubuntu)
if: startsWith (matrix.os, 'ubuntu')
run: sudo apt-get -y install texinfo mercurial subversion
- name: Set up additional packages (macOS)
if: startsWith (matrix.os, 'macos')
run: brew install texinfo mercurial subversion
- name: Check out the source code
uses: actions/checkout@v4
with:
# To make automated copyright notice check below work. Can this be optimized?
fetch-depth: 0
- name: Test the project
run: |
# In some older Emacs versions there was a bug where the most
# important stacktrace part with the error would be cut if the
# stacktrace was too long. Just set it to a large number in
# `Eldev-local' and thus have if for the following steps too.
echo "(setf debugger-batch-max-lines 10000)" >> Eldev-local
./bin/eldev -p -dtQTC test --omit-backtraces --expect 400
env:
ELDEV_LOCAL: "."
- name: Verify robust mode activation
run: |
# Robust mode is automatic by default. Make sure that this
# resolves to "yes" on GitHub at least. See comments in the
# function for reason of this weirdness.
./bin/eldev -p -dtQTC exec "(unless (eldev-retry-on-errors-p) (signal 'eldev-error (list (eldev--list-to-string '(Must default to robust mode on GitHub)))))"
env:
ELDEV_LOCAL: "."
- name: Test integration
run: ./bin/eldev -p -dtTC test-integration --omit-backtraces --expect 30
env:
ELDEV_LOCAL: "."
- name: Ensure clean byte-compilation
run: |
# Also require that byte-compilation produces no warnings.
# We'd use Eldev itself to byte-compile, but that could hide
# some problems (for Eldev itself, other packages should be
# fine) by indirectly loading `.el' first.
emacs --batch --load .github/workflows/bytecompile.el
# Ensure that our tests can be compiled cleanly: warnings
# might indicate something is wrong with the test. Here we
# can already use Eldev.
./bin/eldev -p -dtQTC compile --set test --warnings-as-errors
env:
ELDEV_LOCAL: "."
- name: Lint the project
run: |
# Run `relint' on Eldev's source code, more as a test of
# Eldev--relint integration, because we use `rx' macro.
./bin/eldev -p -dtQTC lint re
env:
ELDEV_LOCAL: "."
- name: Doctor the project
run: |
# Run `doctor' on the project itself. Git hooks are not going
# to be installed in this checkout. Also, don't insist on
# recent stable releases here.
#
# Notes
#
# 1. The `eldev-file-owners` test is disabled on MS-Windows
# because the test expects the onwer of the cache to match the
# user name, but it is instead set to the administrators group
# on the GH CI, see discussion in
# https://github.com/emacs-eldev/eldev/pull/88.
#
# 2. The `--` is escaped with `"` for cross platform
# compatibility because in PowerShell `--` is a special
# operator.
./bin/eldev -S "(when (eq system-type 'windows-nt) (push 'eldev-file-owners eldev-doctor-disabled-tests))" -p -dtQTC doctor "--" -githooks -recent-stable-releases
env:
ELDEV_LOCAL: "."
# Method 1: if you have a catch-all directory for executables. We
# don't test bootstrapping, as that is supposed to have been
# tested by normal ERT tests.
- name: Test installation 1
uses: actions/github-script@v7
with:
script: |
const exec_ = require('util').promisify(require('child_process').exec);
const {downloadScript,expandTilde} = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/util.js`);
const fakeBin = expandTilde('~/fake-bin');
await io.mkdirP(fakeBin);
const script = await downloadScript(github, context, "bin/eldev", fakeBin);
const eldev_out = await exec_(script);
console.log(eldev_out.stdout);
# Method 2: general case, with Eldev script installed to
# `~/.local/bin'. We don't add it to `$PATH' as we run it using the absolute path
- name: Test installation 2
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const exec_ = require('util').promisify(require('child_process').exec);
const {getRawUrl,downloadScript,expandTilde} = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/util.js`);
if (fs.existsSync(expandTilde("~/.local/bin/eldev")))
throw("~/.local/bin/eldev already exists");
await io.mkdirP('tmp');
const script = await downloadScript(github, context, "webinstall/eldev", 'tmp');
const eldev_bin_url = getRawUrl(context,"bin/eldev");
await exec_(`${script} ${eldev_bin_url}`);
const eldev_out = await exec_(expandTilde("~/.local/bin/eldev"));
console.log(eldev_out.stdout);
await io.rmRF(expandTilde("~/.local/bin"));
# GitHub-specific installation specifically for workflows.
- name: Test GitHub-specific installation (1/2)
if: "!startsWith (matrix.os, 'windows')"
run: |
if command -v eldev &> /dev/null
then
echo eldev is already installed.
exit 1
else
curl -fsSL https://raw.github.com/emacs-eldev/eldev/master/webinstall/github-eldev | sh
fi
- name: Test GitHub-specific installation on MS-Windows (1/2)
if: startsWith (matrix.os, 'windows')
run: |
if (Get-Command "eldev" -ErrorAction SilentlyContinue)
{
throw 'eldev is already installed.'
}
else
{
curl.exe -fsSL https://raw.github.com/emacs-eldev/eldev/master/webinstall/github-eldev.bat | cmd /Q
}
- name: Test GitHub-specific installation (2/2)
run: |
eldev help && rm ~/.local/bin/eldev*