From 596ea5bd40bc745db45a03b4baa20ea11a1924a9 Mon Sep 17 00:00:00 2001 From: Gabriele Bozzola Date: Sat, 25 Jul 2020 09:38:03 -0700 Subject: [PATCH] Add GitHub Action --- .github/workflows/test.yml | 97 ++++++++++++++++++++++++++++++++++++++ makem-pre-test-conf.el | 24 ++++++++++ vterm.el | 49 ++++++++++--------- 3 files changed, 147 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/test.yml create mode 100644 makem-pre-test-conf.el diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..2a49ad72 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,97 @@ +# * test.yml --- Test libvterm using makem.sh on GitHub Actions + +# Based on Alphapapa's makem.sh +# https://github.com/alphapapa/makem.sh + +# Based on Steve Purcell's examples at +# , +# . + +# * License: + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# * Code: + +name: "CI" +on: + pull_request: + push: + # Comment out this section to enable testing of all branches. + # branches: + # - master + +jobs: + build: + runs-on: ubuntu-20.04 + strategy: + fail-fast: true + matrix: + emacs_version: + - snapshot + use_system_libvterm: + - no + - yes + steps: + - uses: purcell/setup-emacs@master + with: + version: ${{ matrix.emacs_version }} + + - uses: actions/checkout@v2 + + - name: Grab makem.sh + uses: wei/wget@v1 + with: + args: https://raw.githubusercontent.com/alphapapa/makem.sh/master/makem.sh + + - name: Initialize sandbox + run: | + SANDBOX_DIR=$(mktemp -d) || exit 1 + echo "{SANDBOX_DIR}={$SANDBOX_DIR}" >> $GITHUB_ENV + bash makem.sh -vv --sandbox=$SANDBOX_DIR --install-deps --install-linters + + - name: Install CMake + run: nix-env -f "" -iA cmake + + - name: Install other dependencies + run: nix-env -f "" -iA libtool + + - name: Install spell-checker + run: | + nix-env -f "" -iA hunspell + nix-env -f "" -iA hunspellDicts.en_US + + - name: Compile vterm + if: ${{matrix.use_system_libvterm == 'yes'}} + run: nix-shell -p libvterm-neovim --run "mkdir build && cd build && cmake .. && make" + + - name: Require vterm + if: ${{matrix.use_system_libvterm == 'no'}} + run: bash makem.sh -vv --sandbox=$SANDBOX batch -- --eval "(require 'vterm)" + + - name: Require vterm + run: bash makem.sh -vv --sandbox=$SANDBOX batch -- --eval "(require 'vterm)" + + - name: Lint + # We only need to lint once + continue-on-error: true + run: bash makem.sh -vv --sandbox=$SANDBOX_DIR --exclude makem-pre-test-conf.el lint + + # - name: Test + # if: always() # Run test even if linting fails. + # run: bash makem.sh -vv --sandbox=$SANDBOX_DIR test + +# Local Variables: +# eval: (outline-minor-mode) +# End: diff --git a/makem-pre-test-conf.el b/makem-pre-test-conf.el new file mode 100644 index 00000000..b1a5367e --- /dev/null +++ b/makem-pre-test-conf.el @@ -0,0 +1,24 @@ +;;; makem-pre-test-conf.el --- Configuration for tests -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2020 Gabriele Bozzola +;; +;; Author: Gabriele Bozzola +;; Maintainer: Gabriele Bozzola +;; Created: July 25, 2020 +;; Modified: July 25, 2020 +;; Version: 0.0.1 +;; Keywords: +;; Package-Requires: ((emacs 25.1)) +;; +;; This file is not part of GNU Emacs. +;; +;;; Commentary: +;; +;; https://github.com/alphapapa/makem.sh/issues/24 +;; +;;; Code: + +(setq vterm-always-compile-module t) + +(provide 'a-makem-pre-test-conf) +;;; makem-pre-test-conf.el ends here diff --git a/vterm.el b/vterm.el index c21cbe7b..f4673680 100644 --- a/vterm.el +++ b/vterm.el @@ -89,7 +89,7 @@ confirmation before compiling." "Name of the buffer used for compiling vterm-module.") (defun vterm-module--cmake-is-available () - "Return t if cmake is available. + "Return t if CMake is available. CMake is needed to build vterm, here we check that we can find the executable." @@ -129,7 +129,7 @@ the executable." ;; If the vterm-module is not compiled yet, compile it (unless (require 'vterm-module nil t) (if (or vterm-always-compile-module - (y-or-n-p "Vterm needs `vterm-module' to work. Compile it now? ")) + (y-or-n-p "Vterm needs `vterm-module' to work. Compile it now? ")) (progn (vterm-module-compile) (require 'vterm-module)) @@ -141,16 +141,16 @@ the executable." (declare-function display-line-numbers-update-width "display-line-numbers") ;; Generate this list with: -;; awk -F\" '/bind_function*/ {print "(declare-function", $2, "\"vterm-module\")"}' vterm-module.c -(declare-function vterm--new "vterm-module") -(declare-function vterm--update "vterm-module") -(declare-function vterm--redraw "vterm-module") -(declare-function vterm--write-input "vterm-module") -(declare-function vterm--set-size "vterm-module") -(declare-function vterm--set-pty-name "vterm-module") -(declare-function vterm--get-pwd-raw "vterm-module") -(declare-function vterm--reset-point "vterm-module") -(declare-function vterm--get-icrnl "vterm-module") +;; awk -F\" '/bind_function*/ {print "(declare-function", $2, "\"ext:vterm-module\" t t)"}' vterm-module.c +(declare-function vterm--new "ext:vterm-module" t t) +(declare-function vterm--update "ext:vterm-module" t t) +(declare-function vterm--redraw "ext:vterm-module" t t) +(declare-function vterm--write-input "ext:vterm-module" t t) +(declare-function vterm--set-size "ext:vterm-module" t t) +(declare-function vterm--set-pty-name "ext:vterm-module" t t) +(declare-function vterm--get-pwd-raw "ext:vterm-module" t t) +(declare-function vterm--reset-point "ext:vterm-module" t t) +(declare-function vterm--get-icrnl "ext:vterm-module" t t) (require 'subr-x) (require 'cl-lib) @@ -233,8 +233,8 @@ Each function is called with two arguments: the vterm buffer of the process if any, and a string describing the event passed from the sentinel. -This hook applies only to new vterms, created after setting this -value with `add-hook'. +This hook applies only to new vterm buffers, created after +setting this value with `add-hook'. Note that this hook will not work if another package like `shell-pop' sets its own sentinel to the `vterm' process." @@ -324,8 +324,8 @@ used to set the current directory and prompt location. This detection method is the most-reliable. To use it, you have to change your shell prompt to print 51;A. -The second method is using a regular expression. This method does -not require any shell-side configuration. See +The second method is using a regular expression. This method does +not require any shell-side configuration. See `term-prompt-regexp', for more information." :type 'boolean :group 'vterm) @@ -434,7 +434,7 @@ Only background is used." (defvar vterm-timer-delay 0.1 "Delay for refreshing the buffer after receiving updates from libvterm. -A larger delary improves performance when receiving large bursts +A larger delay improves performance when receiving large bursts of data. If nil, never delay. The units are seconds.") ;;; Keybindings @@ -463,7 +463,7 @@ of data. If nil, never delay. The units are seconds.") ;; Function keys and most of C- and M- bindings (defun vterm--exclude-keys (map exceptions) - "Remove EXCEPTIONS from the keys bound by `vterm-define-keys'. + "Remove EXCEPTIONS from MAP the keys bound by `vterm-define-keys'. Exceptions are defined by `vterm-keymap-exceptions'." (mapc (lambda (key) @@ -598,7 +598,7 @@ Exceptions are defined by `vterm-keymap-exceptions'." ;; mode can break this, leading to segmentation faults. (add-hook 'change-major-mode-hook (lambda () (interactive) - (user-error "You cannot change major mode in vterm buffers")) nil t) + (user-error "You cannot change major mode in vterm buffers")) nil t) (vterm--set-pty-name vterm--term (process-tty-name vterm--process)) (process-put vterm--process 'adjust-window-size-function @@ -1016,13 +1016,13 @@ Argument EVENT process event." (setq width (+ width (or display-line-numbers-width 0) 4))) width)) -(defun vterm--delete-lines (line-num count &optional delete-whole-line) - "Delete COUNT lines from LINE-NUM. -If LINE-NUM is negative backward-line from end of buffer. +(defun vterm--delete-lines (line-number count &optional delete-whole-line) + "Delete COUNT lines from LINE-NUMBER. +If LINE-NUMBER is negative backward-line from end of buffer. If option DELETE-WHOLE-LINE is non-nil, then this command kills the whole line including its terminating newline" (save-excursion - (when (vterm--goto-line line-num) + (when (vterm--goto-line line-number) (delete-region (point) (point-at-eol count)) (when (and delete-whole-line (looking-at "\n")) @@ -1261,3 +1261,6 @@ can find them and remove them." (provide 'vterm) ;;; vterm.el ends here + +;;; LocalWords: vterm libvterm CMake scrollback arg +;;; LocalWords: zsh html tldp http whitelisted