chore(ci): use an independent initialization script for CI #7
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
name: CI | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
# Run weekly | |
schedule: | |
- cron: "0 0 * * 0" | |
jobs: | |
ci-linux: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
emacs_version: | |
- 28.2 | |
- 29.1 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: purcell/setup-emacs@master | |
with: | |
version: ${{ matrix.emacs_version }} | |
# Install dependencies for vterm... | |
- name: Install dependency needed for some Emacs packages (Ubuntu) | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libtool-bin cmake tree | |
- name: Show Emacs version | |
run: | | |
EMACS_VERSION=$(emacs --version) | |
echo $EMACS_VERSION | |
echo "EMACS_VERSION=$(echo $EMACS_VERSION | head -n1 | sed -E 's/GNU Emacs ([^ ]*).*/\1/')" >> "$GITHUB_ENV" | |
- name: Running Emacs | |
run: | | |
ln -s "$(pwd)" "../.emacs.d" | |
echo "Enabling all MinEmacs modules" | |
echo "Running Emacs with MinEmacs configuration" | |
MINEMACSDIR=.github/workflows/scripts/minemacs-all.d/ | |
if make ci | tee /tmp/minemacs-output; then | |
echo "Emacs exited successfully" | |
else | |
echo "Emacs exited with non-zero code $?" | |
fi | |
WARNINGS=$(cat /tmp/minemacs-output | grep Warning | sed -E 's/^(.*\.el): Warning/- \*\*\1\*\*/' | sed -E 's/^Warning ([^:]*)/- \*\*\1\*\*/') | |
LOAD_ERRORS=$(cat /tmp/minemacs-output | grep -E "(Cannot load)|(Not found)" | sed 's/^/- /') | |
ELISP_ERRORS=$(cat /tmp/minemacs-output | awk -F': ' '/^Debugger entered--Lisp error: / { print "- **" $1 "**: `" $2 "`"; print "```elisp"; while (getline && match($0, "^[[:space:]]{2}")) print $0; print "```"}' ) | |
echo -e "# MinEmacs report ($EMACS_VERSION)\n" >> $GITHUB_STEP_SUMMARY | |
if [[ ! -z "$LOAD_ERRORS" ]]; then | |
echo -e "## Loading errors\n$LOAD_ERRORS\n" >> $GITHUB_STEP_SUMMARY | |
fi | |
if [[ ! -z "$ELISP_ERRORS" ]]; then | |
echo -e "## Emacs Lisp errors\n$ELISP_ERRORS\n" >> $GITHUB_STEP_SUMMARY | |
fi | |
if [[ ! -z "$WARNINGS" ]]; then | |
echo -e "## Warnings\n$WARNINGS" >> $GITHUB_STEP_SUMMARY | |
fi | |
if [[ ! -z "$LOAD_ERRORS" ]] || [[ ! -z "$ELISP_ERRORS" ]]; then exit 1; fi | |
ci-macos: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Emacs (MacOS) | |
run: | | |
brew install emacs | |
- name: Show Emacs version | |
run: | | |
EMACS_VERSION=$(emacs --version) | |
echo $EMACS_VERSION | |
echo "EMACS_VERSION=$(echo $EMACS_VERSION | head -n1 | sed -E 's/GNU Emacs ([^ ]*).*/\1/')" >> "$GITHUB_ENV" | |
- name: Running Emacs | |
run: | | |
ln -s "$(pwd)" "../.emacs.d" | |
echo "Enabling all MinEmacs modules" | |
echo "Running Emacs with MinEmacs configuration" | |
MINEMACSDIR=.github/workflows/scripts/minemacs-all.d/ | |
if make ci | tee /tmp/minemacs-output; then | |
echo "Emacs exited successfully" | |
else | |
echo "Emacs exited with non-zero code $?" | |
fi | |
WARNINGS=$(cat /tmp/minemacs-output | grep Warning | sed -E 's/^(.*\.el): Warning/- \*\*\1\*\*/' | sed -E 's/^Warning ([^:]*)/- \*\*\1\*\*/') | |
LOAD_ERRORS=$(cat /tmp/minemacs-output | grep -E "(Cannot load)|(Not found)" | sed 's/^/- /') | |
ELISP_ERRORS=$(cat /tmp/minemacs-output | awk -F': ' '/^Debugger entered--Lisp error: / { print "- **" $1 "**: `" $2 "`"; print "```elisp"; while (getline && match($0, "^[[:space:]]{2}")) print $0; print "```"}' ) | |
echo -e "# MinEmacs report ($EMACS_VERSION)\n" >> $GITHUB_STEP_SUMMARY | |
if [[ ! -z "$LOAD_ERRORS" ]]; then | |
echo -e "## Loading errors\n$LOAD_ERRORS\n" >> $GITHUB_STEP_SUMMARY | |
fi | |
if [[ ! -z "$ELISP_ERRORS" ]]; then | |
echo -e "## Emacs Lisp errors\n$ELISP_ERRORS\n" >> $GITHUB_STEP_SUMMARY | |
fi | |
if [[ ! -z "$WARNINGS" ]]; then | |
echo -e "## Warnings\n$WARNINGS" >> $GITHUB_STEP_SUMMARY | |
fi | |
if [[ ! -z "$LOAD_ERRORS" ]] || [[ ! -z "$ELISP_ERRORS" ]]; then exit 1; fi | |
ci-windows: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Emacs (Windows) | |
run: | | |
choco install emacs | |
- name: Show Emacs version | |
run: | | |
emacs --version | |
- name: Running Emacs | |
run: | | |
$env:HOME = "D:\a\minemacs\" | |
$env:MINEMACSDIR = "D:\a\minemacs\.github\workflows\scripts\minemacs-all.d\" | |
emacs --no-window-system --batch --script .github\workflows\scripts\ci-init.el |