Skip to content

Commit ddd8aa0

Browse files
committed
ci: test each module separately
This allows more modular reruns after flaky tests fails: instead of running whole `make test` only modules which failed on previous run attempt will be tested (thanks to some GitHub Actions scripting magic).
1 parent f0d6e89 commit ddd8aa0

File tree

1 file changed

+278
-4
lines changed

1 file changed

+278
-4
lines changed

.github/workflows/tests.yml

Lines changed: 278 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ concurrency:
1313
cancel-in-progress: true
1414

1515
jobs:
16-
build:
17-
name: Run tests
16+
test:
1817
timeout-minutes: 15
1918
strategy:
2019
fail-fast: false
@@ -27,13 +26,288 @@ jobs:
2726
- os: windows-latest
2827
neovim_version: v0.10.1
2928
runs-on: ${{ matrix.os }}
29+
name: Test (${{ matrix.os }}, ${{ matrix.neovim_version }})
3030

3131
steps:
32+
- name: Get Previous Run Status
33+
id: prev_attempt_is_fail
34+
if: ${{ !cancelled() }}
35+
uses: actions/github-script@v7
36+
with:
37+
github-token: ${{ secrets.GITHUB_TOKEN }}
38+
script: |
39+
var attempt_number = ${{ github.run_attempt }} - 1;
40+
if (attempt_number < 1) return;
41+
42+
const { data: prev_jobs } = await github.rest.actions.listJobsForWorkflowRunAttempt({
43+
owner: context.repo.owner,
44+
repo: context.repo.repo,
45+
run_id: context.runId,
46+
attempt_number: attempt_number,
47+
});
48+
49+
var cur_job_name = 'Test (${{ matrix.os }}, ${{ matrix.neovim_version }})'
50+
for (var j of prev_jobs.jobs) {
51+
if (j.name === cur_job_name) {
52+
for (var s of j.steps) {
53+
var is_fail = !(s.conclusion === 'success' || s.conclusion === 'skipped');
54+
core.setOutput(s.name, is_fail);
55+
}
56+
}
57+
}
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
3261
- uses: actions/checkout@v4
62+
3363
- name: Setup neovim
3464
uses: rhysd/action-setup-vim@v1
3565
with:
3666
neovim: true
3767
version: ${{ matrix.neovim_version }}
38-
- name: Run tests
39-
run: make test
68+
69+
- name: ai
70+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.ai == 'true') }}
71+
env:
72+
FILE: tests/test_ai.lua
73+
run: make test_file
74+
75+
- name: align
76+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.align == 'true') }}
77+
env:
78+
FILE: tests/test_align.lua
79+
run: make test_file
80+
81+
- name: animate
82+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.animate == 'true') }}
83+
env:
84+
FILE: tests/test_animate.lua
85+
run: make test_file
86+
87+
- name: base16
88+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.base16 == 'true') }}
89+
env:
90+
FILE: tests/test_base16.lua
91+
run: make test_file
92+
93+
- name: basics
94+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.basics == 'true') }}
95+
env:
96+
FILE: tests/test_basics.lua
97+
run: make test_file
98+
99+
- name: bracketed
100+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.bracketed == 'true') }}
101+
env:
102+
FILE: tests/test_bracketed.lua
103+
run: make test_file
104+
105+
- name: bufremove
106+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.bufremove == 'true') }}
107+
env:
108+
FILE: tests/test_bufremove.lua
109+
run: make test_file
110+
111+
- name: clue
112+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.clue == 'true') }}
113+
env:
114+
FILE: tests/test_clue.lua
115+
run: make test_file
116+
117+
- name: colors
118+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.colors == 'true') }}
119+
env:
120+
FILE: tests/test_colors.lua
121+
run: make test_file
122+
123+
- name: comment
124+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.comment == 'true') }}
125+
env:
126+
FILE: tests/test_comment.lua
127+
run: make test_file
128+
129+
- name: completion
130+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.completion == 'true') }}
131+
env:
132+
FILE: tests/test_completion.lua
133+
run: make test_file
134+
135+
- name: cursorword
136+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.cursorword == 'true') }}
137+
env:
138+
FILE: tests/test_cursorword.lua
139+
run: make test_file
140+
141+
- name: deps
142+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.deps == 'true') }}
143+
env:
144+
FILE: tests/test_deps.lua
145+
run: make test_file
146+
147+
- name: diff
148+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.diff == 'true') }}
149+
env:
150+
FILE: tests/test_diff.lua
151+
run: make test_file
152+
153+
- name: doc
154+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.doc == 'true') }}
155+
env:
156+
FILE: tests/test_doc.lua
157+
run: make test_file
158+
159+
- name: extra
160+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.extra == 'true') }}
161+
env:
162+
FILE: tests/test_extra.lua
163+
run: make test_file
164+
165+
- name: files
166+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.files == 'true') }}
167+
env:
168+
FILE: tests/test_files.lua
169+
run: make test_file
170+
171+
- name: fuzzy
172+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.fuzzy == 'true') }}
173+
env:
174+
FILE: tests/test_fuzzy.lua
175+
run: make test_file
176+
177+
- name: git
178+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.git == 'true') }}
179+
env:
180+
FILE: tests/test_git.lua
181+
run: make test_file
182+
183+
- name: hipatterns
184+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.hipatterns == 'true') }}
185+
env:
186+
FILE: tests/test_hipatterns.lua
187+
run: make test_file
188+
189+
- name: hues
190+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.hues == 'true') }}
191+
env:
192+
FILE: tests/test_hues.lua
193+
run: make test_file
194+
195+
- name: icons
196+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.icons == 'true') }}
197+
env:
198+
FILE: tests/test_icons.lua
199+
run: make test_file
200+
201+
- name: indentscope
202+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.indentscope == 'true') }}
203+
env:
204+
FILE: tests/test_indentscope.lua
205+
run: make test_file
206+
207+
- name: jump
208+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.jump == 'true') }}
209+
env:
210+
FILE: tests/test_jump.lua
211+
run: make test_file
212+
213+
- name: jump2d
214+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.jump2d == 'true') }}
215+
env:
216+
FILE: tests/test_jump2d.lua
217+
run: make test_file
218+
219+
- name: map
220+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.map == 'true') }}
221+
env:
222+
FILE: tests/test_map.lua
223+
run: make test_file
224+
225+
- name: misc
226+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.misc == 'true') }}
227+
env:
228+
FILE: tests/test_misc.lua
229+
run: make test_file
230+
231+
- name: move
232+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.move == 'true') }}
233+
env:
234+
FILE: tests/test_move.lua
235+
run: make test_file
236+
237+
- name: notify
238+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.notify == 'true') }}
239+
env:
240+
FILE: tests/test_notify.lua
241+
run: make test_file
242+
243+
- name: operators
244+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.operators == 'true') }}
245+
env:
246+
FILE: tests/test_operators.lua
247+
run: make test_file
248+
249+
- name: pairs
250+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.pairs == 'true') }}
251+
env:
252+
FILE: tests/test_pairs.lua
253+
run: make test_file
254+
255+
- name: pick
256+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.pick == 'true') }}
257+
env:
258+
FILE: tests/test_pick.lua
259+
run: make test_file
260+
261+
- name: sessions
262+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.sessions == 'true') }}
263+
env:
264+
FILE: tests/test_sessions.lua
265+
run: make test_file
266+
267+
- name: splitjoin
268+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.splitjoin == 'true') }}
269+
env:
270+
FILE: tests/test_splitjoin.lua
271+
run: make test_file
272+
273+
- name: starter
274+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.starter == 'true') }}
275+
env:
276+
FILE: tests/test_starter.lua
277+
run: make test_file
278+
279+
- name: statusline
280+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.statusline == 'true') }}
281+
env:
282+
FILE: tests/test_statusline.lua
283+
run: make test_file
284+
285+
- name: surround
286+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.surround == 'true') }}
287+
env:
288+
FILE: tests/test_surround.lua
289+
run: make test_file
290+
291+
- name: tabline
292+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.tabline == 'true') }}
293+
env:
294+
FILE: tests/test_tabline.lua
295+
run: make test_file
296+
297+
- name: test
298+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.test == 'true') }}
299+
env:
300+
FILE: tests/test_test.lua
301+
run: make test_file
302+
303+
- name: trailspace
304+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.trailspace == 'true') }}
305+
env:
306+
FILE: tests/test_trailspace.lua
307+
run: make test_file
308+
309+
- name: visits
310+
if: ${{ !cancelled() && (github.run_attempt == '1' || steps.prev_attempt_is_fail.outputs.visits == 'true') }}
311+
env:
312+
FILE: tests/test_visits.lua
313+
run: make test_file

0 commit comments

Comments
 (0)