Skip to content

Commit

Permalink
Also run tests with locally-installed Emacs
Browse files Browse the repository at this point in the history
  • Loading branch information
phst committed Apr 19, 2024
1 parent 0b61b12 commit 6ea9065
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/actions/set-up/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
16 changes: 16 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io
import os
import pathlib
import platform
import shlex
import shutil
import subprocess
Expand Down Expand Up @@ -91,6 +92,7 @@ def check(self) -> None:
# Test both default toolchain and versioned toolchains.
self.test()
self.versions()
self.local()
self.ext()

@target
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 6ea9065

Please sign in to comment.