Skip to content

Commit 29bb32f

Browse files
vincentchalamondependabot[bot]ThomasSamsondunglasjfcoz
authored
feat: upgrade from distribution (#346)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Thomas SAMSON <[email protected]> Co-authored-by: Kévin Dunglas <[email protected]> Co-authored-by: Julien Francoz <[email protected]> Co-authored-by: Julien Francoz <[email protected]>
1 parent 8fcf33a commit 29bb32f

File tree

107 files changed

+4708
-3869
lines changed

Some content is hidden

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

107 files changed

+4708
-3869
lines changed

.editorconfig

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,61 +16,46 @@ trim_trailing_whitespace = true
1616
insert_final_newline = true
1717

1818
[*.{js,html,ts,tsx}]
19-
indent_style = space
2019
indent_size = 2
2120

2221
[*.json]
23-
indent_style = space
24-
indent_size = 4
22+
indent_size = 2
2523

2624
[*.md]
2725
trim_trailing_whitespace = false
2826

29-
[*.php]
30-
indent_style = space
31-
indent_size = 4
32-
3327
[*.sh]
3428
indent_style = tab
35-
indent_size = 4
3629

3730
[*.xml{,.dist}]
3831
indent_style = space
3932
indent_size = 4
4033

4134
[*.{yaml,yml}]
42-
indent_style = space
43-
indent_size = 4
4435
trim_trailing_whitespace = false
4536

4637
[helm/api-platform/**.yaml]
47-
indent_style = space
4838
indent_size = 2
4939

5040
[.github/workflows/*.yml]
51-
indent_style = space
5241
indent_size = 2
5342

5443
[.gitmodules]
5544
indent_style = tab
56-
indent_size = 4
5745

5846
[.php_cs{,.dist}]
5947
indent_style = space
6048
indent_size = 4
6149

62-
[.travis.yml]
63-
indent_style = space
64-
indent_size = 2
65-
6650
[composer.json]
67-
indent_style = space
6851
indent_size = 4
6952

70-
[docker-compose{,.*}.{yaml,yml}]
53+
[{,docker-}compose{,.*}.{yaml,yml}]
7154
indent_style = space
7255
indent_size = 2
7356

74-
[Dockerfile]
57+
[{,*.*}Dockerfile]
58+
indent_style = tab
59+
60+
[{,*.*}Caddyfile]
7561
indent_style = tab
76-
indent_size = 4

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
*.yml text eol=lf
1313
bin/console text eol=lf
1414
composer.lock text eol=lf merge=ours
15+
pnpm-lock.yaml text eol=lf merge=ours
1516

1617
*.ico binary
1718
*.png binary

.github/workflows/cd.yml

Lines changed: 27 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ jobs:
1515
if: ${{ github.repository == 'api-platform/demo' && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'deploy')) }}
1616
runs-on: ubuntu-latest
1717
env:
18-
PHP_DOCKER_IMAGE: eu.gcr.io/${{ secrets.GKE_PROJECT }}/php:${{ github.sha }}
19-
PWA_DOCKER_IMAGE: eu.gcr.io/${{ secrets.GKE_PROJECT }}/pwa:${{ github.sha }}
20-
CADDY_DOCKER_IMAGE: eu.gcr.io/${{ secrets.GKE_PROJECT }}/caddy:${{ github.sha }}
21-
KEYCLOAK_DOCKER_IMAGE: eu.gcr.io/${{ secrets.GKE_PROJECT }}/keycloak:${{ github.sha }}
18+
PHP_DOCKER_IMAGE: europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/php:${{ github.sha }}
19+
PWA_DOCKER_IMAGE: europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/pwa:${{ github.sha }}
20+
KEYCLOAK_DOCKER_IMAGE: europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/keycloak:${{ github.sha }}
21+
permissions:
22+
contents: 'read'
23+
id-token: 'write'
2224
steps:
2325
-
2426
name: Checkout
@@ -33,19 +35,18 @@ jobs:
3335
python-version: 3.9.15
3436
-
3537
name: Auth gcloud
36-
uses: google-github-actions/auth@v1
38+
id: auth
39+
uses: google-github-actions/auth@v2
3740
with:
41+
token_format: access_token
3842
credentials_json: ${{ secrets.GKE_SA_KEY }}
3943
-
40-
name: Setup gcloud
41-
uses: google-github-actions/setup-gcloud@v1
44+
name: Login to GAR
45+
uses: docker/login-action@v3
4246
with:
43-
project_id: ${{ secrets.GKE_PROJECT }}
44-
-
45-
name: Configure gcloud
46-
run: |
47-
gcloud --quiet auth configure-docker
48-
gcloud container clusters get-credentials api-platform-demo --zone europe-west1-c
47+
registry: europe-west1-docker.pkg.dev
48+
username: oauth2accesstoken
49+
password: ${{ steps.auth.outputs.access_token }}
4950
-
5051
name: Build Docker images
5152
uses: docker/bake-action@v4
@@ -55,8 +56,8 @@ jobs:
5556
pull: true
5657
load: true
5758
files: |
58-
docker-compose.yml
59-
docker-compose.prod.yml
59+
compose.yaml
60+
compose.prod.yaml
6061
set: |
6162
*.cache-from=type=gha,scope=${{github.ref}}
6263
*.cache-from=type=gha,scope=refs/heads/main
@@ -66,33 +67,24 @@ jobs:
6667
run: |
6768
docker push $PHP_DOCKER_IMAGE
6869
docker push $PWA_DOCKER_IMAGE
69-
docker push $CADDY_DOCKER_IMAGE
7070
docker push $KEYCLOAK_DOCKER_IMAGE
7171
-
7272
name: Docker tag and push latest
7373
if: github.event_name == 'push'
7474
run: |
75-
docker tag $PHP_DOCKER_IMAGE eu.gcr.io/${{ secrets.GKE_PROJECT }}/php:latest
76-
docker tag $PWA_DOCKER_IMAGE eu.gcr.io/${{ secrets.GKE_PROJECT }}/pwa:latest
77-
docker tag $CADDY_DOCKER_IMAGE eu.gcr.io/${{ secrets.GKE_PROJECT }}/caddy:latest
78-
docker tag $KEYCLOAK_DOCKER_IMAGE eu.gcr.io/${{ secrets.GKE_PROJECT }}/keycloak:latest
79-
docker push eu.gcr.io/${{ secrets.GKE_PROJECT }}/php:latest
80-
docker push eu.gcr.io/${{ secrets.GKE_PROJECT }}/pwa:latest
81-
docker push eu.gcr.io/${{ secrets.GKE_PROJECT }}/caddy:latest
82-
docker push eu.gcr.io/${{ secrets.GKE_PROJECT }}/keycloak:latest
75+
docker tag $PHP_DOCKER_IMAGE europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/php:latest
76+
docker tag $PWA_DOCKER_IMAGE europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/pwa:latest
77+
docker tag $KEYCLOAK_DOCKER_IMAGE europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/keycloak:latest
78+
docker push europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/php:latest
79+
docker push europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/pwa:latest
80+
docker push europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/keycloak:latest
8381
8482
deploy:
8583
name: Deploy
8684
needs: [ build ]
87-
if: github.event_name == 'push'
8885
uses: ./.github/workflows/deploy.yml
8986
with:
90-
environment: prod
91-
url: demo.api-platform.com
9287
docker-images-version: ${{ github.sha }}
93-
cors: '["https://demo.api-platform.com", "http://localhost", "https://localhost", "http://localhost:3000"]'
94-
release: main
95-
namespace: main
9688
gke-cluster: api-platform-demo
9789
gke-zone: europe-west1-c
9890
secrets:
@@ -102,23 +94,9 @@ jobs:
10294
cloudflare-zone-id: ${{ secrets.CF_ZONE_ID }}
10395
keycloak-admin-password: ${{ secrets.KEYCLOAK_ADMIN_PASSWORD }}
10496

105-
feature-deploy:
106-
name: Feature Deploy
107-
needs: [ build ]
108-
if: github.event_name == 'pull_request'
109-
uses: ./.github/workflows/deploy.yml
97+
check:
98+
name: Check
99+
needs: [ deploy ]
100+
uses: ./.github/workflows/check.yml
110101
with:
111-
environment: pr-${{ github.event.pull_request.number }}
112-
url: pr-${{ github.event.pull_request.number }}-demo.api-platform.com
113-
docker-images-version: ${{ github.sha }}
114-
cors: '["https://pr-${{ github.event.pull_request.number }}-demo.api-platform.com", "http://localhost", "https://localhost", "http://localhost:3000"]'
115-
release: pr-${{ github.event.pull_request.number }}
116-
namespace: pr-${{ github.event.pull_request.number }}
117-
gke-cluster: api-platform-demo
118-
gke-zone: europe-west1-c
119-
secrets:
120-
gke-credentials: ${{ secrets.GKE_SA_KEY }}
121-
gke-project: ${{ secrets.GKE_PROJECT }}
122-
cloudflare-api-token: ${{ secrets.CF_API_TOKEN }}
123-
cloudflare-zone-id: ${{ secrets.CF_ZONE_ID }}
124-
keycloak-admin-password: ${{ secrets.KEYCLOAK_ADMIN_PASSWORD }}
102+
url: ${{needs.deploy.outputs.url}}

.github/workflows/check.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Deploy
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
url:
7+
type: string
8+
description: URL
9+
10+
jobs:
11+
check:
12+
name: Check
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: 'read'
16+
id-token: 'write'
17+
steps:
18+
-
19+
name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Run local k6 test
23+
uses: grafana/[email protected]
24+
with:
25+
filename: k6/script.js
26+
flags: --out json=results.json
27+
env:
28+
TARGET: ${{ inputs.url }}

.github/workflows/ci.yml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,52 +26,53 @@ jobs:
2626
name: Set up Docker Buildx
2727
uses: docker/setup-buildx-action@v3
2828
-
29-
name: Build Docker Images
29+
name: Build Docker images
3030
uses: docker/bake-action@v4
3131
with:
3232
pull: true
3333
load: true
3434
files: |
35-
docker-compose.yml
36-
docker-compose.override.yml
35+
compose.yaml
36+
compose.override.yaml
3737
set: |
3838
*.cache-from=type=gha,scope=${{github.ref}}
3939
*.cache-from=type=gha,scope=refs/heads/main
4040
*.cache-to=type=gha,scope=${{github.ref}},mode=max
4141
-
42-
name: Start Services
42+
name: Start services
4343
run: docker compose up --wait --no-build
4444
-
45-
name: Debug Services
45+
name: Debug services
4646
if: failure()
4747
run: |
4848
docker compose ps
4949
docker compose logs
5050
-
51-
name: Check HTTP Reachability
51+
name: Check HTTP reachability
5252
run: curl -v -o /dev/null http://localhost
5353
-
54-
name: Check API Reachability
54+
name: Check API reachability
5555
run: curl -vk -o /dev/null https://localhost
5656
-
57-
name: Check PWA Reachability
57+
name: Check PWA reachability
5858
run: "curl -vk -o /dev/null -H 'Accept: text/html' https://localhost"
5959
-
60-
name: Create Test Database
61-
run: |
62-
docker compose exec -T php bin/console -e test doctrine:database:create
63-
docker compose exec -T php bin/console -e test doctrine:migrations:migrate --no-interaction
60+
name: Create test database
61+
run: docker compose exec -T php bin/console -e test doctrine:database:create
62+
-
63+
name: Run migrations
64+
run: docker compose exec -T php bin/console -e test doctrine:migrations:migrate --no-interaction
6465
-
65-
name: Run PHPUnit Tests
66+
name: Run PHPUnit
6667
run: docker compose exec -T php bin/phpunit
6768
-
6869
name: Doctrine Schema Validator
69-
run: docker compose exec -T php bin/console doctrine:schema:validate
70+
run: docker compose exec -T php bin/console -e test doctrine:schema:validate
7071
-
71-
name: Run Psalm Analysis
72-
run: docker compose exec -T php vendor/bin/psalm
72+
name: Run PHPStan
73+
run: docker compose exec -T php vendor/bin/phpstan --memory-limit=256M
7374
-
74-
name: Run PWA Lint
75+
name: Lint PWA
7576
run: docker compose exec -T pwa pnpm lint
7677

7778
# run e2e tests iso-prod
@@ -82,10 +83,9 @@ jobs:
8283
contents: 'read'
8384
id-token: 'write'
8485
env:
85-
PHP_DOCKER_IMAGE: eu.gcr.io/${{ secrets.GKE_PROJECT }}/php:latest
86-
PWA_DOCKER_IMAGE: eu.gcr.io/${{ secrets.GKE_PROJECT }}/pwa:latest
87-
CADDY_DOCKER_IMAGE: eu.gcr.io/${{ secrets.GKE_PROJECT }}/caddy:latest
88-
KEYCLOAK_DOCKER_IMAGE: eu.gcr.io/${{ secrets.GKE_PROJECT }}/keycloak:latest
86+
PHP_DOCKER_IMAGE: europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/php:latest
87+
PWA_DOCKER_IMAGE: europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/pwa:latest
88+
KEYCLOAK_DOCKER_IMAGE: europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/keycloak:latest
8989
APP_SECRET: ba63418865d58089f7f070e0a437b6d16b1fb970
9090
CADDY_MERCURE_JWT_SECRET: 33b04d361e437e0d7d715600fc24fdefba317154
9191
NEXTAUTH_SECRET: 77e4c3f5a6fb652b6245a5df8a704e04ad90bc7e
@@ -95,7 +95,7 @@ jobs:
9595
KEYCLOAK_HTTPS_CERTIFICATE_FILE: ./helm/api-platform/keycloak/certs/tls.crt
9696
KEYCLOAK_HTTPS_CERTIFICATE_KEY_FILE: ./helm/api-platform/keycloak/certs/tls.pem
9797
# https://docs.docker.com/compose/environment-variables/envvars/#compose_file
98-
COMPOSE_FILE: docker-compose.yml:docker-compose.prod.yml:docker-compose.e2e.yml
98+
COMPOSE_FILE: compose.yaml:compose.prod.yaml:compose.e2e.yaml
9999
steps:
100100
-
101101
name: Checkout
@@ -110,8 +110,8 @@ jobs:
110110
pull: true
111111
load: true
112112
files: |
113-
docker-compose.yml
114-
docker-compose.prod.yml
113+
compose.yaml
114+
compose.prod.yaml
115115
set: |
116116
*.cache-from=type=gha,scope=${{github.ref}}-e2e
117117
*.cache-from=type=gha,scope=${{github.ref}}
@@ -128,7 +128,7 @@ jobs:
128128
docker compose logs
129129
-
130130
name: Load Fixtures
131-
run: docker compose run --rm --env APP_ENV=dev php bin/console doctrine:fixtures:load --no-interaction
131+
run: docker compose run --rm php bin/console doctrine:fixtures:load --no-interaction
132132
-
133133
name: Cache Playwright Binaries
134134
uses: actions/cache@v3

.github/workflows/cleanup.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
python-version: 3.9.15
2525
-
2626
name: Auth gcloud
27-
uses: google-github-actions/auth@v1
27+
uses: google-github-actions/auth@v2
2828
with:
2929
credentials_json: ${{ secrets.GKE_SA_KEY }}
3030
-

0 commit comments

Comments
 (0)