Skip to content

Bump the symfony group with 11 updates #606

Bump the symfony group with 11 updates

Bump the symfony group with 11 updates #606

name: "Continuous integration"
on:
push:
branches:
- "main"
tags:
- "*"
pull_request:
workflow_dispatch:
inputs:
deploy:
description: "Deploy on the development server?"
type: "boolean"
required: true
default: false
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
# Do not cancel concurrent executions on the main branch to prevent the deployment operation
# to be stopped when its execution already started.
cancel-in-progress: "${{ github.ref != 'refs/heads/main' }}"
jobs:
ci:
name: "Continuous integration"
runs-on: "ubuntu-latest"
services:
db:
image: "mariadb:10.11"
env:
MYSQL_DATABASE: "telemetry"
MYSQL_ROOT_PASSWORD: "password"
ports:
- "3306:3306"
options: >-
--health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
mail:
image: "axllent/mailpit"
ports:
- "1025:1025"
- "8025:8025"
env:
MP_SMTP_AUTH_ACCEPT_ANY: 1
MP_SMTP_AUTH_ALLOW_INSECURE: 1
steps:
- name: "Checkout"
uses: "actions/checkout@v5"
- name: "Setup environment variables"
run: |
echo "APP_ENV=test" >> $GITHUB_ENV
echo "DATABASE_URL=mysql://root:[email protected]:${{ job.services.db.ports['3306'] }}/telemetry" >> .env.test.local
echo "MAILER_DSN=smtp://127.0.0.1:${{ job.services.mail.ports['1025'] }}" >> .env.test.local
echo "MAILER_API_URL=http://127.0.0.1:${{ job.services.mail.ports['8025'] }}" >> .env.test.local
- name: "Setup Node.js"
uses: "actions/setup-node@v6"
with:
node-version-file: "package.json"
- name: "Setup PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.4"
extensions: "pdo_mysql"
tools: "composer, cs2pr, symfony-cli"
- name: "Get dependencies cache directories"
id: "get-cache-directories"
run: |
echo "composer_cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
echo "npm_cache_dir=$(npm config get cache)" >> $GITHUB_OUTPUT
- name: "Restore dependencies cache"
uses: "actions/cache@v4"
with:
path: |
${{ steps.get-cache-directories.outputs.composer_cache_dir }}
${{ steps.get-cache-directories.outputs.npm_cache_dir }}
key: "dependencies-${{ github.job }}-${{ hashFiles('**/composer.lock', '**/package-lock.json') }}"
restore-keys: |
dependencies-${{ github.job }}-
dependencies-
- name: "Install and build dependencies"
run: |
composer install --ansi --no-interaction --no-progress --prefer-dist
npm install --no-save
npm run dev
- name: "PHP Coding Standards"
if: "${{ success() || failure() }}"
run: |
PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer check --format checkstyle | cs2pr
- name: "PHP Stan"
if: "${{ success() || failure() }}"
run: |
vendor/bin/phpstan --ansi --no-interaction --no-progress
- name: "ComposerRequireChecker"
if: "${{ success() || failure() }}"
run: |
vendor/bin/composer-require-checker --ansi --no-interaction
- name: "ESLint"
if: "${{ success() || failure() }}"
run: |
node_modules/.bin/eslint --color .
- name: "Twigcs"
if: "${{ success() || failure() }}"
run: |
vendor/bin/twigcs --ansi --no-interaction
- name: "Initialize database"
if: "${{ success() || failure() }}"
run: |
bin/console doctrine:database:create --ansi --no-interaction
bin/console doctrine:migrations:migrate --ansi --no-interaction
- name: "Run tests"
id: "phpunit"
if: "${{ success() || failure() }}"
run: |
symfony server:start --daemon --no-tls
vendor/bin/phpunit --colors=always
- name: "Upload `/var` dir artifact"
uses: "actions/upload-artifact@v5"
if: "${{ failure() && steps.phpunit.conclusion == 'failure' }}"
with:
name: "var"
path: "var/"
# The development server has been shutted down for the moment.
#
# - name: "Deploy on development server"
# if: "${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'workflow_dispatch' && (github.event.inputs.deploy == true || github.event.inputs.deploy == 'true')) }}"
# env:
# SSH_AUTH_SOCK: "/tmp/ssh_agent.sock"
# run: |
# mkdir --parents /home/runner/.ssh
# ssh-agent -a $SSH_AUTH_SOCK > /dev/null
# printf '%s\n' "${{ secrets.DEPLOYER_PRIVATE_KEY }}" | ssh-add -
# ssh-keyscan -H bastion.teclib.com >> /home/runner/.ssh/known_hosts
# BRANCH=$(echo ${{ github.ref }} | sed 's|refs/heads/||')
# vendor/bin/dep deploy stage=development --branch=$BRANCH --file=.deploy.php --ansi --no-interaction --verbose