Skip to content

Commit

Permalink
[fu] compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
pkryger committed Nov 13, 2024
1 parent 87cd599 commit f35e9bf
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 43 deletions.
53 changes: 16 additions & 37 deletions .ci/compilation.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
#!/usr/bin/env bash

set -x
set -e

EMACS_DIR="$(cd "${GITHUB_WORKSPACE:-~}"/"${1:-.emacs.d}"; pwd -P)"
EMACS_DIR="$(cd "${GITHUB_WORKSPACE:-${HOME}}/${1:-.emacs.d}" && pwd -P)"
EMACS=${EMACS:=emacs}

exit_code=0
Expand All @@ -16,42 +16,20 @@ cleanup () {

trap cleanup ERR INT TERM

# Byte compile all `.el` files in modules and themes.
# extensions are skipped because this is not Exordium code.
# themes are compiled separately because CI core dumps when compiled together with modules
# Byte compile init.el and all *.el files in modules and themes directories.
# Directory extensions is skipped because this is not Exordium code. Split
# them into smaller chunks, because Emacs on GitHub worker tends to core dump
# when there's too much to compile in one go.
for pattern in "init.el" "modules/*.el" ; do
echo "===Byte compiling ${pattern}==="

${EMACS} -Q --batch \
--eval '
(progn
(setq debug-on-error t
eval-expression-print-length 100
edebug-print-length 500
user-emacs-directory "'"${EMACS_DIR}"'/"
exordium-spell-check nil
tree-sitter-langs--testing t) ; tree-sitter-langs is for pre Emacs-29
(load-file "'"${EMACS_DIR}"'/init.el")
(setq exordium--require-package-archives package-archives)
(message "===Byte compilation start===")
(batch-byte-compile))' \
"${EMACS_DIR}"/init.el

${EMACS} -Q --batch \
--eval '
(progn
(setq debug-on-error t
eval-expression-print-length 100
edebug-print-length 500
user-emacs-directory "'"${EMACS_DIR}"'/"
exordium-spell-check nil
tree-sitter-langs--testing t) ; tree-sitter-langs is for pre Emacs-29
(load-file "'"${EMACS_DIR}"'/init.el")
(setq exordium--require-package-archives package-archives)
(message "===Byte compilation start===")
(batch-byte-compile))' \
"${EMACS_DIR}"/modules/*.el
# Use find to find file names such that globs are expanded while prevent
# splitting paths on spaces
mapfile -t files <<< \
"$(find "${EMACS_DIR}" -path "${EMACS_DIR}/${pattern}")"
${EMACS} -Q --batch \
--eval '
${EMACS} -Q --batch \
--eval '
(progn
(setq debug-on-error t
eval-expression-print-length 100
Expand All @@ -63,6 +41,7 @@ ${EMACS} -Q --batch \
(setq exordium--require-package-archives package-archives)
(message "===Byte compilation start===")
(batch-byte-compile))' \
"${EMACS_DIR}"/themes/*.el
"${files[@]}"
done
cleanup
4 changes: 2 additions & 2 deletions .ci/first-start.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
#!/usr/bin/env bash

set -x
set -e

EMACS_DIR="$(cd "${GITHUB_WORKSPACE:-~}"/"${1:-.emacs.d}"; pwd -P)"
EMACS_DIR="$(cd "${GITHUB_WORKSPACE:-${HOME}}/${1:-.emacs.d}" && pwd -P)"
EMACS=${EMACS:=emacs}

# Redefine ask-user-about-lock as the melpa seems to stumble on it
Expand Down
4 changes: 2 additions & 2 deletions .ci/unit-test-cl.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
#!/usr/bin/env bash

set -x
set -e
EMACS_DIR="$(cd "${GITHUB_WORKSPACE:-~}"/"${1:-.emacs.d}"; pwd -P)"
EMACS_DIR="$(cd "${GITHUB_WORKSPACE:-${HOME}}/${1:-.emacs.d}" && pwd -P)"
EMACS=${EMACS:=emacs}

${EMACS} -Q --batch \
Expand Down
4 changes: 2 additions & 2 deletions .ci/unit-tests.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
#!/usr/bin/env bash

set -x
set -e

EMACS_DIR="$(cd "${GITHUB_WORKSPACE:-~}"/"${1:-.emacs.d}"; pwd -P)"
EMACS_DIR="$(cd "${GITHUB_WORKSPACE:-${HOME}}/${1:-.emacs.d}" && pwd -P)"
EMACS=${EMACS:=emacs}

# Run all tests form *.t.el
Expand Down

0 comments on commit f35e9bf

Please sign in to comment.