Skip to content

Workflow documentation #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 34 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0d04d02
Added GitHub Actions templates and tool configuration files
rimi-itk Mar 18, 2025
fd81234
Taking own medicine
rimi-itk Mar 19, 2025
5a1752c
Update github/workflows/composer.yaml
rimi-itk Mar 24, 2025
6366b2e
Update github/workflows/drupal.yaml
rimi-itk Mar 24, 2025
f67e9ae
Update config/markdownlint-cli/.markdownlintignore
rimi-itk Mar 24, 2025
32774ad
Update github/workflows/composer.yaml
rimi-itk Mar 24, 2025
678951b
Updated generated documentation
rimi-itk Mar 24, 2025
a42cb1f
Added and checked file headers
rimi-itk Mar 24, 2025
ef8d484
Updated Markdown actions
rimi-itk Mar 24, 2025
8bc03ac
Run docker image as appropriate user
rimi-itk Mar 24, 2025
9f892de
Cleaned up and improved
rimi-itk Apr 2, 2025
83a9b6e
More clean up
rimi-itk Apr 8, 2025
cc5a513
Added config file headers
rimi-itk Apr 8, 2025
c07e6bb
Cleaned up tasks and shell scripts
rimi-itk Apr 8, 2025
c601873
Updated GitHub Actions template documentation
rimi-itk Apr 8, 2025
6610aee
More documentation and cleanup
rimi-itk Apr 9, 2025
7996f37
Added branches to on.push event
rimi-itk Apr 23, 2025
fb1efe1
Added Drupal styles workflow
rimi-itk May 2, 2025
2281239
Checked YAML files
rimi-itk May 2, 2025
f23708d
Cleaned up
rimi-itk May 2, 2025
12386c3
Updated workflow files
rimi-itk May 2, 2025
e0589c1
Added Drupal JavaScript workflow
rimi-itk May 5, 2025
c01409a
Updated links
rimi-itk May 5, 2025
1093f59
Added shellckeck to workflo
rimi-itk May 5, 2025
917b114
Updated Markdownlint ignores
rimi-itk May 6, 2025
b53a8fc
Run markdownlint via docker compose
rimi-itk May 6, 2025
042a574
Updated Symfony workflows
rimi-itk May 7, 2025
4e7507e
Cleaned up Markdown
rimi-itk May 8, 2025
6410ee1
Added project workflow documentation
rimi-itk May 8, 2025
b52e940
Cleaned up
rimi-itk May 8, 2025
d0d54ce
Action debugging
rimi-itk May 8, 2025
f6eec27
Moved workflow documentaion
rimi-itk May 8, 2025
cd30e87
Changed markdownlint image
rimi-itk May 8, 2025
6f48820
Sorted workflow files
rimi-itk May 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
on: pull_request

name: Review

env:
COMPOSE_USER: runner

jobs:
check-github-actions-documentation:
runs-on: ubuntu-latest
name: Check that Github Actions documentation is up to date
steps:
- uses: actions/checkout@v4
- uses: arduino/setup-task@v2
# https://github.com/arduino/setup-task/tree/56d0cc033e3cecc5f07a291fdd39f29388d21800?tab=readme-ov-file#repo-token
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

# https://github.com/mxschmitt/action-tmate?tab=readme-ov-file#manually-triggered-debug
# Enable tmate debugging if debug logging is enabled (cf.
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#runner-context)
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: 1 == runner.debug

- run: |
task github-actions:documentation:update

# Check that documentation has not changed.
- run: |
task github-actions:documentation:diff

check-github-actions-template-headers:
runs-on: ubuntu-latest
name: Check that Github Actions template headers are up to date
steps:
- uses: actions/checkout@v4
- uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: |
task github-actions:template-headers:update --yes
# Check that files have not changed.
- run: |
git diff --exit-code

check-config-file-headers:
runs-on: ubuntu-latest
name: Check that config file headers are up to date
steps:
- uses: actions/checkout@v4
- uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: |
task github-actions:config-headers:update --yes
# Check that files have not changed.
- run: |
git diff --exit-code

check-links:
runs-on: ubuntu-latest
name: Check that workflow and config file links are up to date
steps:
- uses: actions/checkout@v4
- uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

# https://github.com/mxschmitt/action-tmate?tab=readme-ov-file#manually-triggered-debug
# Enable tmate debugging if debug logging is enabled (cf.
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#runner-context)
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: 1 == runner.debug

- run: |
task github-actions:link --yes
# Check that files have not changed.
- run: |
git diff --exit-code

lint-markdown:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: |
SKIP_FIX=1 task lint:markdown

lint-shell-script:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: |
SKIP_FIX=1 task lint:shell-script

lint-yaml:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: |
SKIP_FIX=1 task lint:yaml
43 changes: 43 additions & 0 deletions .github/workflows/markdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Do not edit this file! Make a pull request on changing
# github/workflows/markdown.yaml in
# https://github.com/itk-dev/devops_itkdev-docker if need be.

### ### Markdown
###
### Lints Markdown files (`**/*.md`) in the project.
###
### [markdownlint-cli configuration
### files](https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#configuration),
### `.markdownlint.jsonc` and `.markdownlintignore`, control what is actually
### linted and how.
###
### #### Assumptions
###
### 1. A docker compose service named `markdownlint` for running `markdownlint`
### (from
### [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli))
### exists.

name: Markdown

on:
pull_request:
push:
branches:
- main
- develop

jobs:
markdown-lint:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4

- run: |
docker network create frontend

- run: |
docker compose run --rm markdownlint markdownlint '**/*.md'
26 changes: 26 additions & 0 deletions .github/workflows/workflow-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
on: pull_request

name: Workflow templates

