emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master edcdb4c2ecd: Add tree-sitter tests to emba


From: Michael Albinus
Subject: master edcdb4c2ecd: Add tree-sitter tests to emba
Date: Mon, 29 May 2023 11:27:01 -0400 (EDT)

branch: master
commit edcdb4c2ecd16e9838f2359ea4f1c66030ffadaf
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Add tree-sitter tests to emba
    
    * admin/notes/emba: Add docker image emacs-tree-sitter.  Improve
    docker call.
    
    * test/infra/Dockerfile.emba (emacs-tree-sitter): New image.
    
    * test/infra/gitlab-ci.yml (.tree-sitter-template): New template.
    (build-image-tree-sitter, test-tree-sitter): New jobs.
---
 admin/notes/emba           |  7 +++---
 test/infra/Dockerfile.emba | 56 ++++++++++++++++++++++++++++++++++++++++++++++
 test/infra/gitlab-ci.yml   | 35 +++++++++++++++++++++++++++++
 3 files changed, 95 insertions(+), 3 deletions(-)

diff --git a/admin/notes/emba b/admin/notes/emba
index c88b422a4fa..1f87a99ddc0 100644
--- a/admin/notes/emba
+++ b/admin/notes/emba
@@ -97,15 +97,16 @@ recent Emacs branch, and apply the command
 This creates the Debian-based image emacs-inotify, based on the
 instructions in the file Dockerfile.emba.  This image is good for the
 majority of tests.  However, there are also other image build
-instructions like emacs-filenotify-gio, emacs-eglot, emacs-gnustep and
-emacs-native-comp-speed{0,1,2}.  Use the appropriate one.
+instructions like emacs-filenotify-gio, emacs-eglot,
+emacs-tree-sitter, emacs-gnustep and emacs-native-comp-speed{0,1,2}.
+Use the appropriate one.
 
 The image contains a directory "/checkout", which is a copy of your
 local Emacs git repository.  Emacs has been built in this directory
 via "make bootstrap".  In order to use the image, start a container
 like
 
-  docker run --interactive --env EMACS_EMBA_CI=1 --name emacs-inotify \
+  docker run --interactive --tty --env EMACS_EMBA_CI=1 --name emacs-inotify \
     emacs-inotify /bin/sh -i
 
 In this container, change the current directory to "/checkout".  Now
diff --git a/test/infra/Dockerfile.emba b/test/infra/Dockerfile.emba
index 689573236da..5141c8919b1 100644
--- a/test/infra/Dockerfile.emba
+++ b/test/infra/Dockerfile.emba
@@ -83,6 +83,62 @@ RUN ./autogen.sh autoconf
 RUN ./configure
 RUN make bootstrap
 
