aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2023-05-29 17:26:46 +0200
committerMichael Albinus2023-05-29 17:26:46 +0200
commitedcdb4c2ecd16e9838f2359ea4f1c66030ffadaf (patch)
tree0faec460ef994131ef5f5d49610e6e5c3f6839ec
parent77087eb170f5632c58f0a00143e7289209f78989 (diff)
downloademacs-edcdb4c2ecd16e9838f2359ea4f1c66030ffadaf.tar.gz
emacs-edcdb4c2ecd16e9838f2359ea4f1c66030ffadaf.zip
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.
-rw-r--r--admin/notes/emba7
-rw-r--r--test/infra/Dockerfile.emba56
-rw-r--r--test/infra/gitlab-ci.yml35
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
97This creates the Debian-based image emacs-inotify, based on the 97This creates the Debian-based image emacs-inotify, based on the
98instructions in the file Dockerfile.emba. This image is good for the 98instructions in the file Dockerfile.emba. This image is good for the
99majority of tests. However, there are also other image build 99majority of tests. However, there are also other image build
100instructions like emacs-filenotify-gio, emacs-eglot, emacs-gnustep and 100instructions like emacs-filenotify-gio, emacs-eglot,
101emacs-native-comp-speed{0,1,2}. Use the appropriate one. 101emacs-tree-sitter, emacs-gnustep and emacs-native-comp-speed{0,1,2}.
102Use the appropriate one.
102 103
103The image contains a directory "/checkout", which is a copy of your 104The image contains a directory "/checkout", which is a copy of your
104local Emacs git repository. Emacs has been built in this directory 105local Emacs git repository. Emacs has been built in this directory
105via "make bootstrap". In order to use the image, start a container 106via "make bootstrap". In order to use the image, start a container
106like 107like
107 108
108 docker run --interactive --env EMACS_EMBA_CI=1 --name emacs-inotify \ 109 docker run --interactive --tty --env EMACS_EMBA_CI=1 --name emacs-inotify \
109 emacs-inotify /bin/sh -i 110 emacs-inotify /bin/sh -i
110 111
111In this container, change the current directory to "/checkout". Now 112In 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
83RUN ./configure 83RUN ./configure
84RUN make bootstrap 84RUN make bootstrap
85 85
86# Debian bullseye doesn't provide proper packages. So we use Debian
87# sid for this.
88FROM debian:sid as emacs-tree-sitter
89
90# This corresponds to emacs-base.
91RUN apt-get update && \
92 apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 \
93 libc-dev gcc g++ make autoconf automake libncurses-dev gnutls-dev \
94 libdbus-1-dev libacl1-dev acl git texinfo gdb \
95 && rm -rf /var/lib/apt/lists/*
96
97# Install tree-sitter library.
98RUN apt-get update && \
99 apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 \
100 libtree-sitter0 libtree-sitter-dev \
101 && rm -rf /var/lib/apt/lists/*
102
103COPY . /checkout
104WORKDIR /checkout
105RUN ./autogen.sh autoconf
106RUN ./configure --with-tree-sitter
107RUN make bootstrap
108
109# Install language grammars.
110RUN mkdir /usr/local/lib/tree-sitter
111RUN git config --global http.sslverify "false"
112# See https://github.com/emacs-tree-sitter/tree-sitter-langs/tree/master/repos
113RUN src/emacs -Q --batch \
114 --eval '(setq \
115 treesit-extra-load-path (list "/usr/local/lib/tree-sitter") \
116 treesit-language-source-alist \
117 (quote ((bash "https://github.com/tree-sitter/tree-sitter-bash") \
118 (c "https://github.com/tree-sitter/tree-sitter-c") \
119 (cmake "https://github.com/uyha/tree-sitter-cmake") \
120 (cpp "https://github.com/tree-sitter/tree-sitter-cpp") \
121 (css "https://github.com/tree-sitter/tree-sitter-css") \
122 (elisp "https://github.com/Wilfred/tree-sitter-elisp") \
123 (elixir "https://github.com/elixir-lang/tree-sitter-elixir") \
124 (java "https://github.com/tree-sitter/tree-sitter-java") \
125 (go "https://github.com/tree-sitter/tree-sitter-go") \
126 (gomod "https://github.com/camdencheek/tree-sitter-go-mod") \
127 (heex "https://github.com/phoenixframework/tree-sitter-heex") \
128 (html "https://github.com/tree-sitter/tree-sitter-html") \
129 (javascript "https://github.com/tree-sitter/tree-sitter-javascript" "master" "src") \
130 (json "https://github.com/tree-sitter/tree-sitter-json") \
131 (make "https://github.com/alemuller/tree-sitter-make") \
132 (markdown "https://github.com/ikatyang/tree-sitter-markdown") \
133 (python "https://github.com/tree-sitter/tree-sitter-python") \
134 (ruby "https://github.com/tree-sitter/tree-sitter-ruby") \
135 (toml "https://github.com/tree-sitter/tree-sitter-toml") \
136 (tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src") \
137 (typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src") \
138 (yaml "https://github.com/ikatyang/tree-sitter-yaml"))))' \
139 --eval '(dolist (lang (mapcar (quote car) treesit-language-source-alist)) \
140 (treesit-install-language-grammar lang "/usr/local/lib/tree-sitter"))'
141
86FROM emacs-base as emacs-gnustep 142FROM emacs-base as emacs-gnustep
87 143
88RUN apt-get update && \ 144RUN 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:
176 - test/infra/* 176 - test/infra/*
177 - test/lisp/progmodes/eglot-tests.el 177 - test/lisp/progmodes/eglot-tests.el
178 178
179.tree-sitter-template:
180 rules:
181 - if: '$CI_PIPELINE_SOURCE == "web"'
182 - if: '$CI_PIPELINE_SOURCE == "schedule"'
183 changes:
184 - "**.in"
185 - lisp/progmodes/*-ts-mode.el
186 - test/infra/*
187 - test/lisp/progmodes/*-ts-mode-tests.el
188
179.native-comp-template: 189.native-comp-template:
180 rules: 190 rules:
181 - if: '$CI_PIPELINE_SOURCE == "web"' 191 - if: '$CI_PIPELINE_SOURCE == "web"'
@@ -256,6 +266,31 @@ test-eglot:
256 # This is needed in order to get a JUnit test report. 266 # This is needed in order to get a JUnit test report.
257 make_params: '-k -C test check-expensive LOGFILES="lisp/progmodes/eglot-tests.log"' 267 make_params: '-k -C test check-expensive LOGFILES="lisp/progmodes/eglot-tests.log"'
258 268
269build-image-tree-sitter:
270 stage: platform-images
271 extends: [.job-template, .build-template, .tree-sitter-template]
272 variables:
273 target: emacs-tree-sitter
274
275test-tree-sitter:
276 stage: platforms
277 extends: [.job-template, .test-template, .tree-sitter-template]
278 needs:
279 - job: build-image-tree-sitter
280 optional: true
281 variables:
282 target: emacs-tree-sitter
283 # This is needed in order to get a JUnit test report.
284 files: >-
285 lisp/progmodes/c-ts-mode-tests.log
286 lisp/progmodes/elixir-ts-mode-tests.el
287 lisp/progmodes/go-ts-mode-tests.log
288 lisp/progmodes/heex-ts-mode-tests.log
289 lisp/progmodes/java-ts-mode-tests.log
290 lisp/progmodes/ruby-ts-mode-tests.log
291 lisp/progmodes/typescript-ts-mode-tests.log
292 make_params: '-k -C test check-expensive LD_LIBRARY_PATH=/usr/local/lib/tree-sitter LOGFILES="$files"'
293
259build-image-gnustep: 294build-image-gnustep:
260 stage: platform-images 295 stage: platform-images
261 extends: [.job-template, .build-template, .gnustep-template] 296 extends: [.job-template, .build-template, .gnustep-template]