Skip to content

Commit c3fe96a

Browse files
authored
Merge pull request emacs-tree-sitter#223 from emacs-tree-sitter/emacs-28
Add CI for Emacs 28; Fix tests
2 parents 3deb0b8 + a00067b commit c3fe96a

File tree

5 files changed

+61
-53
lines changed

5 files changed

+61
-53
lines changed

.github/workflows/integ.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,26 @@ jobs:
1818
- windows-2019
1919
emacs-version:
2020
- '27.2'
21+
- '28.1'
2122
runs-on: ${{ matrix.os }}
2223
steps:
2324
- uses: purcell/setup-emacs@b56a75706e31e22d474357c77fb25ce73be2973a
2425
if: runner.os != 'Windows'
2526
with:
2627
version: ${{ matrix.emacs-version }}
27-
# Seems like the Emacs archive from GNU's FTP uses its own outdated bundle of CA certs, which
28-
# wouldn't include the new LetsEncrypt's root CA cert, which is used by MELPA, among others.
29-
# So we use mingw64's Emacs instead. TODO: Switch back whenever possible.
30-
- name: Install Emacs (Windows)
28+
29+
- uses: jcs090218/setup-emacs-windows@6e1ba035e1387639a42f4ef4872598c88481c863
3130
if: runner.os == 'Windows'
31+
with:
32+
version: ${{ matrix.emacs-version }}
33+
# Remove expired DST Root CA X3 certificate. Workaround for
34+
# https://debbugs.gnu.org/cgi/bugreport.cgi?bug=51038 bug on Emacs 27.2.
35+
# https://github.com/jcs090218/setup-emacs-windows/issues/156#issuecomment-1126671598
36+
- name: Workaround for Emacs 27.2's Windows build from GNU FTP
37+
if: ${{ runner.os == 'Windows' && matrix.emacs-version == '27.2' }}
3238
run: |
33-
$env:MSYS_PATH = "$env:CD\ci-tools\msys2"
34-
choco install msys2 --params="/InstallDir:$env:MSYS_PATH /NoPath"
35-
$env:PATH = "$env:MSYS_PATH\usr\bin;" + $env:PATH
36-
pacman -S --noconfirm --needed mingw-w64-x86_64-emacs
37-
echo "$env:MSYS_PATH\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf-8 -Append
38-
# - uses: jcs090218/setup-emacs-windows@v4
39-
# if: runner.os == 'Windows'
40-
# with:
41-
# version: ${{ matrix.emacs-version }}
39+
gci cert:\LocalMachine\Root\DAC9024F54D8F6DF94935FB1732638CA6AD77C13
40+
gci cert:\LocalMachine\Root\DAC9024F54D8F6DF94935FB1732638CA6AD77C13 | Remove-Item
4241
4342
- uses: actions/checkout@v2
4443
with:

