Skip to content

Commit cceedb8

Browse files
committed
Added GitHub Actions templates and tool configuration files
1 parent 19062dc commit cceedb8

File tree

16 files changed

+276
-3
lines changed

16 files changed

+276
-3
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
on: pull_request
2+
name: Review
3+
jobs:
4+
check-github-actions-documentation:
5+
runs-on: ubuntu-latest
6+
name: Check that Github Actions documentation is up to date
7+
steps:
8+
- uses: actions/checkout@v4
9+
- uses: arduino/setup-task@v2
10+
- run: |
11+
task github-actions:documentation:update
12+
# Check that nothing has changed.
13+
- run: |
14+
git diff --exit-code docs/github-action-templates.md
15+
16+
lint-markdown:
17+
runs-on: ubuntu-latest
18+
name: Lint Markdown
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: arduino/setup-task@v2
22+
- run: |
23+
task lint:markdown

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.task

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ __Note__: You have to follow the instructions brew writes to get it working (use
3939
If you use the [Dory](https://github.com/FreedomBen/dory) revers proxy required to
4040
run DDF CMS unmodified you need to install dory. We only use dory for DPL/DDF shared
4141
projects (multi supplier projects).
42+
4243
```sh
4344
brew install dory
4445
```
@@ -158,17 +159,19 @@ The fuld list can be found at
158159
[https://hub.docker.com/search?q=itkdev&type=image](https://hub.docker.com/search?q=itkdev&type=image).
159160

160161
## More
161-
For more details about usage see https://docs.itkdev.dk
162+
163+
For more details about usage see <https://docs.itkdev.dk>
162164

163165
## Previous versions
164166

165167
### NFS mounts removed
166168

167169
From version 3.0.0 the feature to use NFS mounted name-volumes has been removed
168-
because it is no longer compatible with MacOS. (@see https://github.com/docker/for-mac/issues/6544)
170+
because it is no longer compatible with MacOS. (@see <https://github.com/docker/for-mac/issues/6544>)
169171

170172
If you have previously enabled NFS with `nfs:enable` you should clean up as
171173
follows:
174+
172175
```shell
173176
sudo nano /etc/exports
174177
# Delete the line matching this pattern, and save you changes

Taskfile.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# https://taskfile.dev
2+
3+
version: '3'
4+
5+
vars:
6+
GITHUB_ACTIONS_TEMPLATES_HEADER: |
7+
# Github Actions templates
8+
9+
This repository contains a number of [GitHub
10+
Actions](https://docs.github.com/en/actions) workflow template files that
11+
are copied to a project when running `itkdev-docker-compose
12+
template:install`. Any changes to the workflows should be made in [this
13+
repository](%THIS_REPOSITORY%) and then the project template must be updated
14+
to match the new templates.
15+
16+
GITHUB_ACTIONS_TEMPLATES_FOOTER: |
17+
18+
tasks:
19+
github-actions:documentation:update:
20+
desc: "Update GitHub Actions template documentation"
21+
sources:
22+
- github/workflows/*.yaml
23+
generates:
24+
- docs/github-action-templates.md
25+
cmds:
26+
- mkdir -p docs
27+
- |
28+
echo '{{.GITHUB_ACTIONS_TEMPLATES_HEADER}}' > docs/github-action-templates.md
29+
- |
30+
for f in github/workflows/*.yaml; do
31+
echo "" >> docs/github-action-templates.md
32+
echo "---" >> docs/github-action-templates.md
33+
echo "" >> docs/github-action-templates.md
34+
35+
echo "[$f]($f)" >> docs/github-action-templates.md
36+
37+
cat "$f" | grep -E '^###( |$)' | sed -E -e 's/^### ?//' >> docs/github-action-templates.md
38+
done
39+
- |
40+
echo "{{.GITHUB_ACTIONS_TEMPLATES_FOOTER}}" >> docs/github-action-templates.md
41+
42+
lint:markdown:
43+
desc: "Lint Markdown"
44+
cmds:
45+
# itkdev/markdownlint does not support `--ignore-path`
46+
- docker run --rm --volume "$PWD":/md peterdavehello/markdownlint markdownlint --config config/markdownlint-cli/.markdownlint.jsonc --ignore-path config/markdownlint-cli/.markdownlintignore '**/*.md' --fix
47+
- docker run --rm --volume "$PWD":/md peterdavehello/markdownlint markdownlint --config config/markdownlint-cli/.markdownlint.jsonc --ignore-path config/markdownlint-cli/.markdownlintignore '**/*.md'
48+
49+
default:
50+
cmds:
51+
- task --list
52+
silent: true
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// markdownlint-cli configuration file (cf. https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#configuration)
2+
{
3+
"default": true,
4+
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md013.md
5+
"line-length": {
6+
"line_length": 120,
7+
"code_blocks": false,
8+
"tables": false
9+
},
10+
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md024.md
11+
"no-duplicate-heading": {
12+
"siblings_only": true
13+
},
14+
// https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-collapsed-sections#creating-a-collapsed-section
15+
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md033.md
16+
"no-inline-html": {
17+
"allowed_elements": ["details", "summary"]
18+
}
19+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#ignoring-files
2+
vendor/
3+
node_modules/
4+
5+
# Drupal
6+
web/*.md
7+
web/core/
8+
web/*/contrib/

docs/github-action-templates.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Github Actions templates
2+
3+
This repository contains a number of [GitHub
4+
Actions](https://docs.github.com/en/actions) workflow template files that
5+
are copied to a project when running `itkdev-docker-compose
6+
template:install`. Any changes to the workflows should be made in [this
7+
repository](%THIS_REPOSITORY%) and then the project template must be updated
8+
to match the new templates.
9+
10+
---
11+
12+
[github/workflows/changelog.yaml](github/workflows/changelog.yaml)
13+
14+
## Changelog
15+
16+
Checks that changelog has been updated
17+
18+
---
19+
20+
[github/workflows/composer.yaml](github/workflows/composer.yaml)
21+
22+
## Composer
23+
24+
Validates composer.json and checks that it's normalized.
25+
26+
### Assumptions
27+
28+
1. A docker compose service named `phpfpm` can be run and `composer` can be
29+
run inside the `phpfpm` service.
30+
2. [ergebnis/composer-normalize](https://github.com/ergebnis/composer-normalize)
31+
is a dev requirement in `composer.json`:
32+
33+
``` shell
34+
docker compose run --rm phpfpm composer require --dev ergebnis/composer-normalize
35+
```
36+
37+
Normalize `composer.json` by running
38+
39+
``` shell
40+
docker compose run --rm phpfpm composer normalize
41+
```
42+
43+
---
44+
45+
[github/workflows/markdown.yaml](github/workflows/markdown.yaml)
46+
47+
## Markdown
48+
49+
Uses [itkdev/markdownlint](https://hub.docker.com/r/itkdev/markdownlint) to
50+
link all Markdown files (`**/*.md`) in the project.
51+
52+
Add [markdownlint-cli configuration
53+
files](https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#configuration),
54+
`.markdownlint.jsonc` and `.markdownlintignore` control what is actually
55+
linted and how.

github/workflows/changelog.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Do not edit this file! Make a pull request on changing
2+
# github/workflows/changelog.yaml in
3+
# https://github.com/itk-dev/devops_itkdev-docker if need be.
4+
5+
### ## Changelog
6+
###
7+
### Checks that changelog has been updated
8+
9+
name: Changelog
10+
11+
on:
12+
pull_request:
13+
14+
jobs:
15+
changelog:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: false
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 2
24+
25+
- name: Git fetch
26+
run: git fetch
27+
28+
- name: Check that changelog has been updated.
29+
run: git diff --exit-code origin/${{ github.base_ref }} -- CHANGELOG.md && exit 1 || exit 0

github/workflows/composer.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
### ## Composer
2+
###
3+
### Validates composer.json and checks that it's normalized.
4+
###
5+
### ### Assumptions
6+
###
7+
### 1. A docker compose service named `phpfpm` can be run and `composer` can be
8+
### run inside the `phpfpm` service.
9+
### 2. [ergebnis/composer-normalize](https://github.com/ergebnis/composer-normalize)
10+
### is a dev requirement in `composer.json`:
11+
###
12+
### ``` shell
13+
### docker compose run --rm phpfpm composer require --dev ergebnis/composer-normalize
14+
### ```
15+
###
16+
### Normalize `composer.json` by running
17+
###
18+
### ``` shell
19+
### docker compose run --rm phpfpm composer normalize
20+
### ```
21+
22+
name: Composer
23+
24+
env:
25+
COMPOSE_USER: root
26+
27+
on:
28+
pull_request:
29+
push:
30+
31+
jobs:
32+
composer-validate:
33+
runs-on: ubuntu-latest
34+
strategy:
35+
fail-fast: false
36+
steps:
37+
- uses: actions/checkout@v4
38+
- run: |
39+
docker network create frontend
40+
docker compose run --rm phpfpm composer validate
41+
42+
composer-normalized:
43+
runs-on: ubuntu-latest
44+
strategy:
45+
fail-fast: false
46+
steps:
47+
- uses: actions/checkout@v4
48+
- run: |
49+
docker network create frontend
50+
docker compose run --rm phpfpm composer install
51+
docker compose run --rm phpfpm composer normalize --dry-run

github/workflows/markdown.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
### ## Markdown
2+
###
3+
### Uses [itkdev/markdownlint](https://hub.docker.com/r/itkdev/markdownlint) to
4+
### link all Markdown files (`**/*.md`) in the project.
5+
###
6+
### [markdownlint-cli configuration ### files](https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#configuration),
7+
### `.markdownlint.jsonc` and `.markdownlintignore` control what is actually linted and how.
8+
9+
name: Markdown
10+
11+
on:
12+
pull_request:
13+
push:
14+
15+
jobs:
16+
markdown-lint:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: false
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- run: |
25+
docker run --rm --volume "$PWD":/md itkdev/markdownlint '**/*.md'

0 commit comments

Comments
 (0)