Skip to content

fix: backend ci 2

fix: backend ci 2 #6

Workflow file for this run

name: backend
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
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: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, 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: debug 1
working-directory: ${{ env.DIRECTORY }}
run: docker ps -a
- name: debug 2
working-directory: ${{ env.DIRECTORY }}
run: docker exec mariadb mysql -u root -psecret -Bse "show databases"
- name: Create database
working-directory: ${{ env.DIRECTORY }}
run: php bin/console doc:database:create --no-interaction -e test
- name: Migrate database
working-directory: ${{ env.DIRECTORY }}
run: php bin/console doc:mig:mig --no-interaction -e test
- name: Exec tests
working-directory: ${{ env.DIRECTORY }}
run: composer tuci
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
file: ${{ format('{0}/coverage.xml', env.DIRECTORY) }}
flags: backend
token: ${{ secrets.CODECOV_TOKEN }}