Skip to content

Commit 26ebf6a

Browse files
authored
Merge pull request #110 from itk-dev/feature/twig-lint
YAML lint
2 parents ea6598e + fb829ac commit 26ebf6a

File tree

35 files changed

+207
-75
lines changed

35 files changed

+207
-75
lines changed

.github/workflows/yaml.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Do not edit this file! Make a pull request on changing
2+
# github/workflows/yaml.yaml in
3+
# https://github.com/itk-dev/devops_itkdev-docker if need be.
4+
5+
### ### YAML
6+
###
7+
### Validates YAML files.
8+
###
9+
### #### Assumptions
10+
###
11+
### 1. A docker compose service named `prettier` for running
12+
### [Prettier](https://prettier.io/) exists.
13+
###
14+
### #### Symfony YAML
15+
###
16+
### Symfony's YAML config files use 4 spaces for indentation and single quotes.
17+
### Therefore we use a [Prettier configuration
18+
### file](https://prettier.io/docs/configuration), `.prettierrc.yaml`, to make
19+
### Prettier format YAML files in the `config/` folder like Symfony expects.
20+
21+
name: YAML
22+
23+
on:
24+
pull_request:
25+
push:
26+
branches:
27+
- main
28+
- develop
29+
30+
jobs:
31+
yaml-lint:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- run: |
37+
docker network create frontend
38+
39+
- run: |
40+
docker compose run --rm prettier '**/*.{yml,yaml}' --check

Taskfile.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# https://taskfile.dev
22

3-
version: '3'
3+
version: "3"
44

55
includes:
66
github-actions: ./task/Taskfile.github-actions.yml
@@ -22,6 +22,7 @@ tasks:
2222
build:
2323
desc: "Build everything"
2424
cmds:
25+
- task: github-actions:config-headers:update
2526
- task: github-actions:template-headers:update
2627
- task: github-actions:documentation:update
2728
- task: github-actions:link

compose.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,14 @@ services:
55
- dev
66
volumes:
77
- ./:/md
8+
9+
prettier:
10+
# Prettier does not (yet, fcf.
11+
# https://github.com/prettier/prettier/issues/15206) have an official
12+
# docker image.
13+
# https://hub.docker.com/r/jauderho/prettier is good candidate (cf. https://hub.docker.com/search?q=prettier&sort=updated_at&order=desc)
14+
image: jauderho/prettier
15+
profiles:
16+
- dev
17+
volumes:
18+
- ./:/work
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# This file is copied from config/symfony/yaml/.prettierrc.yaml in https://github.com/itk-dev/devops_itkdev-docker.
2+
# Feel free to edit the file, but consider making a pull request if you find a general issue with the file.
3+
4+
# https://prettier.io/docs/configuration
5+
overrides:
6+
# Symfony config
7+
- files:
8+
- "config/**/*.{yml,yaml}"
9+
options:
10+
tabWidth: 4
11+
singleQuote: true

docs/github-actions-templates.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- DO NOT EDIT THIS FILE!
22
3-
It was automatically created at 2025-05-20T13:49:11+02:00
3+
It was automatically created at 2025-06-12T14:50:42+02:00
44
by task/scripts/github-documentation-update
55
based on /app/task/scripts/../templates/github-actions-templates.md
66
-->
@@ -299,6 +299,26 @@ Validates Twig files
299299

300300
---
301301

