Skip to content

Commit f013e62

Browse files
committed
ci: reorganize CI into a single workflow
Details: - This centralizes all quality control checks in place. - This allows creating a single "workflow status" job. It is useful as an indicator in various scenarios: - Required check in branch protection. Instead of listing and maintaining all jobs in branch protection ruleset, list them in workflow. - Act as a trigger for potential future synchronization jobs: for dual distribution and for site.
1 parent b7231b6 commit f013e62

File tree

3 files changed

+149
-117
lines changed

3 files changed

+149
-117
lines changed

.github/workflows/lint.yml

Lines changed: 0 additions & 78 deletions
This file was deleted.
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
name: Quality Control
2+
3+
on:
4+
push:
5+
branches-ignore: [ sync, stable ]
6+
pull_request:
7+
branches-ignore: [ sync, stable ]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.actor }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
detect-changes:
15+
name: Detect changes
16+
runs-on: ubuntu-latest
17+
outputs:
18+
code: ${{ steps.filter.outputs.code }}
19+
steps:
20+
21+
- uses: actions/checkout@v4
22+
23+
- uses: dorny/paths-filter@v3
24+
id: filter
25+
with:
26+
filters: |
27+
code:
28+
- 'colors/**'
29+
- 'lua/**'
30+
- 'tests/**'
31+
- 'scripts/minimal_init.lua'
32+
33+
tests:
34+
name: Run tests
35+
needs: detect-changes
36+
# Run only if testable code has changed (to save time and resources)
37+
if: ${{ needs.detect-changes.outputs.code == 'true' }}
38+
timeout-minutes: 15
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
os: [ ubuntu-latest ]
43+
neovim_version: [ 'v0.9.5', 'v0.10.4', 'v0.11.5', 'nightly' ]
44+
include:
45+
- os: macos-latest
46+
neovim_version: v0.11.5
47+
- os: windows-latest
48+
neovim_version: v0.11.5
49+
runs-on: ${{ matrix.os }}
50+
51+
steps:
52+
53+
- uses: actions/checkout@v4
54+
55+
- name: Setup neovim
56+
uses: rhysd/action-setup-vim@v1
57+
with:
58+
neovim: true
59+
version: ${{ matrix.neovim_version }}
60+
61+
- name: Run tests
62+
run: make test
63+
64+
lint-gendoc:
65+
name: Lint document generation
66+
runs-on: ubuntu-latest
67+
steps:
68+
69+
- uses: actions/checkout@v4
70+
71+
- name: Install Neovim
72+
uses: rhysd/action-setup-vim@v1
73+
with:
74+
neovim: true
75+
version: v0.11.5
76+
77+
- name: Generate documentation
78+
run: make --silent documentation
79+
80+
- name: Check for changes
81+
run: if [[ -n $(git status -s) ]]; then exit 1; fi
82+
83+
lint-formatting:
84+
name: Lint formatting
85+
runs-on: ubuntu-latest
86+
steps:
87+
88+
- uses: actions/checkout@v4
89+
90+
- uses: JohnnyMorganz/stylua-action@v4
91+
with:
92+
token: ${{ secrets.GITHUB_TOKEN }}
93+
version: v2.1.0
94+
# CLI arguments
95+
args: --color always --respect-ignores --check .
96+
97+
lint-commit:
98+
name: Lint commits
99+
runs-on: ubuntu-latest
100+
env:
101+
LINTCOMMIT_STRICT: true
102+
steps:
103+
104+
- uses: actions/checkout@v4
105+
with:
106+
fetch-depth: 0
107+
ref: ${{ github.event.pull_request.head.sha || github.ref }}
108+
109+
- name: Install Neovim
110+
uses: rhysd/action-setup-vim@v1
111+
with:
112+
neovim: true
113+
version: v0.11.5
114+
115+
- name: Lint new commits
116+
run: make --silent lintcommit-ci
117+
118+
lint-filename:
119+
name: Lint filename lengths
120+
runs-on: ubuntu-latest
121+
steps:
122+
123+
- uses: actions/checkout@v4
124+
125+
- name: Check filename legnths
126+
run: make --silent lint-filename-length-ci
127+
128+
- name: Check case sensitivity
129+
uses: credfeto/[email protected]
130+
131+
check-workflow-status:
132+
name: Check workflow status
133+
runs-on: ubuntu-latest
134+
needs: [ tests, lint-gendoc, lint-formatting, lint-commit, lint-filename ]
135+
if: always()
136+
steps:
137+
- name: Check workflow status
138+
run: |
139+
exit_on_result() {
140+
if [[ "$2" == "failure" || "$2" == "cancelled" ]]; then
141+
echo "Job '$1' failed or was cancelled."
142+
exit 1
143+
fi
144+
}
145+
exit_on_result "tests" "${{ needs.tests.result }}"
146+
exit_on_result "lint-gendoc" "${{ needs.lint-gendoc.result }}"
147+
exit_on_result "lint-formatting" "${{ needs.lint-formatting.result }}"
148+
exit_on_result "lint-commit" "${{ needs.lint-commit.result }}"
149+
exit_on_result "lint-filename" "${{ needs.lint-filename.result }}"

.github/workflows/tests.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)