Skip to content

Commit b1757ed

Browse files
committed
Add a script to test under Emacs 27.2 via nix-emacs-ci
CI does not cover Emacs 27, but Package-Requires now declares it as the floor, so there has to be a way to check it by hand. nix-emacs-ci does not expose Emacs 27 on aarch64-darwin (it fails to build old Emacs on that platform), only on x86_64-darwin, so on Apple Silicon this goes through Rosetta -- which needs `extra-platforms = x86_64-darwin` in nix.conf. The prebuilt binaries are also not cached for x86_64-darwin, so the first run builds Emacs from source; the nix-emacs-ci revision is pinned so that later runs reuse it instead of rebuilding.
1 parent 212d65f commit b1757ed

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

.github/run-emacs-27-2.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env bash
2+
# Build this package with Emacs 27.2 from nix-emacs-ci.
3+
#
4+
# CI does not cover Emacs 27 (see .github/workflows/test.yml), so this is the
5+
# way to check the floor declared in Package-Requires by hand.
6+
#
7+
# nix-emacs-ci does not expose Emacs 27 on aarch64-darwin, only on
8+
# x86_64-darwin, so on Apple Silicon this runs through Rosetta. That needs
9+
# `extra-platforms = x86_64-darwin` in /etc/nix/nix.conf. Reaching the
10+
# prebuilt binaries also needs your user in `trusted-users` there, otherwise
11+
# the daemon silently ignores the substituter below and builds from source.
12+
set -euo pipefail
13+
14+
# Pinned rather than master, so that the Emacs you get today is the Emacs you
15+
# got last time. nix-emacs-ci pins nixpkgs in its own flake.lock, so following
16+
# master would change the derivation -- and on a platform without prebuilt
17+
# binaries (see below) that means rebuilding Emacs from source.
18+
NIX_EMACS_CI_REV=${NIX_EMACS_CI_REV:-ca88f42462347e8e17859645aa59b156617e98fb}
19+
NIX_EMACS_CI=${NIX_EMACS_CI:-https://github.com/purcell/nix-emacs-ci/archive/${NIX_EMACS_CI_REV}.tar.gz}
20+
EMACS_ATTR=${EMACS_ATTR:-emacs-27-2}
21+
22+
case "$(uname -s)/$(uname -m)" in
23+
Darwin/arm64) SYSTEM=x86_64-darwin ;;
24+
Darwin/*) SYSTEM=x86_64-darwin ;;
25+
Linux/x86_64) SYSTEM=x86_64-linux ;;
26+
Linux/aarch64) SYSTEM=aarch64-linux ;;
27+
*) echo "unsupported host: $(uname -s)/$(uname -m)" >&2; exit 1 ;;
28+
esac
29+
30+
cd "$(dirname "$0")/.."
31+
32+
echo "==> Fetching ${EMACS_ATTR} for ${SYSTEM}"
33+
emacs_path=$(nix-build --no-out-link \
34+
--option system "${SYSTEM}" \
35+
--option extra-substituters https://emacs-ci.cachix.org \
36+
--option extra-trusted-public-keys emacs-ci.cachix.org-1:B5FVOrxhXXrOL0S+tQ7USrhjMT5iOPH+QN9q0NItom4= \
37+
-A "${EMACS_ATTR}" \
38+
-E "import (fetchTarball \"${NIX_EMACS_CI}\")")
39+
40+
export PATH="${emacs_path}/bin:${PATH}"
41+
export EMACS="${emacs_path}/bin/emacs"
42+
43+
echo "==> $("${EMACS}" --version | head -1)"
44+
45+
# Stale .elc files silently win over newer .el, which would hide a failure.
46+
find . -maxdepth 1 -name '*.elc' -delete
47+
rm -rf .eask
48+
49+
echo "==> eask install-deps"
50+
eask install-deps
51+
52+
echo "==> eask compile"
53+
eask compile
54+
55+
echo "==> OK"

0 commit comments

Comments
 (0)