302+
[github/workflows/yaml.yaml](github/workflows/yaml.yaml)
303+
304+
### YAML
305+
306+
Validates YAML files.
307+
308+
#### Assumptions
309+
310+
1. A docker compose service named `prettier` for running
311+
[Prettier](https://prettier.io/) exists.
312+
313+
#### Symfony YAML
314+
315+
Symfony's YAML config files use 4 spaces for indentation and single quotes.
316+
Therefore we use a [Prettier configuration
317+
file](https://prettier.io/docs/configuration), `.prettierrc.yaml`, to make
318+
Prettier format YAML files in the `config/` folder like Symfony expects.
319+
320+
---
321+
302322
## Updating template documentation
303323

304324
To update this document, run

github/workflows/yaml.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Do not edit this file! Make a pull request on changing
2+
# github/workflows/yaml.yaml in
3+
# https://github.com/itk-dev/devops_itkdev-docker if need be.
4+
5+
### ### YAML
6+
###
7+
### Validates YAML files.
8+
###
9+
### #### Assumptions
10+
###
11+
### 1. A docker compose service named `prettier` for running
12+
### [Prettier](https://prettier.io/) exists.
13+
###
14+
### #### Symfony YAML
15+
###
16+
### Symfony's YAML config files use 4 spaces for indentation and single quotes.
17+
### Therefore we use a [Prettier configuration
18+
### file](https://prettier.io/docs/configuration), `.prettierrc.yaml`, to make
19+
### Prettier format YAML files in the `config/` folder like Symfony expects.
20+
21+
name: YAML
22+
23+
on:
24+
pull_request:
25+
push:
26+
branches:
27+
- main
28+
- develop
29+
30+
jobs:
31+
yaml-lint:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- run: |
37+
docker network create frontend
38+
39+
- run: |
40+
docker compose run --rm prettier '**/*.{yml,yaml}' --check

task/Taskfile.github-actions.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '3'
1+
version: "3"
22

33
tasks:
44
documentation:update:
@@ -19,7 +19,7 @@ tasks:
1919
- git diff --exit-code --ignore-blank-lines --ignore-matching-lines='automatically created' '*.md'
2020

2121
documentation:checkout:
22-
desc: 'git checkout all translation file changes if only date metadata is changed'
22+
desc: "git checkout all translation file changes if only date metadata is changed"
2323
cmds:
2424
- git checkout '*.md'
2525
# https://taskfile.dev/reference/schema#precondition
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../github/workflows/yaml.yaml

templates/drupal-10/docker-compose.server.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ services:
5252
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}.entrypoints=websecure"
5353

5454
memcached:
55-
image: 'memcached:latest'
55+
image: "memcached:latest"
5656
restart: unless-stopped
5757
networks:
5858
- app

templates/drupal-10/docker-compose.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ services:
1212
networks:
1313
- app
1414
ports:
15-
- '3306'
15+
- "3306"
1616
healthcheck:
17-
test: [ "CMD", "healthcheck.sh", "--connect", "--innodb_initialized" ]
17+
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
1818
start_period: 10s
1919
interval: 10s
2020
timeout: 5s
@@ -27,7 +27,7 @@ services:
2727
#- ENCRYPT=1 # Uncomment to enable database encryption.
2828
# https://symfony.com/doc/current/setup/symfony_server.html#docker-integration
2929
labels:
30-
com.symfony.server.service-prefix: 'DATABASE'
30+
com.symfony.server.service-prefix: "DATABASE"
3131

3232
phpfpm:
3333
image: itkdev/php8.3-fpm:latest
@@ -62,7 +62,7 @@ services:
6262
depends_on:
6363
- phpfpm
6464
ports:
65-
- '8080'
65+
- "8080"
6666
volumes:
6767
- ./.docker/templates:/etc/nginx/templates:ro
6868
- .:/app
@@ -75,16 +75,16 @@ services:
7575
- "traefik.enable=true"
7676
- "traefik.docker.network=frontend"
7777
- "traefik.http.routers.${COMPOSE_PROJECT_NAME}.rule=Host(`${COMPOSE_DOMAIN}`)"
78-
# HTTPS config - uncomment to enable redirect from :80 to :443
79-
# - "traefik.http.routers.${COMPOSE_PROJECT_NAME}.middlewares=redirect-to-https"
80-
# - "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
78+
# HTTPS config - uncomment to enable redirect from :80 to :443
79+
# - "traefik.http.routers.${COMPOSE_PROJECT_NAME}.middlewares=redirect-to-https"
80+
# - "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
8181

8282
memcached:
8383
image: memcached:alpine
8484
networks:
8585
- app
8686
ports:
87-
- '11211'
87+
- "11211"
8888
healthcheck:
8989
test: echo "version" | nc -vn -w 1 127.0.0.1 11211
9090
interval: 10s

0 commit comments

Comments
 (0)