.github/workflows/main.yml

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,20 @@ jobs:
2323
matrix:
2424
os:
2525
- macos-10.15
26-
# - ubuntu-18.04
2726
- ubuntu-20.04
27+
- windows-2019
2828
emacs-version:
29-
# - '25.3'
30-
# - '26.3'
3129
- '27.2'
30+
- '28.1'
3231
include:
33-
# # Older Emacs binaries for Windows don't have dynamic modules enabled.
34-
# - os: windows-2016
35-
# emacs-version: '27.2'
36-
- os: windows-2019
37-
emacs-version: '27.2'
3832
- os: macos-11
3933
emacs-version: '27.2'
4034
# Cross build
4135
target: aarch64-apple-darwin
36+
- os: macos-11
37+
emacs-version: '28.1'
38+
# Cross build
39+
target: aarch64-apple-darwin
4240
runs-on: ${{ matrix.os }}
4341
steps:
4442
- name: Set up Rust
@@ -56,21 +54,19 @@ jobs:
5654
if: runner.os != 'Windows'
5755
with:
5856
version: ${{ matrix.emacs-version }}
59-
# Seems like the Emacs archive from GNU's FTP uses its own outdated bundle of CA certs, which
60-
# wouldn't include the new LetsEncrypt's root CA cert, which is used by MELPA, among others.
61-
# So we use mingw64's Emacs instead. TODO: Switch back whenever possible.
62-
- name: Install Emacs (Windows)
57+
58+
- uses: jcs090218/setup-emacs-windows@6e1ba035e1387639a42f4ef4872598c88481c863
6359
if: runner.os == 'Windows'
60+
with:
61+
version: ${{ matrix.emacs-version }}
62+
# Remove expired DST Root CA X3 certificate. Workaround for
63+
# https://debbugs.gnu.org/cgi/bugreport.cgi?bug=51038 bug on Emacs 27.2.
64+
# https://github.com/jcs090218/setup-emacs-windows/issues/156#issuecomment-1126671598
65+
- name: Workaround for Emacs 27.2's Windows build from GNU FTP
66+
if: ${{ runner.os == 'Windows' && matrix.emacs-version == '27.2' }}
6467
run: |
65-
$env:MSYS_PATH = "$env:CD\ci-tools\msys2"
66-
choco install msys2 --params="/InstallDir:$env:MSYS_PATH /NoPath"
67-
$env:PATH = "$env:MSYS_PATH\usr\bin;" + $env:PATH
68-
pacman -S --noconfirm --needed mingw-w64-x86_64-emacs
69-
echo "$env:MSYS_PATH\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf-8 -Append
70-
# - uses: jcs090218/setup-emacs-windows@v4
71-
# if: runner.os == 'Windows'
72-
# with:
73-
# version: ${{ matrix.emacs-version }}
68+
gci cert:\LocalMachine\Root\DAC9024F54D8F6DF94935FB1732638CA6AD77C13
69+
gci cert:\LocalMachine\Root\DAC9024F54D8F6DF94935FB1732638CA6AD77C13 | Remove-Item
7470
7571
- uses: actions/checkout@v2
7672
with:

.github/workflows/release.yml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,19 @@ jobs:
4545
if: runner.os != 'Windows'
4646
with:
4747
version: ${{ matrix.emacs-version }}
48-
# Seems like the Emacs archive from GNU's FTP uses its own outdated bundle of CA certs, which
49-
# wouldn't include the new LetsEncrypt's root CA cert, which is used by MELPA, among others.
50-
# So we use mingw64's Emacs instead. TODO: Switch back whenever possible.
51-
- name: Install Emacs (Windows)
48+
49+
- uses: jcs090218/setup-emacs-windows@6e1ba035e1387639a42f4ef4872598c88481c863
5250
if: runner.os == 'Windows'
51+
with:
52+
version: ${{ matrix.emacs-version }}
53+
# Remove expired DST Root CA X3 certificate. Workaround for
54+
# https://debbugs.gnu.org/cgi/bugreport.cgi?bug=51038 bug on Emacs 27.2.
55+
# https://github.com/jcs090218/setup-emacs-windows/issues/156#issuecomment-1126671598
56+
- name: Workaround for Emacs 27.2's Windows build from GNU FTP
57+
if: ${{ runner.os == 'Windows' && matrix.emacs-version == '27.2' }}
5358
run: |
54-
$env:MSYS_PATH = "$env:CD\ci-tools\msys2"
55-
choco install msys2 --params="/InstallDir:$env:MSYS_PATH /NoPath"
56-
$env:PATH = "$env:MSYS_PATH\usr\bin;" + $env:PATH
57-
pacman -S --noconfirm --needed mingw-w64-x86_64-emacs
58-
echo "$env:MSYS_PATH\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf-8 -Append
59-
# - uses: jcs090218/setup-emacs-windows@v4
60-
# if: runner.os == 'Windows'
61-
# with:
62-
# version: ${{ matrix.emacs-version }}
59+
gci cert:\LocalMachine\Root\DAC9024F54D8F6DF94935FB1732638CA6AD77C13
60+
gci cert:\LocalMachine\Root\DAC9024F54D8F6DF94935FB1732638CA6AD77C13 | Remove-Item
6361
6462
- uses: actions/checkout@v2
6563
with:
@@ -148,10 +146,19 @@ jobs:
148146
if: runner.os != 'Windows'
149147
with:
150148
version: ${{ matrix.emacs-version }}
151-
- uses: jcs090218/setup-emacs-windows@v4
149+
150+
- uses: jcs090218/setup-emacs-windows@6e1ba035e1387639a42f4ef4872598c88481c863
152151
if: runner.os == 'Windows'
153152
with:
154153
version: ${{ matrix.emacs-version }}
154+
# Remove expired DST Root CA X3 certificate. Workaround for
155+
# https://debbugs.gnu.org/cgi/bugreport.cgi?bug=51038 bug on Emacs 27.2.
156+
# https://github.com/jcs090218/setup-emacs-windows/issues/156#issuecomment-1126671598
157+
- name: Workaround for Emacs 27.2's Windows build from GNU FTP
158+
if: ${{ runner.os == 'Windows' && matrix.emacs-version == '27.2' }}
159+
run: |
160+
gci cert:\LocalMachine\Root\DAC9024F54D8F6DF94935FB1732638CA6AD77C13
161+
gci cert:\LocalMachine\Root\DAC9024F54D8F6DF94935FB1732638CA6AD77C13 | Remove-Item
155162
156163
- uses: actions/checkout@v2
157164

