.github/workflows/ci.yml
name: "Continuous Integration"
on:
push:
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
# Allow manually triggering the workflow
workflow_dispatch:
jobs:
tests:
name: "CI"
runs-on: ${{ matrix.os }}
strategy:
matrix:
php-version:
- "7.1"
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
os:
- ubuntu-latest
- windows-latest
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
tools: composer:v2
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}
restore-keys: |
composer-${{ runner.os }}-${{ matrix.php-version }}-
composer-${{ runner.os }}-
composer-
- name: "Install dependencies"
run: "composer update --no-interaction --no-progress --prefer-dist"
- name: "Run tests"
run: "vendor/bin/simple-phpunit --colors=always --testdox"
analysis:
name: "Static Analysis"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "8.0"
tools: composer:v2, composer-normalize
- name: "Install dependencies"
run: "composer update --no-interaction --no-progress --prefer-dist"
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: composer-${{ runner.os }}-8.0-${{ hashFiles('composer.*') }}
restore-keys: |
composer-${{ runner.os }}-8.0-
composer-${{ runner.os }}-
composer-
- name: "Run tests"
run: "composer test"
- name: "Normalize composer.json"
run: "composer-normalize --dry-run --no-check-lock --no-update-lock"
- uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
fail_ci_if_error: true
verbose: true