-
Notifications
You must be signed in to change notification settings - Fork 0
171 lines (166 loc) · 5.11 KB
/
vimscript.yml
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
---
#
# .github/workflows/vimscript.yml
#
name: Vimscript Workflow
on: # yamllint disable-line rule:truthy
pull_request:
defaults:
run:
shell: bash
jobs:
stage1:
name: Change Check
runs-on: 'ubuntu-latest'
outputs:
docs_changed: ${{ steps.check_file_changed.outputs.docs_changed }}
steps:
- name: Checkout Repo
id: checkout-repo
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.ref }}
submodules: recursive
- name: Get Change List
id: check_file_changed
run: |
# Diff HEAD with the previous commit then output to stdout.
printf "=== Which files changed? ===\n"
GIT_DIFF="$(git diff --name-only HEAD^ HEAD)"
printf "%s\n" "${GIT_DIFF}"
printf "\n"
# Check if the files are present in the changed file list (added, modified, deleted) then output to stdout.
HAS_DIFF=false
printf "=== Which Vim files changed? ===\n"
if printf "%s\n" "${GIT_DIFF}" | grep -E '^(vimscript/.*[.](vim|vader|vimspec)|.github/workflows/vimscript.yml)$'; then
HAS_DIFF=true
fi
printf "\n"
# Did Golang files change?
printf "=== Did Golang files change? ===\n"
printf "%s\n" "${HAS_DIFF}"
printf "\n"
# Set the output named "docs_changed"
printf "%s=%s\n" "docs_changed" "${HAS_DIFF}" >> "${GITHUB_OUTPUT}"
stage2:
name: Vim Checks
strategy:
matrix:
os: ["ubuntu-latest"]
runs-on: "${{ matrix.os }}"
needs: [stage1]
if: needs.stage1.outputs.docs_changed == 'True'
steps:
- name: Checkout Repo
id: checkout-repo
uses: actions/checkout@v3
- name: Get Repo Root
id: get-repo-root
run: |
printf "%s=\"%s\"\n" "REPO_ROOT" "${PWD}" | tee -a "${GITHUB_ENV}"
- name: Setup Vim
id: setup-vim
uses: rhysd/action-setup-vim@v1
with:
neovim: false
version: stable
- name: Setup Nvim
id: setup-nvim
uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: stable
- name: Show Vim Versions
id: vim-version
run: |
which vim
vim --version
which nvim
nvim --version
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3'
- name: Install Tools
id: install-tools
run: |
# https://github.com/Vimjas/covimerage/issues/95
pip install 'click<8.0.0'
pip install covimerage
pip install vim-vint
- name: Show Tool Versions
id: tool-versions
run: |
covimerage --version
vint --version
- name: CD to Vim Dir
id: cd-to-vimscript-dir
run: |
pwd
ls
cd ./vimscript
pwd
ls
- name: Analysing the code with vint
id: vim-lint
run: |
cd ./vimscript
./for_each vint --warning --verbose --enable-neovim .
- name: Vader Tests with Vim
if: false # disable - not usable with multiple projects in one repo
id: vim-tests-vader-vim
uses: PsychoLlama/vader-action@v1
with:
neovim: false
test-pattern: '**/*.vader'
- name: Vader Tests with NeoVim
if: false # disable - not usable with multiple projects in one repo
id: vim-tests-vader-neovim
uses: PsychoLlama/vader-action@v1
with:
neovim: true
test-pattern: '**/*.vader'
- name: Checkout vader.vim
if: false # disabled - for_each_vader didn't work
id: checkout-vader
uses: actions/checkout@v3
with:
repository: junegunn/vader.vim
path: vader.vim
- name: Run Vader Tests
if: false # disabled - for_each_vader didn't work
id: vader-tests
run: |
mkdir -pv /home/runner/.vim/pack/upstream/opt/
ln -svf vader.vim /home/runner/.vim/pack/upstream/opt/
cd ./vimscript
./for_each_vader
- name: Checkout themis.vim
id: checkout-themis
uses: actions/checkout@v3
with:
repository: thinca/vim-themis
path: vim-themis
- name: Remove coverage output files
id: cov-cleanup
run: |
cd ./vimscript
./for_each rm -fv profile.txt coverage.xml .coverage_covimerage
- name: Run Themis Tests
id: themis-tests-vim
env:
THEMIS_VIM: ${{ steps.setup-vim.outputs.executable }}
THEMIS_PROFILE: profile.txt
run: |
cd ./vimscript
../vim-themis/bin/themis --version
./for_each ../../vim-themis/bin/themis themis.vimspec
./for_each ls
- name: Coverage Report
if: false # disable - themis step isn't generating profile.txt
id: vimscript-coverage-report
run: |-
cd ./vimscript
./for_each covimerage write_coverage profile.txt
./for_each coverage report