|
| 1 | +name: Testing with MariaDB |
| 2 | +on: [push, pull_request] |
| 3 | +jobs: |
| 4 | + symfony: |
| 5 | + name: Symfony (PHP ${{ matrix.php-versions }}) |
| 6 | + runs-on: ubuntu-latest |
| 7 | + services: |
| 8 | + mariadb: |
| 9 | + image: mariadb:latest |
| 10 | + ports: |
| 11 | + - 3306 |
| 12 | + env: |
| 13 | + MYSQL_USER: mariadb |
| 14 | + MYSQL_PASSWORD: mariadb |
| 15 | + MYSQL_DATABASE: mariadb |
| 16 | + MYSQL_ROOT_PASSWORD: mariadb |
| 17 | + options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3 |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + php-versions: ['7.3', '7.4'] |
| 22 | + steps: |
| 23 | + - name: Checkout |
| 24 | + uses: actions/checkout@v2 |
| 25 | + - name: Verify MariaDB connection |
| 26 | + env: |
| 27 | + PORT: ${{ job.services.mariadb.ports[3306] }} |
| 28 | + run: | |
| 29 | + while ! mysqladmin ping -h"127.0.0.1" -P"$PORT" --silent; do |
| 30 | + sleep 1 |
| 31 | + done |
| 32 | + - name: Setup PHP, with composer and extensions |
| 33 | + uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php |
| 34 | + with: |
| 35 | + php-version: ${{ matrix.php-versions }} |
| 36 | + extensions: mbstring, xml, ctype, gd, iconv, intl, pdo_sqlite |
| 37 | + coverage: xdebug #optional |
| 38 | + - name: Get composer cache directory |
| 39 | + id: composercache |
| 40 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 41 | + - name: Cache composer dependencies |
| 42 | + uses: actions/cache@v2 |
| 43 | + with: |
| 44 | + path: ${{ steps.composercache.outputs.dir }} |
| 45 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 46 | + restore-keys: ${{ runner.os }}-composer- |
| 47 | + - name: Install Composer dependencies |
| 48 | + run: | |
| 49 | + composer update symfony/flex --no-plugins --no-scripts |
| 50 | + composer install --no-progress --prefer-dist --optimize-autoloader |
| 51 | + - name: Run Migration |
| 52 | + run: | |
| 53 | + php bin/console app:install |
| 54 | + env: |
| 55 | + DATABASE_URL: mysql://mariadb:mariadb@127.0.0.1:${{ job.services.mariadb.ports[3306] }}/mariadb?serverVersion=mariadb-10.6.4 |
| 56 | + - name: Create .env.test.local |
| 57 | + run: echo "DATABASE_URL=mysql://mariadb:mariadb@127.0.0.1:${{ job.services.mariadb.ports[3306] }}/mariadb?serverVersion=mariadb-10.6.4" > .env.test.local |
| 58 | + - name: Run Tests |
| 59 | + run: php bin/phpunit --coverage-text |
| 60 | + - name: Security Check |
| 61 | + uses: symfonycorp/security-checker-action@v2 |
0 commit comments