tests/tree-sitter-tests-utils.el

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ If RESET is non-nil, also do another full parse and check again."
7777
"Return t if text at POS is highlighted with FACE."
7878
(memq face (tsc--listify (get-text-property pos 'face))))
7979

80+
;; In Emacs 28,`font-lock-ensure' checks `font-lock-specified-p' first.
81+
;; See https://github.com/emacs-tree-sitter/elisp-tree-sitter/pull/220#issuecomment-1120423580.
82+
(defun tsc--hl-ensure (&optional beg end)
83+
(funcall font-lock-ensure-function
84+
(or beg (point-min)) (or end (point-max))))
85+
8086
(defun tsc-test-no-op (&rest _args))
8187

8288
(defvar tsc-test-no-op

tests/tree-sitter-tests.el

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -448,14 +448,14 @@ source_file (1 . 20)
448448
(lambda (capture-name)
449449
(not (string= capture-name "keyword"))))
450450
(tree-sitter-hl-mode)
451-
(font-lock-ensure)
451+
(tsc--hl-ensure)
452452
(should (null (get-text-property 1 'face)))
453453
(ert-info ("Other elements should still be highlighted")
454454
(should-not (null (next-single-property-change 1 'face))))))
455455
(ert-info ("Keywords should be highlighted by default")
456456
(tsc-test-lang-with-file rust "data/types.rs"
457457
(tree-sitter-hl-mode)
458-
(font-lock-ensure)
458+
(tsc--hl-ensure)
459459
(should (tsc--hl-at 1 'tree-sitter-hl-face:keyword))))
460460
(ert-info ("Keywords should not be highlighted if their capture name is disabled")
461461
(tsc-test-lang-with-file rust "data/types.rs"
@@ -464,7 +464,7 @@ source_file (1 . 20)
464464
(lambda (capture-name)
465465
(not (string= capture-name "keyword"))))
466466
(tree-sitter-hl-mode)
467-
(font-lock-ensure)
467+
(tsc--hl-ensure)
468468
(should (null (get-text-property 1 'face)))
469469
(ert-info ("Other elements should still be highlighted")
470470
(should-not (null (next-single-property-change 1 'face))))))
@@ -473,7 +473,7 @@ source_file (1 . 20)
473473
(add-function :override (local 'tree-sitter-hl-face-mapping-function)
474474
(lambda (capture-name) nil))
475475
(tree-sitter-hl-mode)
476-
(font-lock-ensure)
476+
(tsc--hl-ensure)
477477
(ert-info ("`face' should be nil for the whole buffer")
478478
(should (null (get-text-property 1 'face)))
479479
(should (null (next-single-property-change 1 'face)))))))
@@ -483,7 +483,7 @@ source_file (1 . 20)
483483
(with-current-buffer (find-file (tsc-test-full-path "data/hl.py"))
484484
(tree-sitter-hl-mode)
485485
(font-lock-mode -1)
486-
(font-lock-ensure)
486+
(tsc--hl-ensure)
487487
(should (tsc--hl-at 6 'tree-sitter-hl-face:function))))
488488

489489
(ert-deftest debug::jump ()

0 commit comments

Comments
 (0)