Skip to content

Commit

Permalink
Merge pull request #383 from api-platform/chore/improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentchalamon committed Mar 13, 2024
2 parents 63e0245 + a94a153 commit 8122ec6
Show file tree
Hide file tree
Showing 22 changed files with 12,553 additions and 1,042 deletions.
55 changes: 33 additions & 22 deletions .github/workflows/ci.yml
Expand Up @@ -7,6 +7,9 @@ on:
- \d+.\d+
pull_request: ~
workflow_dispatch: ~
# Check api-platform/core:dev-main every sunday at 02:00
schedule:
- cron: 0 2 * * 0

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down Expand Up @@ -43,20 +46,18 @@ jobs:
name: Start services
run: docker compose up --wait --no-build
-
name: Debug services
if: failure()
run: |
docker compose ps
docker compose logs
name: Update API Platform to latest
if: ${{ github.event_name == 'schedule' }}
run: docker compose exec php composer require api-platform/core:dev-main
-
name: Check HTTP reachability
run: curl -v -o /dev/null http://localhost
run: curl -v --fail-with-body http://localhost
-
name: Check API reachability
run: curl -vk -o /dev/null https://localhost
run: curl -vk --fail-with-body https://localhost
-
name: Check PWA reachability
run: "curl -vk -o /dev/null -H 'Accept: text/html' https://localhost"
run: "curl -vk --fail-with-body -H 'Accept: text/html' https://localhost"
-
name: Create test database
run: docker compose exec -T php bin/console -e test doctrine:database:create
Expand All @@ -75,6 +76,12 @@ jobs:
-
name: Check OpenAPI
run: docker compose exec -T php bin/console api:openapi:export --yaml | docker run --rm -i -v $(pwd)/redocly.yaml:/spec/redocly.yaml redocly/cli lint /dev/stdin
-
name: Debug services
if: failure()
run: |
docker compose ps
docker compose logs
# run e2e tests iso-prod
e2e-tests:
Expand All @@ -83,6 +90,13 @@ jobs:
permissions:
contents: 'read'
id-token: 'write'
strategy:
matrix:
# don't run @read and @write scenarios to prevent conflict between them
annotation:
- '@read'
- '@write'
fail-fast: false
env:
PHP_DOCKER_IMAGE: europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/php:latest
PWA_DOCKER_IMAGE: europe-west1-docker.pkg.dev/${{ secrets.GKE_PROJECT }}/${{ secrets.GKE_PROJECT }}/pwa:latest
Expand Down Expand Up @@ -120,11 +134,9 @@ jobs:
name: Start Services
run: docker compose up --wait --no-build
-
name: Debug Services
if: failure()
run: |
docker compose ps
docker compose logs
name: Update API Platform to latest
if: ${{ github.event_name == 'schedule' }}
run: docker compose exec php composer require api-platform/core:dev-main
-
name: Load Fixtures
run: docker compose run --rm php bin/console doctrine:fixtures:load --no-interaction
Expand Down Expand Up @@ -163,17 +175,16 @@ jobs:
working-directory: pwa
run: pnpm exec playwright install
-
name: Run Playwright @read
name: Run Playwright
working-directory: pwa
# don't run @read and @write scenarios to prevent conflict between them
run: pnpm exec playwright test --grep @read
# use 1 worker to prevent conflict between scenarios (longer but safer)
run: pnpm exec playwright test --workers=1 --grep ${{ matrix.annotation }}
-
name: Run Playwright @write
working-directory: pwa
# run all e2e tests even if @read ones fail
if: ${{ !cancelled() }}
# use 1 worker to prevent conflict between scenarios
run: pnpm exec playwright test --grep @write --workers=1
name: Debug Services
if: failure()
run: |
docker compose ps
docker compose logs
-
uses: actions/upload-artifact@v4
if: failure()
Expand Down
2 changes: 2 additions & 0 deletions .hadolint.yaml
@@ -0,0 +1,2 @@
ignored:
- DL3008
18 changes: 10 additions & 8 deletions api/Dockerfile
Expand Up @@ -5,7 +5,7 @@

# Versions
# hadolint ignore=DL3007
FROM dunglas/frankenphp:latest-php8.3-alpine AS frankenphp_upstream
FROM dunglas/frankenphp:1-php8.3 AS frankenphp_upstream
FROM composer/composer:2-bin AS composer_upstream


Expand All @@ -21,25 +21,27 @@ WORKDIR /app

# persistent / runtime deps
# hadolint ignore=DL3018
RUN apk add --no-cache \
RUN apt-get update; \
apt-get install --no-install-recommends -y \
acl \
file \
gettext \
git \
;
; \
rm -rf /var/lib/apt/lists/*

RUN set -eux; \
install-php-extensions \
install-php-extensions \
apcu \
intl \
opcache \
zip \
;
;

###> recipes ###
###> doctrine/doctrine-bundle ###
RUN set -eux; \
install-php-extensions pdo_pgsql
install-php-extensions pdo_pgsql
###< doctrine/doctrine-bundle ###
###< recipes ###

Expand Down Expand Up @@ -67,8 +69,8 @@ RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"

RUN set -eux; \
install-php-extensions \
xdebug \
;
xdebug \
;

COPY --link frankenphp/conf.d/app.dev.ini $PHP_INI_DIR/conf.d/

Expand Down
1 change: 1 addition & 0 deletions api/composer.json
Expand Up @@ -13,6 +13,7 @@
"myclabs/php-enum": "^1.8",
"nelmio/cors-bundle": "^2.4",
"runtime/frankenphp-symfony": "^0.2.0",
"seld/jsonlint": "^1.10",
"symfony/asset": "7.0.*",
"symfony/clock": "7.0.*",
"symfony/console": "7.0.*",
Expand Down

0 comments on commit 8122ec6

Please sign in to comment.