-
Notifications
You must be signed in to change notification settings - Fork 17
184 lines (166 loc) · 7.02 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# 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', '29.3', '29.4',
'snapshot']
include:
- os: macos-latest
emacs_version: '29.4'
- os: windows-latest
emacs_version: '29.4'
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*