Skip to content

Commit e83bf18

Browse files
committed
5564: Update itk docker template, update github actions setup
1 parent aa24a1a commit e83bf18

22 files changed

Lines changed: 673 additions & 272 deletions

.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ COMPOSE_PROJECT_NAME=itksites
22
#COMPOSE_DOMAIN=itksites.local.itkdev.dk
33
COMPOSE_DOMAIN=sites.itkdev.dk
44

5+
ITKDEV_TEMPLATE=symfony-6
6+
57
# In all environments, the following files are loaded if they exist,
68
# the latter taking precedence over the former:
79
#

.github/workflows/apispec.yaml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: API Spec review
2+
3+
env:
4+
COMPOSE_USER: root
5+
6+
on:
7+
pull_request:
8+
9+
jobs:
10+
api-spec-updated:
11+
name: Ensure committed API specification is up to date
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v5
16+
with:
17+
fetch-depth: 2
18+
19+
- name: Create docker network
20+
run: |
21+
docker network create frontend
22+
23+
- name: Composer install
24+
run: |
25+
docker compose run --rm phpfpm composer install
26+
27+
- name: Export API specification
28+
run: |
29+
docker compose run --rm phpfpm bin/console api:openapi:export --yaml --output=public/api-spec-v1.yaml --no-interaction
30+
31+
- name: Check for changes in specification
32+
id: git-diff-spec
33+
continue-on-error: true
34+
run: git diff --diff-filter=ACMRT --exit-code public/api-spec-v1.yaml
35+
36+
- name: Comment PR
37+
if: steps.git-diff-spec.outcome == 'failure'
38+
env:
39+
GH_TOKEN: ${{ github.token }}
40+
run: |
41+
echo '## 🛑 Exported API specification file not up to date' > var/comment.md
42+
echo '' >> var/comment.md
43+
echo 'Please run `task api:spec:export` to export the API specification. Then commit and push the changes.' >> var/comment.md
44+
gh pr comment ${{ github.event.pull_request.number }} --body-file var/comment.md --create-if-none --edit-last
45+
46+
- name: Fail job, api spec is not up to date
47+
if: steps.git-diff-spec.outcome == 'failure'
48+
run: |
49+
exit 1
50+
51+
detect-breaking-changes:
52+
name: Detect breaking changes in API specification
53+
runs-on: ubuntu-latest
54+
needs: [api-spec-updated]
55+
steps:
56+
- name: Check out BASE rev
57+
uses: actions/checkout@v5
58+
with:
59+
ref: ${{ github.base_ref }}
60+
path: base
61+
62+
- name: Check out HEAD rev
63+
uses: actions/checkout@v5
64+
with:
65+
ref: ${{ github.head_ref }}
66+
path: head
67+
68+
- name: Run OpenAPI Changed (from HEAD rev)
69+
id: api-changed
70+
continue-on-error: true
71+
uses: docker://openapitools/openapi-diff:latest
72+
with:
73+
args: --fail-on-changed base/public/api-spec-v1.yaml head/public/api-spec-v1.yaml --markdown api-spec-changed.md
74+
75+
- name: Run OpenAPI Incompatible (from HEAD rev)
76+
id: api-incompatible
77+
continue-on-error: true
78+
uses: docker://openapitools/openapi-diff:latest
79+
with:
80+
args: --fail-on-incompatible base/public/api-spec-v1.yaml head/public/api-spec-v1.yaml --markdown api-spec-incompatible.md
81+
82+
- name: Comment PR with no changes
83+
if: steps.api-changed.outcome == 'success' && steps.api-incompatible.outcome == 'success'
84+
working-directory: head
85+
env:
86+
GH_TOKEN: ${{ github.token }}
87+
run: |
88+
gh pr comment ${{ github.event.pull_request.number }} --body "✅ **No changes detected in API specification**" --create-if-none --edit-last
89+
90+
- name: Comment PR with non-breaking changes
91+
if: steps.api-changed.outcome == 'failure' && steps.api-incompatible.outcome == 'success'
92+
working-directory: head
93+
env:
94+
GH_TOKEN: ${{ github.token }}
95+
run: |
96+
echo "## ⚠️ Non-Breaking changes detected in API specification" > ../comment.md
97+
echo "" >> ../comment.md
98+
cat ../api-spec-changed.md >> ../comment.md
99+
gh pr comment ${{ github.event.pull_request.number }} --body-file ../comment.md --create-if-none --edit-last
100+
101+
- name: Comment PR with breaking changes
102+
if: steps.api-incompatible.outcome == 'failure'
103+
working-directory: head
104+
env:
105+
GH_TOKEN: ${{ github.token }}
106+
run: |
107+
echo "## 🛑 Breaking changes detected in API specification" > ../comment.md
108+
echo "" >> ../comment.md
109+
cat ../api-spec-incompatible.md >> ../comment.md
110+
gh pr comment ${{ github.event.pull_request.number }} --body-file ../comment.md --create-if-none --edit-last
111+
112+
- name: Fail if breaking changes detected
113+
if: steps.api-incompatible.outcome == 'failure'
114+
run: |
115+
exit 1