jobs:
check-yaml:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- run: |
docker pull mikefarah/yq
for f in $(find github/workflows/ -name '*.yaml'); do
docker run --rm --volume "$PWD":/workdir mikefarah/yq "$f" > /dev/null
done

shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- run: |
task lint:shell-script
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.task
19 changes: 19 additions & 0 deletions .markdownlint.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// markdownlint-cli configuration file (cf. https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#configuration)
{
"default": true,
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md013.md
"line-length": {
"line_length": 120,
"code_blocks": false,
"tables": false
},
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md024.md
"no-duplicate-heading": {
"siblings_only": true
},
// https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-collapsed-sections#creating-a-collapsed-section
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md033.md
"no-inline-html": {
"allowed_elements": ["details", "summary"]
}
}
8 changes: 8 additions & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#ignoring-files
vendor/
node_modules/
LICENSE.md
# Drupal
web/*.md
web/core/
web/*/contrib/
27 changes: 19 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,28 @@ __Note__: You have to follow the instructions brew writes to get it working (use
If you use the [Dory](https://github.com/FreedomBen/dory) revers proxy required to
run DDF CMS unmodified you need to install dory. We only use dory for DPL/DDF shared
projects (multi supplier projects).

```sh
brew install dory
```

### Templates

The [`templates`](templates/) directory contains templates for adding
the itkdev `docker-compose` setup to new or exiting projects.
the itkdev `docker compose` setup to new or exiting projects.

Run

```sh
rsync -avz templates/<TYPE>/ <PATH TO HTDOCS FOLDER>
itkdev-docker-compose template:install --list
```

Also create an `.env` file beside the `docker-compose.yml` file that contains
`COMPOSE_PROJECT_NAME=<NAME>` to namespace the docker setup for the projekt.
to see a list of all templates.

Run `itkdev-docker-compose template:install drupal-10`, say, to install or update a template in a project.

In addition to the docker compose setup for our projects, installing a template will also add GitHib Actions workflow
files to a project; see [Github Actions templates](docs/github-actions-templates.md) for details.

### Docker commands

Expand Down Expand Up @@ -112,13 +119,15 @@ LOCAL_PATH='sites/default/files'

## SSL certification support

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.
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.

```sh
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'))
```

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".
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".

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

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

## More
For more details about usage see https://docs.itkdev.dk

For more details about usage see <https://docs.itkdev.dk>

## Previous versions

### NFS mounts removed

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

If you have previously enabled NFS with `nfs:enable` you should clean up as
follows:

```shell
sudo nano /etc/exports
# Delete the line matching this pattern, and save you changes
Expand Down
69 changes: 69 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# https://taskfile.dev

version: '3'

includes:
github-actions: ./task/Taskfile.github-actions.yml

vars:
GITHUB_ACTIONS_TEMPLATES_HEADER: |
# Github Actions templates

This repository contains a number of [GitHub
Actions](https://docs.github.com/en/actions) workflow template files that
are copied to a project when running `itkdev-docker-compose
template:install`. Any changes to the workflows should be made in [this
repository](%THIS_REPOSITORY%) and then the project template must be updated
to match the new templates.

GITHUB_ACTIONS_TEMPLATES_FOOTER: |

tasks:
build:
desc: "Build everything"
cmds:
- task: github-actions:template-headers:update
- task: github-actions:documentation:update
- task: github-actions:link
- task: lint:markdown
- task: lint:yaml

lint:markdown:
desc: "Lint Markdown"
cmds:
- '[[ -n "$SKIP_FIX" ]] || {{.MARKDOWNLINT_COMMAND}} --fix'
- '{{.MARKDOWNLINT_COMMAND}}'
vars:
# We use a block scalar (https://yaml-multiline.info/#block-scalars) here to make escaping (a little) easier.
GLOB: >-
{{.CLI_ARGS | default "'**/*.md'"}}
# I don't (yet) know why, but `itkdev/markdownlint` has an issue with
# permissions when running in GitHub Actions. Therefore we use
# `peterdavehello/markdownlint`
# (https://hub.docker.com/r/peterdavehello/markdownlint)
MARKDOWNLINT_COMMAND: >-
docker run --rm --volume "$PWD":/md peterdavehello/markdownlint markdownlint --dot {{.GLOB}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to look into this!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, or just use peterdavehello/markdownlint (https://github.com/PeterDaveHello/docker-markdownlint). We only use it to lint Markdown and we don't do that our our servers, so I don't really understand why we need our own image – I suppose it has something to do with security.


lint:shell-script:
desc: "Lint shell scripts"
cmds:
# https://github.com/koalaman/shellcheck?tab=readme-ov-file#installing
- docker run --rm --volume "$PWD:"/mnt koalaman/shellcheck:stable {{.GLOB}}
vars:
# We use a block scalar (https://yaml-multiline.info/#block-scalars) here to make escaping (a little) easier.
GLOB: >-
{{.CLI_ARGS | default "task/scripts/*"}}

lint:yaml:
desc: "Lint YAML"
cmds:
- |
# docker pull mikefarah/yq
for f in $(find github/workflows/ -name '*.yaml'); do
docker run --rm --volume "$PWD":/workdir mikefarah/yq "$f" > /dev/null
done

default:
cmds:
- task --list
silent: true
16 changes: 16 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
services:
markdownlint:
image: itkdev/markdownlint
profiles:
- dev
volumes:
- ./:/md

jinja2-cli:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this used for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's used to generate the README.workflows.md files from task/Taskfile.github-actions.yml.

# https://hub.docker.com/r/roquie/docker-jinja2-cli
# Is https://hub.docker.com/r/stagex/user-py-jinja2 a better choice?
image: roquie/docker-jinja2-cli
profiles:
- dev
volumes:
- ./:/app
Loading