Skip to content

Ci: try to use conditional step #67

Ci: try to use conditional step

Ci: try to use conditional step #67

Workflow file for this run

name: build
on: [push]
jobs:
coding-standards:
name: Coding Standards Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: none
- name: Install composer dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: locked
composer-options: --no-ansi --no-interaction --no-progress
- name: Run ECS
run: vendor/bin/ecs check
tests:
name: Tests
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system:
- ubuntu-latest
db-version:
- '5.7'
- '8.0'
php-versions:
- '7.4'
- '8.0'
- '8.1'
- '8.2'
- '8.3'
services:
mysql:
image: "mysql:${{ matrix.db-version }}"
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: dbunit
options: >-
--health-cmd="mysqladmin ping --silent"
ports:
- '3406:3306'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: pdo_mysql, libxml, dom
coverage: none
- name: Install composer dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: locked
composer-options: --no-ansi --no-interaction --no-progress
- name: Set config
run: cp phpunit.xml.dist phpunit.xml
if: ${{ matrix.php-versions }} >= '8.0'
- name: Run PHPUnit
run: vendor/bin/phpunit --colors=always --config phpunit.xml
coverage:
name: Tests coverage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: pcov
- name: Install composer dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: locked
composer-options: --no-ansi --no-interaction --no-progress
- name: Run PHPUnit with coverage
run: vendor/bin/phpunit --testsuite=unit --colors=always --coverage-clover=clover.xml
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: clover.xml