-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4e351fb
commit 825802d
Showing
1 changed file
with
9 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,20 @@ | ||
#! /bin/bash | ||
|
||
# Run tests locally (as close as possible to Github Worflows). | ||
# It requires Nix (https://nixos.org/download) | ||
# It requires: | ||
# - Eask CLI (https://emacs-eask.github.io/) | ||
# - Nix (https://nixos.org/download) | ||
# - Enabling Nix 'nix-command' and 'flakes' experimental features (https://nixos.org/manual/nix/stable/command-ref/conf-file#conf-experimental-features) | ||
|
||
init_dir="/tmp/.emacs.d_jtsx_tests" | ||
emacs_versions=("emacs-29-1" "emacs-29-2" "emacs-snapshot") | ||
|
||
# Ensure that Emacs init dir is empty | ||
rm -rf $init_dir | ||
|
||
# Run tests on each Emacs versions | ||
for version in ${emacs_versions[@]}; do | ||
emacs_nix="nix run --accept-flake-config github:purcell/nix-emacs-ci#$version --" | ||
printf "RUN PACKAGE-LINT ON '%s'.\n" $version | ||
if ! $emacs_nix --batch \ | ||
--eval "(progn \ | ||
(require 'package) \ | ||
(push '(\"melpa\" . \"https://melpa.org/packages/\") package-archives) \ | ||
(package-initialize) \ | ||
(unless package-archive-contents \ | ||
(package-refresh-contents)) \ | ||
(unless (package-installed-p 'package-lint) \ | ||
(package-install 'package-lint)))" \ | ||
--eval "(require 'package-lint)" \ | ||
-f package-lint-batch-and-exit ../jtsx.el; then | ||
printf "PACKAGE LINT FAILURE ON '%s'.\n" $version | ||
printf "###### RUN TESTS ON '%s'. ######\n" $version | ||
emacs_nix="github:purcell/nix-emacs-ci#$version" | ||
if ! nix shell $emacs_nix nixpkgs#eask --command make -C ../ ci; then | ||
printf "###### TESTS FAILURE ON '%s'. ######\n" $version | ||
exit | ||
fi | ||
printf "RUN TESTS ON '%s'.\n" $version | ||
if ! $emacs_nix --init-directory=$init_dir --batch -l ert -l ../jtsx.el -l jtsx-tests.el \ | ||
--eval "(jtsx-install-treesit-language 'javascript)" \ | ||
--eval "(jtsx-install-treesit-language 'tsx)" \ | ||
--eval "(jtsx-install-treesit-language 'typescript)" \ | ||
-f ert-run-tests-batch-and-exit; then | ||
printf "TESTS FAILURE ON '%s'.\n" $version | ||
exit | ||
fi | ||
done | ||
|
||
echo "TESTS SUCCESS!" | ||
echo "###### TESTS SUCCESS! ######" |