Skip to content

chore: fix CI

chore: fix CI #10

Workflow file for this run

name: backend
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
lint-and-tests:
runs-on: ubuntu-latest
env:
# DATABASE_URL: "mysql://user1:[email protected]:3306/auto_entreprise_test?serverVersion=10.9.6-MariaDB"
DIRECTORY: ./backend
services:
mariadb:
image: mariadb:10.9
env:
MARIADB_ROOT_PASSWORD: secret
MARIADB_USER: user1
MARIADB_PASSWORD: password1
MARIADB_DATABASE: auto_entreprise_test
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: ctype, iconv, mbstring, intl, pdo_sqlite, mysql
tools: composer:v2
coverage: xdebug
- name: Install Dependencies
working-directory: ${{ env.DIRECTORY }}
run: composer install -q --no-ansi --no-interaction --no-suggest --no-scripts --no-progress --prefer-dist --optimize-autoloader
- name: PHP cs fixer
working-directory: ${{ env.DIRECTORY }}
run: composer cs
- name: PHPStan
working-directory: ${{ env.DIRECTORY }}
run: composer ps
- name: Create database
working-directory: ${{ env.DIRECTORY }}
run: php bin/console doc:database:create --no-interaction -e test
env:
# DATABASE_URL: "mysql://user1:[email protected]:{{ job.services.mariadb.ports[3306] }}/auto_entreprise_test?serverVersion=10.9.6-MariaDB"
DATABASE_URL: ${{ format('mysql://user1:[email protected]:{0}/auto_entreprise_test?serverVersion=10.9.6-MariaDB', job.services.mariadb.ports[3306]) }}
- name: Migrate database
working-directory: ${{ env.DIRECTORY }}
run: php bin/console doc:mig:mig --no-interaction -e test
env:
DATABASE_URL: ${{ format('mysql://user1:[email protected]:{0}/auto_entreprise_test?serverVersion=10.9.6-MariaDB', job.services.mariadb.ports[3306]) }}
- name: Exec tests
working-directory: ${{ env.DIRECTORY }}
run: composer tuci
env:
DATABASE_URL: ${{ format('mysql://user1:[email protected]:{0}/auto_entreprise_test?serverVersion=10.9.6-MariaDB', job.services.mariadb.ports[3306]) }}
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
file: ${{ format('{0}/coverage.xml', env.DIRECTORY) }}
flags: backend
token: ${{ secrets.CODECOV_TOKEN }}