Skip to content

Commit a555524

Browse files
authored
Merge pull request #63 from itk-dev/feature/6654_symfony_upgrade
Feature/6654 symfony upgrade
2 parents 072186c + 82d7030 commit a555524

131 files changed

Lines changed: 6166 additions & 3564 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.docker/data/.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Ignore everything in this directory
22
*
3-
# Except this file
3+
# Except
44
!.gitignore
5-
!Readme.md
5+
!README.md

.docker/nginx.conf

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ http {
1717
include /etc/nginx/mime.types;
1818
default_type application/octet-stream;
1919

20-
set_real_ip_from 172.16.0.0/16;
21-
real_ip_recursive on;
22-
real_ip_header X-Forwarded-For;
20+
# Note: set_real_ip_from is set in the server block
2321

2422
log_format main '$http_x_real_ip - $remote_user [$time_local] "$request" '
2523
'$status $body_bytes_sent "$http_referer" '

.docker/templates/default.conf.template

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,20 @@ server {
66

77
client_max_body_size ${NGINX_MAX_BODY_SIZE};
88

9-
# This also needs to be set in the single server tag and not only in http.
109
set_real_ip_from 172.16.0.0/16;
10+
set_real_ip_from 192.168.39.0/24;
1111
real_ip_recursive on;
1212
real_ip_header X-Forwarded-For;
1313

14+
location = /cron-metrics {
15+
# Proxy to supercronic metrics
16+
proxy_pass http://${NGINX_CRON_METRICS}/metrics;
17+
proxy_set_header Host $host;
18+
proxy_set_header X-Real-IP $remote_addr;
19+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
20+
proxy_set_header X-Forwarded-Proto $scheme;
21+
}
22+
1423
location / {
1524
# try to serve file directly, fallback to index.php
1625
try_files $uri /index.php$is_args$args;

.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
COMPOSE_PROJECT_NAME=itksites
2-
#COMPOSE_DOMAIN=itksites.local.itkdev.dk
3-
COMPOSE_DOMAIN=sites.itkdev.dk
2+
COMPOSE_DOMAIN=itksites.local.itkdev.dk
3+
ITKDEV_TEMPLATE=symfony-8
44

55
# In all environments, the following files are loaded if they exist,
66
# the latter taking precedence over the former:

.github/workflows/api-spec.yaml

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
name: API Specification
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "src/**/*.php"
7+
- "config/**"
8+
- "composer.json"
9+
- "composer.lock"
10+
- "public/api-spec-v1.yaml"
11+
- "public/api-spec-v1.json"
12+
- "docker-compose.yml"
13+
14+
env:
15+
COMPOSE_USER: runner
16+
17+
jobs:
18+
api-spec-export:
19+
name: Ensure API specification is up to date
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v6
24+
25+
- name: Create docker network
26+
run: docker network create frontend
27+
28+
# https://taskfile.dev/installation/#github-actions
29+
- uses: go-task/setup-task@v1
30+
31+
- name: Export API specification
32+
run: |
33+
task site:update
34+
task api:spec:export
35+
36+
- name: Check for uncommitted changes
37+
id: git-diff-spec
38+
continue-on-error: true
39+
run: |
40+
git diff --diff-filter=ACMRT --exit-code public/api-spec-v1.yaml public/api-spec-v1.json
41+
42+
- name: Comment PR if spec is outdated
43+
if: steps.git-diff-spec.outcome == 'failure'
44+
env:
45+
GH_TOKEN: ${{ github.token }}
46+
run: |
47+
gh pr comment ${{ github.event.pull_request.number }} \
48+
--body "$(cat <<'EOF'
49+
## API specification not up to date
50+
51+
The committed API specification files do not match the exported output.
52+
53+
Please run the following command, then commit and push the changes:
54+
55+
```shell
56+
docker compose exec phpfpm composer update-api-spec
57+
```
58+
EOF
59+
)" \
60+
--create-if-none --edit-last
61+
62+
- name: Fail if spec is outdated
63+
if: steps.git-diff-spec.outcome == 'failure'
64+
run: exit 1
65+
66+
api-spec-breaking-changes:
67+
name: Detect breaking changes in API specification
68+
runs-on: ubuntu-latest
69+
needs: [api-spec-export]
70+
permissions:
71+
pull-requests: write
72+
steps:
73+
- name: Checkout
74+
uses: actions/checkout@v6
75+
76+
- name: Fetch base branch for comparison
77+
run: git fetch --depth=1 origin ${{ github.base_ref }}
78+
79+
- name: Detect breaking changes
80+
id: breaking
81+
continue-on-error: true
82+
uses: oasdiff/oasdiff-action/breaking@main
83+
with:
84+
base: "origin/${{ github.base_ref }}:public/api-spec-v1.yaml"
85+
revision: "public/api-spec-v1.yaml"
86+
fail-on: ERR
87+
88+
- name: Generate changelog
89+
id: changelog
90+
continue-on-error: true
91+
uses: oasdiff/oasdiff-action/changelog@main
92+
with:
93+
base: "origin/${{ github.base_ref }}:public/api-spec-v1.yaml"
94+
revision: "public/api-spec-v1.yaml"
95+
format: markdown
96+
output-to-file: changelog.md
97+
98+
- name: Comment PR - no changes
99+
if: steps.breaking.outcome == 'success' && hashFiles('changelog.md') == ''
100+
env:
101+
GH_TOKEN: ${{ github.token }}
102+
run: |
103+
gh pr comment ${{ github.event.pull_request.number }} \
104+
--body "## API Specification
105+
106+
No changes detected in API specification." \
107+
--create-if-none --edit-last
108+
109+
- name: Comment PR - non-breaking changes
110+
if: steps.breaking.outcome == 'success' && hashFiles('changelog.md') != ''
111+
env:
112+
GH_TOKEN: ${{ github.token }}
113+
run: |
114+
{
115+
echo "## API Specification - Non-breaking changes"
116+
echo ""
117+
cat changelog.md
118+
} > comment.md
119+
gh pr comment ${{ github.event.pull_request.number }} \
120+
--body-file comment.md \
121+
--create-if-none --edit-last
122+
123+
- name: Comment PR - breaking changes
124+
if: steps.breaking.outcome == 'failure'
125+
env:
126+
GH_TOKEN: ${{ github.token }}
127+
run: |
128+
{
129+
echo "## API Specification - Breaking changes detected"
130+
echo ""
131+
if [ -s changelog.md ]; then
132+
cat changelog.md
133+
else
134+
echo "The breaking changes action detected incompatible changes. Review the action logs for details."
135+
fi
136+
} > comment.md
137+
gh pr comment ${{ github.event.pull_request.number }} \
138+
--body-file comment.md \
139+
--create-if-none --edit-last
140+
141+
- name: Fail if breaking changes detected
142+
if: steps.breaking.outcome == 'failure'
143+
run: exit 1

.github/workflows/changelog.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v6
20+
with:
21+
fetch-depth: 2
22+
23+
- name: Git fetch
24+
run: git fetch
25+
26+
- name: Check that changelog has been updated.
27+
run: git diff --exit-code origin/${{ github.base_ref }} -- CHANGELOG.md && exit 1 || exit 0

.github/workflows/composer.yaml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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: runner
30+
31+
on:
32+
pull_request:
33+
paths: &paths
34+
- "composer.json"
35+
- "composer.lock"
36+
- "docker-compose.yml"
37+
push:
38+
branches:
39+
- main
40+
- develop
41+
paths: *paths
42+
43+
jobs:
44+
composer-validate:
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v6
48+
49+
- name: Create docker network
50+
run: |
51+
docker network create frontend
52+
53+
- run: |
54+
docker compose run --rm phpfpm composer validate --strict
55+
56+
composer-normalized:
57+
runs-on: ubuntu-latest
58+
steps:
59+
- uses: actions/checkout@v6
60+
61+
- name: Create docker network
62+
run: |
63+
docker network create frontend
64+
65+
- run: |
66+
docker compose run --rm phpfpm composer install
67+
docker compose run --rm phpfpm composer normalize --dry-run
68+
69+
composer-audit:
70+
runs-on: ubuntu-latest
71+
steps:
72+
- uses: actions/checkout@v6
73+
74+
- name: Create docker network
75+
run: |
76+
docker network create frontend
77+
78+
- run: |
79+
docker compose run --rm phpfpm composer audit
Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
11
on:
2-
push:
3-
tags:
4-
- '*.*.*'
2+
push:
3+
tags:
4+
- "*.*.*"
55

66
name: Create Github Release
77

88
permissions:
9-
contents: write
9+
contents: write
1010

1111
jobs:
12-
create-release:
13-
runs-on: ubuntu-latest
14-
env:
15-
COMPOSER_ALLOW_SUPERUSER: 1
16-
APP_ENV: prod
17-
steps:
18-
- name: Checkout
19-
uses: actions/checkout@v4
20-
21-
- name: Composer install
22-
run: |
23-
docker network create frontend
24-
docker compose run --rm --user=root --env APP_ENV=prod phpfpm composer install --no-dev -o --classmap-authoritative
25-
docker compose run --rm --user=root --env APP_ENV=prod phpfpm composer clear-cache
26-
docker compose run --rm node yarn install
27-
docker compose run --rm node yarn build
28-
29-
- name: Make assets dir
30-
run: |
31-
mkdir -p ../assets
32-
33-
- name: Create archive
34-
run: tar --exclude='.git' --exclude='node_modules' -zcf ../assets/${{ github.event.repository.name }}-${{ github.ref_name }}.tar.gz ./
35-
36-
- name: Create checksum
37-
run: |
38-
cd ../assets
39-
sha256sum ${{ github.event.repository.name }}-${{ github.ref_name }}.tar.gz > ../assets/checksum.txt
40-
41-
- name: Create a release in GitHub and uploads assets
42-
run: gh release create ${{ github.ref_name }} --verify-tag --generate-notes ../assets/*.*
12+
create-release:
13+
runs-on: ubuntu-latest
4314
env:
44-
GITHUB_TOKEN: ${{ github.TOKEN }}
45-
shell: bash
15+
COMPOSER_ALLOW_SUPERUSER: 1
16+
APP_ENV: prod
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Composer install
22+
run: |
23+
docker network create frontend
24+
docker compose run --rm --user=root --env APP_ENV=prod phpfpm composer install --no-dev -o --classmap-authoritative
25+
docker compose run --rm --user=root --env APP_ENV=prod phpfpm composer clear-cache
26+
docker compose run --rm node yarn install
27+
docker compose run --rm node yarn build
28+
29+
- name: Make assets dir
30+
run: |
31+
mkdir -p ../assets
32+
33+
- name: Create archive
34+
run: tar --exclude='.git' --exclude='node_modules' -zcf ../assets/${{ github.event.repository.name }}-${{ github.ref_name }}.tar.gz ./
35+
36+
- name: Create checksum
37+
run: |
38+
cd ../assets
39+
sha256sum ${{ github.event.repository.name }}-${{ github.ref_name }}.tar.gz > ../assets/checksum.txt
40+
41+
- name: Create a release in GitHub and uploads assets
42+
run: gh release create ${{ github.ref_name }} --verify-tag --generate-notes ../assets/*.*
43+
env:
44+
GITHUB_TOKEN: ${{ github.TOKEN }}
45+
shell: bash

0 commit comments

Comments
 (0)