Skip to content

Commit

Permalink
Add GitHub actions
Browse files Browse the repository at this point in the history
Signed-off-by: William Desportes <williamdes@wdes.fr>
  • Loading branch information
williamdes committed Feb 5, 2021
1 parent b13400b commit 34fbd63
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/lint-and-analyse-php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Lint and analyse php files

on:
push:
pull_request:
types: [opened, synchronize, reopened]
branches:
- master

jobs:
lint-php:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use php 7.1
uses: shivammathur/setup-php@v2
with:
php-version: 7.1
tools: composer:v2
- name: Validate composer.json and composer.lock
run: composer validate
- name: Cache module
uses: actions/cache@v2
with:
path: ~/.composer/cache/
key: composer-cache
- name: Install dependencies
run: composer install
- name: Lint files
run: composer run phpcs

analyse-php:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use php 7.1
uses: shivammathur/setup-php@v2
with:
php-version: 7.1
tools: composer:v2
- name: Cache module
uses: actions/cache@v2
with:
path: ~/.composer/cache/
key: composer-cache
- name: Install dependencies
run: composer install
- name: Analyse files
run: composer run phpstan
20 changes: 20 additions & 0 deletions .github/workflows/lint-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Lint php documentation

on:
push:
pull_request:
types: [opened, synchronize, reopened]
branches:
- master

jobs:
lint-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: lint php documentation
uses: sudo-bot/action-doctum@v5
with:
config-file: ci/doctum-config.php
method: "parse"
cli-args: "--output-format=github --no-ansi --no-progress -v --ignore-parse-errors"
45 changes: 45 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Run tests

on:
push:
pull_request:
types: [opened, synchronize, reopened]
branches:
- master

jobs:
test-php:
name: Test on php ${{ matrix.php-version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
php-version: ["7.1", "7.2", "7.3", "7.4", "8.0"]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Use php ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring
coverage: xdebug
- name: Cache module
uses: actions/cache@v2
with:
path: ~/.composer/cache/
key: composer-cache
- name: Install dependencies
run: composer install
- name: Run php tests
run: composer run phpunit
- name: Send coverage
uses: codecov/codecov-action@v1
with:
flags: unit-${{ matrix.php-version }}-${{ matrix.os }}
name: phpunit-${{ matrix.php-version }}-${{ matrix.os }}
- name: Send coverage to Scrutinizer
uses: sudo-bot/action-scrutinizer@latest
# Upload can fail on forks
continue-on-error: true
with:
cli-args: "--format=php-clover build/logs/clover.xml"

0 comments on commit 34fbd63

Please sign in to comment.