Skip to content

Commit db03311

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

21 files changed

+413
-5
lines changed

.github/workflows/documentation.yaml

+23
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

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.task

README.md

+9-4
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
```
@@ -112,13 +113,15 @@ LOCAL_PATH='sites/default/files'
112113

113114
## SSL certification support
114115

115-
This setup comes with self-signed wildcard certificates for *.local.itkdev.dk, but other certificates can be generated by using this openssl command on Mac, just change the two places where the domain is written.
116+
This setup comes with self-signed wildcard certificates for *.local.itkdev.dk, but other certificates can be generated
117+
by using this openssl command on Mac, just change the two places where the domain is written.
116118

117119
```sh
118120
openssl req -x509 -sha256 -nodes -days 3650 -newkey rsa:2048 -keyout docker.key -out docker.crt -subj "/CN=*.local.itkdev.dk" -reqexts SAN -extensions SAN -config <(cat /usr/local/etc/openssl/openssl.cnf <(printf '[SAN]\nsubjectAltName=DNS:*.local.itkdev.dk'))
119121
```
120122

121-
To mac browser trust this certificate you need to open it with key-chain right click and select "Get info" and then open the "Trust" tab and select "Always trust".
123+
To mac browser trust this certificate you need to open it with key-chain right click and select "Get info" and then open
124+
the "Trust" tab and select "Always trust".
122125

123126
The certificate is located in `./treafik/ssl/docker.crt` in this repository.
124127

@@ -158,17 +161,19 @@ The fuld list can be found at
158161
[https://hub.docker.com/search?q=itkdev&type=image](https://hub.docker.com/search?q=itkdev&type=image).
159162

160163
## More
161-
For more details about usage see https://docs.itkdev.dk
164+
165+
For more details about usage see <https://docs.itkdev.dk>
162166

163167
## Previous versions
164168

165169
### NFS mounts removed
166170

167171
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)
172+
because it is no longer compatible with MacOS. (@see <https://github.com/docker/for-mac/issues/6544>)
169173

170174
If you have previously enabled NFS with `nfs:enable` you should clean up as
171175
follows:
176+
172177
```shell
173178
sudo nano /etc/exports
174179
# Delete the line matching this pattern, and save you changes

Taskfile.yml

+52
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
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+
}
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

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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/drupal.yaml](github/workflows/drupal.yaml)
46+
47+
## Drupal
48+
49+
Checks that site can be installed and can be updated (from base branch on
50+
pull request).
51+
52+
### Assumptions
53+
54+
1. A docker compose service named `phpfpm` can be run and `composer` can be
55+
run inside the `phpfpm` service.
56+
2. The Drupal site can be installed from existing config.
57+
58+
---
59+
60+
[github/workflows/markdown.yaml](github/workflows/markdown.yaml)
61+
62+
## Markdown
63+
64+
Uses [itkdev/markdownlint](https://hub.docker.com/r/itkdev/markdownlint) to
65+
link all Markdown files (`**/*.md`) in the project.
66+
67+
[markdownlint-cli configuration ### files](https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#configuration),
68+
`.markdownlint.jsonc` and `.markdownlintignore` control what is actually linted and how.

github/workflows/changelog.yaml

+29
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

+51
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

0 commit comments

Comments
 (0)