Skip to content

Merge pull request #11 from chialab/require-rna #93

Merge pull request #11 from chialab/require-rna

Merge pull request #11 from chialab/require-rna #93

Workflow file for this run

name: 'PHP'
on:
pull_request: {}
push: {}
jobs:
cs:
name: 'Run PHPCS'
runs-on: 'ubuntu-latest'
steps:
- name: 'Checkout current revision'
uses: 'actions/checkout@v3'
- name: 'Setup PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '8.1'
tools: 'composer'
extensions: 'mbstring, intl'
coverage: 'none'
- name: 'Discover Composer cache directory'
id: 'cachedir'
run: 'echo "::set-output name=path::$(composer global config cache-dir)"'
- name: 'Share Composer cache across runs'
uses: 'actions/cache@v3'
with:
path: '${{ steps.cachedir.outputs.path }}'
key: "composer-${{ github.job }}-${{ hashFiles('**/composer.json') }}"
restore-keys: |
composer-${{ github.job }}-
composer-
- name: 'Install dependencies with Composer'
run: 'composer install --prefer-dist --no-interaction'
- name: 'Run PHP CodeSniffer'
run: composer run-script cs-check
stan:
name: 'Run PHP STAN'
runs-on: 'ubuntu-latest'
steps:
- name: 'Checkout current revision'
uses: 'actions/checkout@v3'
- name: 'Setup PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '8.1'
tools: 'composer'
extensions: 'mbstring, intl'
coverage: 'none'
- name: 'Discover Composer cache directory'
id: 'cachedir'
run: 'echo "::set-output name=path::$(composer global config cache-dir)"'
- name: 'Share Composer cache across runs'
uses: 'actions/cache@v3'
with:
path: '${{ steps.cachedir.outputs.path }}'
key: "composer-${{ github.job }}-${{ hashFiles('**/composer.json') }}"
restore-keys: |
composer-${{ github.job }}-
composer-
- name: 'Install dependencies with Composer'
run: 'composer install --prefer-dist --no-interaction'
- name: 'Configure app'
run: 'cp config/app_local.example.php config/app_local.php '
- name: 'Run PHP STAN'
run: composer run-script stan
unit:
name: 'Run unit tests'
if: "!contains(github.event.commits[0].message, '[skip ci]') && !contains(github.event.commits[0].message, '[ci skip]')"
runs-on: 'ubuntu-latest'
strategy:
fail-fast: false
matrix:
php:
- '8.1'
- '8.2'
mysql:
- '5.7'
- '8.0'
env:
PHP_VERSION: '${{ matrix.php }}'
MYSQL_VERSION: '${{ matrix.mysql }}'
DATABASE_TEST_URL: 'mysql://bedita:[email protected]:3306/bedita?realVendor=mysql${{ matrix.mysql }}'
services:
db:
image: 'mysql:${{ matrix.mysql }}'
env:
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
MYSQL_USER: 'bedita'
MYSQL_PASSWORD: 'bedita'
MYSQL_DATABASE: 'bedita'
ports:
- '3306:3306'
options: '--health-cmd "mysqladmin ping -h localhost" --health-interval 10s --health-timeout 5s --health-retries 5'
steps:
- name: 'Checkout current revision'
uses: 'actions/checkout@v3'
- name: 'Setup PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '${{ matrix.php }}'
tools: 'composer'
extensions: 'mbstring, intl, pdo_mysql'
coverage: 'none' # Using PHPDBG
- name: 'Discover Composer cache directory'
id: 'cachedir'
run: 'echo "::set-output name=path::$(composer global config cache-dir)"'
- name: 'Share Composer cache across runs'
uses: 'actions/cache@v3'
with:
path: '${{ steps.cachedir.outputs.path }}'
key: "composer-${{ matrix.php }}-${{ hashFiles('**/composer.json') }}"
restore-keys: |
composer-${{ matrix.php }}-
composer-
- name: 'Install dependencies with Composer'
run: 'composer install --prefer-dist --no-interaction'
- name: 'Configure app'
run: 'cp config/app_local.example.php config/app_local.php '
- name: 'Run PHPUnit'
run: 'phpdbg -qrr vendor/bin/phpunit --coverage-clover=clover.xml'
- name: 'Export coverage results'
uses: 'codecov/codecov-action@v3'
with:
file: './clover.xml'
env_vars: PHP_VERSION,MYSQL_VERSION
- name: 'Archive code coverage results'
uses: 'actions/upload-artifact@v3'
with:
name: 'PHP ${{ matrix.php }} with MySQL ${{ matrix.mysql }}'
path: 'clover.xml'