Skip to content

Commit 95153db

Browse files
authored
Update CI to work with multiple platforms (emacs-lsp#563)
* Add macos to CI test * Add windows CI test * Add bootstrap from lsp-mode * Add windows compile command * Add test * Add windows test * Update make command for each platforms * Fixed CI indentation * Fixed typo * Use test * Fix CI * Update order * Update name test * Fixed make indentation * Revert order * Remove windows ci * Revert windows ci * Revert full windows ci * No need rust for windows CI * Temporary remove test * Convert to tab * Update clean command * Fixed lint * Add fixme keyword
1 parent d71d21d commit 95153db

File tree

5 files changed

+146
-47
lines changed

5 files changed

+146
-47
lines changed

.github/workflows/test.yml

+62-35
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ on:
99
- master
1010

1111
jobs:
12-
build:
13-
runs-on: ubuntu-latest
12+
unix-test:
13+
runs-on: ${{ matrix.os }}
1414
strategy:
1515
matrix:
16+
os: [ubuntu-latest, macos-latest]
1617
emacs_version:
1718
- 26.1
1819
- 26.2
@@ -21,36 +22,62 @@ jobs:
2122
- snapshot
2223

2324
steps:
24-
- uses: actions/checkout@v2
25-
26-
- uses: actions/setup-python@v2
27-
with:
28-
python-version: '3.6'
29-
architecture: 'x64'
30-
31-
- uses: purcell/setup-emacs@master
32-
with:
33-
version: ${{ matrix.emacs_version }}
34-
35-
- uses: conao3/setup-cask@master
36-
with:
37-
version: 0.8.4
38-
39-
- name: Install Rust toolchain
40-
uses: actions-rs/toolchain@v1
41-
with:
42-
profile: minimal
43-
toolchain: stable
44-
override: true
45-
components: rust-src
46-
47-
- name: Install Rust Analyzer
48-
env:
49-
RUST_ANALYZER_VERSION: 2020-04-20
50-
run: |
51-
mkdir -p $HOME/bin
52-
wget https://github.com/rust-analyzer/rust-analyzer/releases/download/$RUST_ANALYZER_VERSION/rust-analyzer-linux -O $HOME/bin/rust-analyzer
53-
chmod +x $HOME/bin/rust-analyzer
54-
55-
- name: Run tests
56-
run: 'make ci'
25+
- uses: actions/checkout@v2
26+
27+
- uses: actions/setup-python@v2
28+
with:
29+
python-version: '3.6'
30+
architecture: 'x64'
31+
32+
- uses: purcell/setup-emacs@master
33+
with:
34+
version: ${{ matrix.emacs_version }}
35+
36+
- uses: conao3/setup-cask@master
37+
with:
38+
version: 0.8.4
39+
40+
- name: Install Rust toolchain
41+
uses: actions-rs/toolchain@v1
42+
with:
43+
profile: minimal
44+
toolchain: stable
45+
override: true
46+
components: rust-src
47+
48+
- name: Install Rust Analyzer
49+
env:
50+
RUST_ANALYZER_VERSION: 2020-04-20
51+
run: |
52+
mkdir -p $HOME/bin
53+
wget https://github.com/rust-analyzer/rust-analyzer/releases/download/$RUST_ANALYZER_VERSION/rust-analyzer-linux -O $HOME/bin/rust-analyzer
54+
chmod +x $HOME/bin/rust-analyzer
55+
56+
- name: Run tests
57+
run: 'make unix-ci'
58+
59+
windows-test:
60+
runs-on: windows-latest
61+
strategy:
62+
matrix:
63+
emacs-version:
64+
- 26.1
65+
- 26.2
66+
- 26.3
67+
- 27.1
68+
- snapshot
69+
70+
steps:
71+
- uses: actions/checkout@v2
72+
73+
- uses: actions/setup-python@v2
74+
with:
75+
python-version: '3.6'
76+
architecture: 'x64'
77+
78+
- uses: jcs090218/setup-emacs-windows@master
79+
with:
80+
version: ${{ matrix.emacs-version }}
81+
82+
- name: Run tests
83+
run: 'make windows-ci'

Makefile

+32-7
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,52 @@ SHELL := /usr/bin/env bash
33
EMACS ?= emacs
44
CASK ?= cask
55

6+
TEST-FILES := test/windows-bootstrap.el test/test-helper.el \
7+
$(shell ls test/lsp-ui-*.el)
8+
LOAD-FILE = -l $(test-file)
9+
LOAD-TEST-FILES := $(foreach test-file, $(TEST-FILES), $(LOAD-FILE))
10+
611
build:
712
EMACS=$(EMACS) cask install
813
EMACS=$(EMACS) cask build
914
EMACS=$(EMACS) cask clean-elc
1015

11-
ci: build compile clean
12-
# TODO: Fix tests
13-
# ci: build compile test clean
16+
# FIXME: Add `unix-test`
17+
unix-ci: build unix-compile clean
18+
19+
# FIXME: Add `windows-test`
20+
windows-ci: CASK=
21+
windows-ci: windows-compile clean
22+
23+
unix-compile:
24+
@echo "Compiling..."
25+
@$(CASK) $(EMACS) -Q --batch \
26+
-L . \
27+
--eval '(setq byte-compile-error-on-warn t)' \
28+
-f batch-byte-compile \
29+
*.el
1430

15-
compile:
31+
windows-compile:
1632
@echo "Compiling..."
1733
@$(CASK) $(EMACS) -Q --batch \
34+
-l test/windows-bootstrap.el \
1835
-L . \
1936
--eval '(setq byte-compile-error-on-warn t)' \
2037
-f batch-byte-compile \
2138
*.el
2239

23-
test:
40+
unix-test:
2441
EMACS=$(EMACS) cask exec ert-runner
2542

43+
windows-test:
44+
@$(EMACS) -Q --batch \
45+
-l test/windows-bootstrap.el \
46+
-L . \
47+
$(LOAD-TEST-FILES) \
48+
--eval "(ert-run-tests-batch-and-exit \
49+
'(and (not (tag no-win)) (not (tag org))))"
50+
2651
clean:
27-
EMACS=$(EMACS) cask clean-elc
52+
rm -rf .cask *.elc
2853

29-
.PHONY: build ci compile test clean
54+
.PHONY: build ci unix-compile unix-test windows-compile windows-test clean

lsp-ui-flycheck.el

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
:link '(info-link "(lsp-ui-flycheck) Customizing"))
4141

4242
(defcustom lsp-ui-flycheck-list-position 'bottom
43-
"Position where `lsp-ui-flycheck-list' will show diagnostics for the whole workspace."
43+
"Position where `lsp-ui-flycheck-list' will show diagnostics for the
44+
whole workspace."
4445
:type '(choice (const :tag "Bottom" bottom)
4546
(const :tag "Right" right))
4647
:group 'lsp-ui-flycheck)

lsp-ui-peek.el

+4-4
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@
7070

7171
(defcustom lsp-ui-peek-fontify 'on-demand
7272
"Whether to fontify chunks of code (use semantics colors).
73-
WARNING: 'always can heavily slow the processing when `lsp-ui-peek-expand-function'
74-
expands more than 1 file.
75-
It is recommended to keep the default value of `lsp-ui-peek-expand-function' when
76-
this variable is set to 'always."
73+
WARNING: 'always can heavily slow the processing when
74+
`lsp-ui-peek-expand-function' expands more than 1 file.
75+
It is recommended to keep the default value of `lsp-ui-peek-expand-function'
76+
when this variable is set to 'always."
7777
:type '(choice (const :tag "Never" never)
7878
(const :tag "On demand" on-demand)
7979
(const :tag "Always" always))

test/windows-bootstrap.el

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
;;; windows-bootstrap.el --- Windows test bootstrap -*- lexical-binding: t; -*-
2+
;;
3+
;; Copyright (C) 2020-2021 emacs-lsp maintainers
4+
;;
5+
;; This program is free software; you can redistribute it and/or modify
6+
;; it under the terms of the GNU General Public License as published by
7+
;; the Free Software Foundation, either version 3 of the License, or
8+
;; (at your option) any later version.
9+
10+
;; This program is distributed in the hope that it will be useful,
11+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
;; GNU General Public License for more details.
14+
15+
;; You should have received a copy of the GNU General Public License
16+
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
;;
18+
;;; Commentary:
19+
;;
20+
;; Windows test bootstrap
21+
;;
22+
;;; Code:
23+
24+
(require 'package)
25+
26+
(setq user-emacs-directory (expand-file-name (make-temp-name ".emacs.d")
27+
"~")
28+
package-user-dir (expand-file-name (make-temp-name "tmp-elpa")
29+
user-emacs-directory))
30+
31+
(let* ((package-archives '(("melpa" . "https://melpa.org/packages/")
32+
("gnu" . "http://elpa.gnu.org/packages/")))
33+
(pkgs (append '(dash dash-functional lsp-mode markdown-mode)
34+
'(ert-runner flycheck rustic))))
35+
(package-initialize)
36+
(package-refresh-contents)
37+
38+
(mapc (lambda (pkg)
39+
(unless (package-installed-p pkg)
40+
(package-install pkg)))
41+
pkgs)
42+
43+
(add-hook 'kill-emacs-hook
44+
`(lambda () (delete-directory ,user-emacs-directory t))))
45+
46+
;;; windows-bootstrap.el ends here

0 commit comments

Comments
 (0)