Skip to content

Commit 48bb3fa

Browse files
ci(yamllint): add YAML linting (reanahub#301)
1 parent 798cf5f commit 48bb3fa

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,24 @@ jobs:
139139
sudo apt-get install shfmt
140140
./run-tests.sh --check-shfmt
141141
142+
lint-yamllint:
143+
runs-on: ubuntu-24.04
144+
steps:
145+
- name: Checkout
146+
uses: actions/checkout@v4
147+
with:
148+
fetch-depth: 0
149+
150+
- name: Setup Python
151+
uses: actions/setup-python@v5
152+
with:
153+
python-version: "3.12"
154+
155+
- name: Lint YAML files
156+
run: |
157+
pip install yamllint
158+
./run-tests.sh --check-yamllint
159+
142160
docs-sphinx:
143161
runs-on: ubuntu-24.04
144162
steps:
@@ -211,8 +229,7 @@ jobs:
211229
release-docker:
212230
runs-on: ubuntu-24.04
213231
if: >
214-
vars.RELEASE_DOCKER == 'true' &&
215-
github.event_name == 'push' &&
232+
vars.RELEASE_DOCKER == 'true' && github.event_name == 'push' &&
216233
startsWith(github.ref, 'refs/tags/')
217234
needs:
218235
- docs-sphinx

.yamllint.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
extends: default
2+
3+
rules:
4+
comments:
5+
min-spaces-from-content: 1
6+
document-start: disable
7+
line-length: disable
8+
truthy: disable

run-tests.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ check_jsonlint() {
8383
find . -name "*.json" -exec jsonlint -q {} \+
8484
}
8585

86+
check_yamllint() {
87+
yamllint .
88+
}
89+
8690
check_shfmt() {
8791
shfmt -d .
8892
}
@@ -99,6 +103,7 @@ check_all() {
99103
check_dockerfile
100104
check_docker_build
101105
check_jsonlint
106+
check_yamllint
102107
check_shfmt
103108
}
104109

@@ -120,6 +125,7 @@ case $arg in
120125
--check-dockerfile) check_dockerfile ;;
121126
--check-docker-build) check_docker_build ;;
122127
--check-jsonlint) check_jsonlint ;;
128+
--check-yamllint) check_yamllint ;;
123129
--check-shfmt) check_shfmt ;;
124130
--check-all) check_all ;;
125131
*) echo "[ERROR] Invalid argument '$arg'. Exiting." && exit 1 ;;

0 commit comments

Comments
 (0)