Skip to content

Commit

Permalink
Add Github Actions config for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
jmsche committed Dec 8, 2020
1 parent f91751e commit f133a24
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/coding-standards.yml
@@ -0,0 +1,43 @@
name: "Coding Standards"

on:
pull_request:
branches:
- "master"
push:
branches:
- "master"

jobs:
coding-standards:
name: "Coding Standards"
runs-on: "ubuntu-20.04"

strategy:
matrix:
php-version:
- "7.4"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
tools: "cs2pr"

- name: "Cache dependencies installed with Composer"
uses: "actions/cache@v2"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"

- name: "Install dependencies with Composer"
run: "composer install --no-interaction --no-progress --no-suggest"

- name: "Run php-cs-fixer"
run: "vendor/bin/php-cs-fixer fix --dry-run --format=checkstyle | cs2pr"
49 changes: 49 additions & 0 deletions .github/workflows/continuous-integration.yml
@@ -0,0 +1,49 @@
name: "Continuous Integration"

on:
pull_request:
branches:
- "master"
push:
branches:
- "master"

jobs:
phpunit:
name: "PHPUnit"
runs-on: "ubuntu-20.04"

strategy:
matrix:
php-version:
- "7.2"
- "7.3"
- "7.4"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 2

- name: "Install PHP with pcov"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "pcov"

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v2"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"

- name: "Update dependencies with composer"
run: "composer update --no-interaction --no-progress --no-suggest"

- name: "Run PHPUnit"
run: "vendor/bin/phpunit --coverage-clover=coverage.xml"

- name: "Upload to Codecov"
uses: "codecov/codecov-action@v1"
43 changes: 43 additions & 0 deletions .github/workflows/static-analysis.yml
@@ -0,0 +1,43 @@
name: "Static Analysis"

on:
pull_request:
branches:
- "master"
push:
branches:
- "master"

jobs:
static-analysis-phpstan:
name: "Static Analysis with PHPStan"
runs-on: "ubuntu-20.04"

strategy:
matrix:
php-version:
- "7.4"

steps:
- name: "Checkout code"
uses: "actions/checkout@v2"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
tools: "cs2pr"

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v2"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"

- name: "Install dependencies with composer"
run: "composer install --no-interaction --no-progress --no-suggest"

- name: "Run a static analysis with phpstan/phpstan"
run: "vendor/bin/phpstan analyse --error-format=checkstyle | cs2pr"

0 comments on commit f133a24

Please sign in to comment.