+# Debian bullseye doesn't provide proper packages.  So we use Debian
+# sid for this.
+FROM debian:sid as emacs-tree-sitter
+
+# This corresponds to emacs-base.
+RUN apt-get update && \
+    apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 \
+      libc-dev gcc g++ make autoconf automake libncurses-dev gnutls-dev \
+      libdbus-1-dev libacl1-dev acl git texinfo gdb \
+    && rm -rf /var/lib/apt/lists/*
+
+# Install tree-sitter library.
+RUN apt-get update && \
+    apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 \
+      libtree-sitter0 libtree-sitter-dev \
+    && rm -rf /var/lib/apt/lists/*
+
+COPY . /checkout
+WORKDIR /checkout
+RUN ./autogen.sh autoconf
+RUN ./configure --with-tree-sitter
+RUN make bootstrap
+
+# Install language grammars.
+RUN mkdir /usr/local/lib/tree-sitter
+RUN git config --global http.sslverify "false"
+# See https://github.com/emacs-tree-sitter/tree-sitter-langs/tree/master/repos
+RUN src/emacs -Q --batch \
+    --eval '(setq \
+      treesit-extra-load-path (list "/usr/local/lib/tree-sitter") \
+      treesit-language-source-alist \
+      (quote ((bash "https://github.com/tree-sitter/tree-sitter-bash";) \
+      (c "https://github.com/tree-sitter/tree-sitter-c";) \
+      (cmake "https://github.com/uyha/tree-sitter-cmake";) \
+      (cpp "https://github.com/tree-sitter/tree-sitter-cpp";) \
+      (css "https://github.com/tree-sitter/tree-sitter-css";) \
+      (elisp "https://github.com/Wilfred/tree-sitter-elisp";) \
+      (elixir "https://github.com/elixir-lang/tree-sitter-elixir";) \
+      (java "https://github.com/tree-sitter/tree-sitter-java";) \
+      (go "https://github.com/tree-sitter/tree-sitter-go";) \
+      (gomod "https://github.com/camdencheek/tree-sitter-go-mod";) \
+      (heex "https://github.com/phoenixframework/tree-sitter-heex";) \
+      (html "https://github.com/tree-sitter/tree-sitter-html";) \
+      (javascript "https://github.com/tree-sitter/tree-sitter-javascript"; 
"master" "src") \
+      (json "https://github.com/tree-sitter/tree-sitter-json";) \
+      (make "https://github.com/alemuller/tree-sitter-make";) \
+      (markdown "https://github.com/ikatyang/tree-sitter-markdown";) \
+      (python "https://github.com/tree-sitter/tree-sitter-python";) \
+      (ruby "https://github.com/tree-sitter/tree-sitter-ruby";) \
+      (toml "https://github.com/tree-sitter/tree-sitter-toml";) \
+      (tsx "https://github.com/tree-sitter/tree-sitter-typescript"; "master" 
"tsx/src") \
+      (typescript "https://github.com/tree-sitter/tree-sitter-typescript"; 
"master" "typescript/src") \
+      (yaml "https://github.com/ikatyang/tree-sitter-yaml";))))' \
+    --eval '(dolist (lang (mapcar (quote car) treesit-language-source-alist)) \
+      (treesit-install-language-grammar lang "/usr/local/lib/tree-sitter"))'
+
 FROM emacs-base as emacs-gnustep
 
 RUN apt-get update && \
diff --git a/test/infra/gitlab-ci.yml b/test/infra/gitlab-ci.yml
index d1fef0187d4..aabb50f6aaa 100644
--- a/test/infra/gitlab-ci.yml
+++ b/test/infra/gitlab-ci.yml
@@ -176,6 +176,16 @@ default:
         - test/infra/*
         - test/lisp/progmodes/eglot-tests.el
 
+.tree-sitter-template:
+  rules:
+    - if: '$CI_PIPELINE_SOURCE == "web"'
+    - if: '$CI_PIPELINE_SOURCE == "schedule"'
+      changes:
+        - "**.in"
+        - lisp/progmodes/*-ts-mode.el
+        - test/infra/*
+        - test/lisp/progmodes/*-ts-mode-tests.el
+
 .native-comp-template:
   rules:
     - if: '$CI_PIPELINE_SOURCE == "web"'
@@ -256,6 +266,31 @@ test-eglot:
     # This is needed in order to get a JUnit test report.
     make_params: '-k -C test check-expensive 
LOGFILES="lisp/progmodes/eglot-tests.log"'
 
+build-image-tree-sitter:
+  stage: platform-images
+  extends: [.job-template, .build-template, .tree-sitter-template]
+  variables:
+    target: emacs-tree-sitter
+
+test-tree-sitter:
+  stage: platforms
+  extends: [.job-template, .test-template, .tree-sitter-template]
+  needs:
+    - job: build-image-tree-sitter
+      optional: true
+  variables:
+    target: emacs-tree-sitter
+    # This is needed in order to get a JUnit test report.
+    files: >-
+      lisp/progmodes/c-ts-mode-tests.log
+      lisp/progmodes/elixir-ts-mode-tests.el
+      lisp/progmodes/go-ts-mode-tests.log
+      lisp/progmodes/heex-ts-mode-tests.log
+      lisp/progmodes/java-ts-mode-tests.log
+      lisp/progmodes/ruby-ts-mode-tests.log
+      lisp/progmodes/typescript-ts-mode-tests.log
+    make_params: '-k -C test check-expensive 
LD_LIBRARY_PATH=/usr/local/lib/tree-sitter LOGFILES="$files"'
+
 build-image-gnustep:
   stage: platform-images
   extends: [.job-template, .build-template, .gnustep-template]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]