Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,9 @@ MERCURE_PUBLIC_URL=https://localhost/.well-known/mercure
# The secret used to sign the JWTs
MERCURE_JWT_SECRET="!ChangeThisMercureHubJWTSecretKey!"
###< symfony/mercure-bundle ###

###> lexik/jwt-authentication-bundle ###
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
JWT_PASSPHRASE=48709c91aeb82f8ffc07caf4f46369ec8530ec435b380c661e66697ec3939507
###< lexik/jwt-authentication-bundle ###
37 changes: 19 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,33 @@ jobs:
runs-on: ubuntu-22.04

steps:
# 1️⃣ Checkout code
- name: Checkout repository
uses: actions/checkout@v4

# 2️⃣ Run PHP-CS-Fixer on src
- name: PHP-CS-Fixer src
- name: PHP-CS-Fixer (src)
run: |
docker run --rm -v "${{ github.workspace }}/src":/src ghcr.io/php-cs-fixer/php-cs-fixer:3.72-php8.3 check -- /src
docker run --rm \
-v "${{ github.workspace }}":/code \
-w /code \
ghcr.io/php-cs-fixer/php-cs-fixer:3.72-php8.3 \
check --using-cache=no --diff --verbose -- ./src

# 3️⃣ Run PHP-CS-Fixer on tests
- name: PHP-CS-Fixer tests
- name: PHP-CS-Fixer (tests)
run: |
docker run --rm -v "${{ github.workspace }}/tests":/tests ghcr.io/php-cs-fixer/php-cs-fixer:3.72-php8.3 check -- /tests
docker run --rm \
-v "${{ github.workspace }}":/code \
-w /code \
ghcr.io/php-cs-fixer/php-cs-fixer:3.72-php8.3 \
check --using-cache=no --diff --verbose -- ./tests

build:
name: Build code
runs-on: ubuntu-22.04

steps:
# 1️⃣ Checkout du repo
- name: Checkout repository
uses: actions/checkout@v4

# 3️⃣ Build Docker image
- name: Build Docker image
run: docker build --file Dockerfile --tag auth:ci .

Expand Down Expand Up @@ -71,26 +74,24 @@ jobs:
- name: Start required services
run: docker compose up -d database auth

# # 🕓 Attente que la DB soit prête avant d’agir
# - name: Wait for PostgreSQL
# run: |
# until docker compose exec -T database pg_isready -U auth > /dev/null 2>&1; do
# echo "Waiting for database to be ready..."
# sleep 2
# done
- name: Recreate JWT keys inside container
run: |
docker compose exec -T auth mkdir -p config/jwt
echo "${{ secrets.JWT_PRIVATE_KEY }}" | base64 --decode | docker compose exec -T auth sh -c "cat > config/jwt/private.pem"
echo "${{ secrets.JWT_PUBLIC_KEY }}" | base64 --decode | docker compose exec -T auth sh -c "cat > config/jwt/public.pem"
docker compose exec -T auth chmod 600 config/jwt/private.pem
docker compose exec -T auth chmod 600 config/jwt/public.pem

- name: Install dependencies
run: docker compose exec -T auth composer install --no-interaction --prefer-dist --optimize-autoloader

# 💾 Préparation complète de la base de test (équivalent à make test)
- name: Prepare test database
run: |
docker compose run --rm auth php bin/console d:d:d --force --if-exists --env=test || true
docker compose run --rm auth php bin/console d:d:c --env=test
docker compose run --rm auth php bin/console d:mi:mi -n --env=test
docker compose run --rm auth php bin/console d:fixture:load -n --env=test

# 🧪 Lancement des tests PHPUnit
- name: Run PHPUnit tests
env:
APP_ENV: test
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###

###> lexik/jwt-authentication-bundle ###
/config/jwt/*.pem
###< lexik/jwt-authentication-bundle ###
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
"ext-iconv": "*",
"api-platform/doctrine-orm": "^4.1.0",
"api-platform/symfony": "^4.1.0",
"doctrine/doctrine-bundle": "^2.7",
"doctrine/doctrine-bundle": "^2.18",
"doctrine/doctrine-migrations-bundle": "^3.2",
"doctrine/orm": "^3.0",
"doctrine/orm": "^3.5",
"fakerphp/faker": "^1.24",
"gesdinet/jwt-refresh-token-bundle": "^1.5",
"lexik/jwt-authentication-bundle": "^3.1",
"nelmio/cors-bundle": "^2.2",
"phpstan/phpdoc-parser": "^2.0",
"runtime/frankenphp-symfony": "^0.2",
Expand Down
Loading