-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (87 loc) · 3.67 KB
/
Copy pathvim.yml
File metadata and controls
94 lines (87 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Vim
# Only run when something Vim-related changes, so unrelated PRs don't pay for
# a full plugin install.
on:
push:
branches: [master]
paths:
- 'rc.d/vimrc'
- 'rc.d/vim/**'
- 'setup.d/vim.sh'
- '.github/workflows/vim.yml'
pull_request:
paths:
- 'rc.d/vimrc'
- 'rc.d/vim/**'
- 'setup.d/vim.sh'
- '.github/workflows/vim.yml'
jobs:
vim-setup:
# Verify the Vim setup: vim-plug installs every declared plugin and the
# vimrc sources without a <Tab> mapping conflict (E227, copilot vs snipMate).
# YouCompleteMe is excluded here — its huge recursive clone and native
# compile (handled by setup.d/vim.sh) are too heavy for CI — but every other
# declared plugin is installed and checked.
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Install Vim
run: |
sudo apt-get update
sudo apt-get install -y vim
- name: Link Vim config into $HOME
run: |
ln -sfn "$PWD/rc.d/vimrc" "$HOME/.vimrc"
ln -sfn "$PWD/rc.d/vim" "$HOME/.vim"
- name: Install vim-plug and plugins
run: |
curl -sfLo rc.d/vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
# Install every declared plugin except YouCompleteMe (see job comment).
# Some `do` hooks need toolchains not present here (go/yarn/npm); they
# may warn but don't block clones, and the assertions below check what
# actually matters.
list="$(grep -oE "Plug '[^']+'" rc.d/vimrc \
| sed "s/Plug '//; s/'//; s#.*/##" \
| grep -vx 'YouCompleteMe' | sort -u | tr '\n' ' ')"
echo "Installing: $list"
# -u is required so the vimrc (which calls plug#begin) is sourced and
# PlugInstall is defined; otherwise the command is unknown and nothing
# installs.
vim --not-a-term -es -u "$HOME/.vimrc" -c "PlugInstall --sync $list" -c 'qall!' || true
# Fail loudly if nothing was actually installed (e.g. vimrc didn't load).
if [ ! -d "$HOME/.vim/plugged" ] || [ -z "$(ls -A "$HOME/.vim/plugged")" ]; then
echo "✗ no plugins were installed — vimrc/plug#begin likely did not run"
exit 1
fi
- name: Verify vimrc sources without a <Tab> conflict (E227)
run: |
set -euo pipefail
out="$(mktemp)"
# Load the real vimrc with all plugins active; E227 fires here if
# copilot and snipMate both try to own <Tab>.
vim --not-a-term -es -u "$HOME/.vimrc" \
-c 'redir! > '"$out" \
-c 'silent! echon "errmsg=[" . v:errmsg . "]"' \
-c 'redir END' -c 'qall!' 2>/dev/null || true
echo "startup $(cat "$out")"
if grep -q 'E227' "$out"; then
echo "✗ <Tab> mapping conflict (E227) at startup"
exit 1
fi
echo "✓ no <Tab> mapping conflict at startup"
- name: Verify all declared plugins are installed
run: |
set -euo pipefail
grep -oE "Plug '[^']+'" rc.d/vimrc \
| sed "s/Plug '//; s/'//; s#.*/##" \
| grep -vx 'YouCompleteMe' | sort -u > /tmp/declared.txt
ls "$HOME/.vim/plugged" | sort > /tmp/installed.txt
missing="$(comm -23 /tmp/declared.txt /tmp/installed.txt)"
if [ -n "$missing" ]; then
echo "✗ declared but not installed:"
echo "$missing"
exit 1
fi
echo "✓ all $(wc -l < /tmp/declared.txt) declared plugins installed (YouCompleteMe excluded)"