.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@v5
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: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Do not edit this file! Make a pull request on changing
2+
# github/workflows/composer.yaml in
3+
# https://github.com/itk-dev/devops_itkdev-docker if need be.
4+
5+
### ### Composer
6+
###
7+
### Validates composer.json and checks that it's normalized.
8+
###
9+
### #### Assumptions
10+
###
11+
### 1. A docker compose service named `phpfpm` can be run and `composer` can be
12+
### run inside the `phpfpm` service.
13+
### 2. [ergebnis/composer-normalize](https://github.com/ergebnis/composer-normalize)
14+
### is a dev requirement in `composer.json`:
15+
###
16+
### ``` shell
17+
### docker compose run --rm phpfpm composer require --dev ergebnis/composer-normalize
18+
### ```
19+
###
20+
### Normalize `composer.json` by running
21+
###
22+
### ``` shell
23+
### docker compose run --rm phpfpm composer normalize
24+
### ```
25+
26+
name: Composer
27+
28+
env:
29+
COMPOSE_USER: root
30+
31+
on:
32+
pull_request:
33+
push:
34+
branches:
35+
- main
36+
- develop
37+
38+
jobs:
39+
composer-validate:
40+
runs-on: ubuntu-latest
41+
strategy:
42+
fail-fast: false
43+
steps:
44+
- uses: actions/checkout@v5
45+
46+
- name: Create docker network
47+
run: |
48+
docker network create frontend
49+
50+
- run: |
51+
docker compose run --rm phpfpm composer validate --strict
52+
53+
composer-normalized:
54+
runs-on: ubuntu-latest
55+
strategy:
56+
fail-fast: false
57+
steps:
58+
- uses: actions/checkout@v5
59+
60+
- name: Create docker network
61+
run: |
62+
docker network create frontend
63+
64+
- run: |
65+
docker compose run --rm phpfpm composer install
66+
docker compose run --rm phpfpm composer normalize --dry-run
67+
68+
composer-audit:
69+
runs-on: ubuntu-latest
70+
strategy:
71+
fail-fast: false
72+
steps:
73+
- uses: actions/checkout@v5
74+
75+
- name: Create docker network
76+
run: |
77+
docker network create frontend
78+
79+
- run: |
80+
docker compose run --rm phpfpm composer audit

.github/workflows/doctrine.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Doctrine
2+
3+
env:
4+
COMPOSE_USER: root
5+
6+
on:
7+
pull_request:
8+
push:
9+
branches:
10+
- main
11+
- develop
12+
13+
jobs:
14+
coding-standards:
15+
name: Validate Schema
16+
runs-on: ubuntu-latest
17+
env:
18+
APP_ENV: prod
19+
20+
steps:
21+
- uses: actions/checkout@v5
22+
23+
- name: Create docker network
24+
run: |
25+
docker network create frontend
26+
27+
- name: Run Composer Install
28+
run: |
29+
docker compose run --rm phpfpm composer install
30+
31+
- name: Run Doctrine Migrations
32+
run: |
33+
docker compose run --rm phpfpm bin/console doctrine:migrations:migrate --no-interaction
34+
35+
- name: Setup messenger "failed" doctrine transport to ensure db schema is updated
36+
run: |
37+
docker compose run --rm phpfpm bin/console messenger:setup-transports failed
38+
39+
- name: Validate Doctrine schema
40+
run: |
41+
docker compose run --rm phpfpm bin/console doctrine:schema:validate

.github/workflows/github_build_release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
APP_ENV: prod
1717
steps:
1818
- name: Checkout
19-
uses: actions/checkout@v4
19+
uses: actions/checkout@v5
2020

2121
- name: Composer install
2222
run: |

.github/workflows/javascript.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Do not edit this file! Make a pull request on changing
2+
# github/workflows/symfony/javascript.yaml in
3+
# https://github.com/itk-dev/devops_itkdev-docker if need be.
4+
5+
### ### Symfony JavaScript (and TypeScript)
6+
###
7+
### Validates JavaScript files.
8+
###
9+
### #### Assumptions
10+
###
11+
### 1. A docker compose service named `prettier` for running
12+
### [Prettier](https://prettier.io/) exists.
13+
14+
name: JavaScript
15+
16+
on:
17+
pull_request:
18+
push:
19+
branches:
20+
- main
21+
- develop
22+
23+
jobs:
24+
javascript-lint:
25+
runs-on: ubuntu-latest
26+
strategy:
27+
fail-fast: false
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v5
31+
32+
- name: Create docker network
33+
run: |
34+
docker network create frontend
35+
36+
- run: |
37+
docker compose run --rm prettier 'assets/**/*.js' --check

.github/workflows/markdown.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Do not edit this file! Make a pull request on changing
2+
# github/workflows/markdown.yaml in
3+
# https://github.com/itk-dev/devops_itkdev-docker if need be.
4+
5+
### ### Markdown
6+
###
7+
### Lints Markdown files (`**/*.md`) in the project.
8+
###
9+
### [markdownlint-cli configuration
10+
### files](https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#configuration),
11+
### `.markdownlint.jsonc` and `.markdownlintignore`, control what is actually
12+
### linted and how.
13+
###
14+
### #### Assumptions
15+
###
16+
### 1. A docker compose service named `markdownlint` for running `markdownlint`
17+
### (from
18+
### [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli))
19+
### exists.
20+
21+
name: Markdown
22+
23+
on:
24+
pull_request:
25+
push:
26+
branches:
27+
- main
28+
- develop
29+
30+
jobs:
31+
markdown-lint:
32+
runs-on: ubuntu-latest
33+
strategy:
34+
fail-fast: false
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v5
38+
39+
- name: Create docker network
40+
run: |
41+
docker network create frontend
42+
43+
- run: |
44+
docker compose run --rm markdownlint markdownlint '**/*.md'

0 commit comments

Comments
 (0)