From 08d515825687645ed9e95e7166e3288c62eb3b94 Mon Sep 17 00:00:00 2001
From: Philipp Stephani
Date: Thu, 18 Apr 2024 00:59:59 +0200
Subject: [PATCH] Also run tests with locally-installed Emacs
---
.github/actions/set-up/action.yaml | 4 +++-
build.py | 16 ++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/.github/actions/set-up/action.yaml b/.github/actions/set-up/action.yaml
index 6de2d31e1..126c3ea2f 100644
--- a/.github/actions/set-up/action.yaml
+++ b/.github/actions/set-up/action.yaml
@@ -45,7 +45,7 @@ runs:
- name: Install Homebrew packages
# The Protocol Buffer rules need ‘realpath’ from the GNU coreutils.
shell: bash
- run: brew update && brew install coreutils
+ run: brew update && brew install coreutils emacs
if: runner.os == 'macOS'
- name: Install MSYS2
uses: msys2/setup-msys2@v2
@@ -57,6 +57,7 @@ runs:
base-devel
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-xpm-nox
+ mingw-w64-x86_64-emacs
if: runner.os == 'Windows'
- name: Configure system (Windows)
# Make Bazel find the right binaries on GitHub. See
@@ -68,6 +69,7 @@ runs:
shell: cmd
run: >-
ECHO BAZEL_SH=C:\MSYS64\usr\bin\bash.exe>> %GITHUB_ENV%
+ && ECHO EMACS=C:\MSYS64\mingw64\bin\emacs.exe>> %GITHUB_ENV%
&& MKDIR %RUNNER_TEMP%\output-base
&& SUBST O: %RUNNER_TEMP%\output-base
&& ECHO startup --output_base='O:\\'>> github.bazelrc
diff --git a/build.py b/build.py
index 2ffea4171..e526111c2 100755
--- a/build.py
+++ b/build.py
@@ -24,6 +24,7 @@
import io
import os
import pathlib
+import platform
import shlex
import shutil
import subprocess
@@ -91,6 +92,7 @@ def check(self) -> None:
# Test both default toolchain and versioned toolchains.
self.test()
self.versions()
+ self.local()
self.ext()
@target
@@ -140,6 +142,20 @@ def versions(self) -> None:
self._test(f'--extra_toolchains=//elisp:emacs_{version}_toolchain',
profile=version)
+ @target
+ def local(self) -> None:
+ """Runs the Bazel tests under the locally-installed Emacs."""
+ if platform.system() == 'Linux':
+ distribution, release = subprocess.run(
+ ['lsb_release', '--short', '--id', '--release'], check=True,
+ stdout=subprocess.PIPE, encoding='utf-8').stdout.splitlines()
+ if distribution == 'Ubuntu' and release.startswith('22.'):
+ # Once GitHub switches to Ubuntu 24.04, drop this branch.
+ print('Local Emacs is too old')
+ return
+ self._test('--extra_toolchains=//elisp:local_toolchain',
+ profile='local')
+
def _test(self, *args: str, profile: str,
cwd: Optional[pathlib.Path] = None) -> None:
for bzlmod in (True, False):