daux.io/.github/workflows/php.yml

66 lines
1.8 KiB
YAML
Raw Normal View History

2019-11-14 08:17:17 +01:00
name: CI
on: [push]
jobs:
build:
2019-11-14 08:26:13 +01:00
strategy:
max-parallel: 15
matrix:
2019-11-14 08:30:21 +01:00
# TODO : enable tests on windows
operating-system: [ubuntu-latest, macOS-latest]
2019-11-28 22:36:26 +01:00
php-versions: ['7.2', '7.3', '7.4']
2019-11-14 08:17:17 +01:00
2019-11-14 08:26:13 +01:00
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
runs-on: ${{ matrix.operating-system }}
2019-11-14 08:17:17 +01:00
steps:
- uses: actions/checkout@v1
2019-11-14 08:26:13 +01:00
- name: Setup PHP
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php-versions }}
2019-11-28 22:36:26 +01:00
extension-csv: mbstring
2019-11-14 08:26:13 +01:00
2019-11-14 08:30:21 +01:00
- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
2019-11-14 08:17:17 +01:00
- name: Validate composer.json and composer.lock
run: composer validate
2019-11-14 08:19:32 +01:00
- name: Cache vendor
uses: actions/cache@v1
with:
2019-11-14 08:30:21 +01:00
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
2019-11-14 08:19:32 +01:00
2019-11-14 08:17:17 +01:00
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Run test suite
run: composer run-script test
2019-11-28 22:36:26 +01:00
sonarcloud:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v1
- name: Setup PHP
uses: shivammathur/setup-php@master
with:
php-version: 7.4
extension-csv: mbstring, xdebug
coverage: xdebug
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Run test suite
run: composer run-script test -- --coverage-clover=coverage.clover
- run: wget https://scrutinizer-ci.com/ocular.phar
- name: Upload code coverage
run: php ocular.phar code-coverage:upload --format=php-clover coverage.clover