Meta: Update makem.sh, etc.
This commit is contained in:
parent
048de35b07
commit
be696ff075
3 changed files with 35 additions and 49 deletions
14
.github/workflows/test.yml
vendored
14
.github/workflows/test.yml
vendored
|
|
@ -28,8 +28,8 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
push:
|
push:
|
||||||
# Comment out this section to enable testing of all branches.
|
# Comment out this section to enable testing of all branches.
|
||||||
# branches:
|
branches:
|
||||||
# - master
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
@ -51,18 +51,20 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
SANDBOX_DIR=$(mktemp -d) || exit 1
|
SANDBOX_DIR=$(mktemp -d) || exit 1
|
||||||
echo ::set-env name=SANDBOX_DIR::$SANDBOX_DIR
|
echo ::set-env name=SANDBOX_DIR::$SANDBOX_DIR
|
||||||
./makem.sh -vv --sandbox-dir=$SANDBOX_DIR --install-deps --install-linters
|
./makem.sh -vv --sandbox=$SANDBOX_DIR --install-deps --install-linters
|
||||||
|
|
||||||
# The "all" rule is not used, because it treats compilation warnings
|
# The "all" rule is not used, because it treats compilation warnings
|
||||||
# as failures, so linting and testing are run as separate steps.
|
# as failures, so linting and testing are run as separate steps.
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
continue-on-error: true
|
# NOTE: Uncomment this line to treat lint failures as passing
|
||||||
run: ./makem.sh -vv --sandbox-dir=$SANDBOX_DIR lint
|
# so the job doesn't show failure.
|
||||||
|
# continue-on-error: true
|
||||||
|
run: ./makem.sh -vv --sandbox=$SANDBOX_DIR lint
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
if: always() # Run test even if linting fails.
|
if: always() # Run test even if linting fails.
|
||||||
run: ./makem.sh -vv --sandbox-dir=$SANDBOX_DIR test
|
run: ./makem.sh -vv --sandbox=$SANDBOX_DIR test
|
||||||
|
|
||||||
# Local Variables:
|
# Local Variables:
|
||||||
# eval: (outline-minor-mode)
|
# eval: (outline-minor-mode)
|
||||||
|
|
|
||||||
2
Makefile
2
Makefile
|
|
@ -22,7 +22,7 @@ ifdef sandbox
|
||||||
ifeq ($(sandbox), t)
|
ifeq ($(sandbox), t)
|
||||||
SANDBOX = --sandbox
|
SANDBOX = --sandbox
|
||||||
else
|
else
|
||||||
SANDBOX = --sandbox $(sandbox)
|
SANDBOX = --sandbox=$(sandbox)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
||||||
68
makem.sh
68
makem.sh
|
|
@ -90,14 +90,14 @@ Options:
|
||||||
-C, --no-compile Don't compile files automatically.
|
-C, --no-compile Don't compile files automatically.
|
||||||
|
|
||||||
Sandbox options:
|
Sandbox options:
|
||||||
-s, --sandbox [DIR] Run Emacs with an empty config in a sandbox DIR.
|
-s[DIR], --sandbox[=DIR] Run Emacs with an empty config in a sandbox DIR.
|
||||||
If DIR does not exist, make it. If DIR is not
|
If DIR does not exist, make it. If DIR is not
|
||||||
specified, use a temporary sandbox directory and
|
specified, use a temporary sandbox directory and
|
||||||
delete it afterward, implying --install-deps and
|
delete it afterward, implying --install-deps and
|
||||||
--install-linters.
|
--install-linters.
|
||||||
--install-deps Automatically install package dependencies.
|
--install-deps Automatically install package dependencies.
|
||||||
--install-linters Automatically install linters.
|
--install-linters Automatically install linters.
|
||||||
-i, --install PACKAGE Install PACKAGE before running rules.
|
-i, --install PACKAGE Install PACKAGE before running rules.
|
||||||
|
|
||||||
An Emacs version-specific subdirectory is automatically made inside
|
An Emacs version-specific subdirectory is automatically made inside
|
||||||
the sandbox, allowing testing with multiple Emacs versions. When
|
the sandbox, allowing testing with multiple Emacs versions. When
|
||||||
|
|
@ -400,7 +400,7 @@ function dependencies {
|
||||||
# Echo list of package dependencies.
|
# Echo list of package dependencies.
|
||||||
|
|
||||||
# Search package headers.
|
# Search package headers.
|
||||||
egrep '^;; Package-Requires: ' $(files-project-feature) $(files-project-test) \
|
egrep -i '^;; Package-Requires: ' $(files-project-feature) $(files-project-test) \
|
||||||
| egrep -o '\([^([:space:]][^)]*\)' \
|
| egrep -o '\([^([:space:]][^)]*\)' \
|
||||||
| egrep -o '^[^[:space:])]+' \
|
| egrep -o '^[^[:space:])]+' \
|
||||||
| sed -r 's/\(//g' \
|
| sed -r 's/\(//g' \
|
||||||
|
|
@ -423,10 +423,12 @@ function dependencies {
|
||||||
# ** Sandbox
|
# ** Sandbox
|
||||||
|
|
||||||
function sandbox {
|
function sandbox {
|
||||||
# Initialize sandbox.
|
verbose 2 "Initializing sandbox..."
|
||||||
|
|
||||||
# *** Sandbox arguments
|
# *** Sandbox arguments
|
||||||
|
|
||||||
|
# MAYBE: Optionally use branch-specific sandbox?
|
||||||
|
|
||||||
# Check or make user-emacs-directory.
|
# Check or make user-emacs-directory.
|
||||||
if [[ $sandbox_dir ]]
|
if [[ $sandbox_dir ]]
|
||||||
then
|
then
|
||||||
|
|
@ -451,15 +453,12 @@ function sandbox {
|
||||||
|
|
||||||
# Make argument to load init file if it exists.
|
# Make argument to load init file if it exists.
|
||||||
init_file="$sandbox_dir/init.el"
|
init_file="$sandbox_dir/init.el"
|
||||||
[[ -r $init_file ]] \
|
|
||||||
&& local args_load_init_file=(--load "$init_file")
|
|
||||||
|
|
||||||
# Set sandbox args. This is a global variable used by the run_emacs function.
|
# Set sandbox args. This is a global variable used by the run_emacs function.
|
||||||
args_sandbox=(
|
args_sandbox=(
|
||||||
--title "makem.sh: $(basename $(pwd)) (sandbox: $sandbox_dir)"
|
--title "makem.sh: $(basename $(pwd)) (sandbox: $sandbox_dir)"
|
||||||
--eval "(setq user-emacs-directory (file-truename \"$sandbox_dir\"))"
|
--eval "(setq user-emacs-directory (file-truename \"$sandbox_dir\"))"
|
||||||
--eval "(setq user-init-file (file-truename \"$init_file\"))"
|
--eval "(setq user-init-file (file-truename \"$init_file\"))"
|
||||||
"${args_load_init_file[@]}"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add package-install arguments for dependencies.
|
# Add package-install arguments for dependencies.
|
||||||
|
|
@ -488,15 +487,16 @@ function sandbox {
|
||||||
if [[ ${args_sandbox_package_install[@]} ]]
|
if [[ ${args_sandbox_package_install[@]} ]]
|
||||||
then
|
then
|
||||||
# Initialize the sandbox (installs packages once rather than for every rule).
|
# Initialize the sandbox (installs packages once rather than for every rule).
|
||||||
debug "Initializing sandbox..."
|
verbose 1 "Installing packages into sandbox..."
|
||||||
|
|
||||||
run_emacs \
|
run_emacs \
|
||||||
--eval "(package-refresh-contents)" \
|
--eval "(package-refresh-contents)" \
|
||||||
"${args_sandbox_package_install[@]}" \
|
"${args_sandbox_package_install[@]}" \
|
||||||
|| die "Unable to initialize sandbox."
|
&& success "Packages installed." \
|
||||||
|
|| die "Unable to initialize sandbox."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
debug "Sandbox initialized."
|
verbose 2 "Sandbox initialized."
|
||||||
}
|
}
|
||||||
|
|
||||||
# ** Utility
|
# ** Utility
|
||||||
|
|
@ -684,6 +684,7 @@ function interactive {
|
||||||
unset arg_batch
|
unset arg_batch
|
||||||
run_emacs \
|
run_emacs \
|
||||||
$(args-load-files "${files_project_feature[@]}" "${files_project_test[@]}") \
|
$(args-load-files "${files_project_feature[@]}" "${files_project_test[@]}") \
|
||||||
|
--eval "(load user-init-file)" \
|
||||||
"${args_batch_interactive[@]}"
|
"${args_batch_interactive[@]}"
|
||||||
arg_batch="--batch"
|
arg_batch="--batch"
|
||||||
}
|
}
|
||||||
|
|
@ -827,7 +828,7 @@ function test-ert {
|
||||||
|
|
||||||
# * Defaults
|
# * Defaults
|
||||||
|
|
||||||
test_files_regexp='^((tests?|t)/)|-test.el$|^test-'
|
test_files_regexp='^((tests?|t)/)|-tests?.el$|^test-'
|
||||||
|
|
||||||
emacs_command=("emacs")
|
emacs_command=("emacs")
|
||||||
errors=0
|
errors=0
|
||||||
|
|
@ -892,8 +893,8 @@ elisp_org_package_archive="(add-to-list 'package-archives '(\"org\" . \"https://
|
||||||
# * Args
|
# * Args
|
||||||
|
|
||||||
args=$(getopt -n "$0" \
|
args=$(getopt -n "$0" \
|
||||||
-o dhe:E:i:s:vf:CO \
|
-o dhe:E:i:s::vf:CO \
|
||||||
-l exclude:,emacs:,install-deps,install-linters,debug,debug-load-path,help,install:,verbose,file:,no-color,no-compile,no-org-repo,sandbox: \
|
-l exclude:,emacs:,install-deps,install-linters,debug,debug-load-path,help,install:,verbose,file:,no-color,no-compile,no-org-repo,sandbox:: \
|
||||||
-- "$@") \
|
-- "$@") \
|
||||||
|| { usage; exit 1; }
|
|| { usage; exit 1; }
|
||||||
eval set -- "$args"
|
eval set -- "$args"
|
||||||
|
|
@ -930,32 +931,15 @@ do
|
||||||
;;
|
;;
|
||||||
-s|--sandbox)
|
-s|--sandbox)
|
||||||
sandbox=true
|
sandbox=true
|
||||||
# Check whether next argument is an option, rule, or a sandbox directory.
|
shift
|
||||||
if [[ $2 ]] && ! [[ $2 =~ ^-- ]] \
|
sandbox_dir="$1"
|
||||||
&& ! rule-p "$2"
|
|
||||||
|
if ! [[ $sandbox_dir ]]
|
||||||
then
|
then
|
||||||
debug "Sandbox dir: $1"
|
|
||||||
shift
|
|
||||||
sandbox_dir="$1"
|
|
||||||
else
|
|
||||||
debug "No sandbox dir: installing dependencies."
|
debug "No sandbox dir: installing dependencies."
|
||||||
install_deps=true
|
install_deps=true
|
||||||
# HACK: Next argument is another option, so prepend blank arg to the
|
else
|
||||||
# argument list so it will be processed by next loop iteration. getopts
|
debug "Sandbox dir: $1"
|
||||||
# doesn't allow options to have optional arguments, so we do this manually.
|
|
||||||
if [[ $2 =~ ^- ]]
|
|
||||||
then
|
|
||||||
# Next argument is an option: process it next.
|
|
||||||
new_args=("" "$@")
|
|
||||||
else
|
|
||||||
# Next argument is not an option: put it on the end.
|
|
||||||
new_arg="$2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
new_args=("" "$@" "$new_arg")
|
|
||||||
fi
|
|
||||||
debug "Setting new args: ${new_args[@]}"
|
|
||||||
set -- "${new_args[@]}"
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
-v|--verbose)
|
-v|--verbose)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue