Skip to content

Commit e6c9b2c

Browse files
committed
Add GH Action workflows for tests and code styling
1 parent 2fe8d7f commit e6c9b2c

File tree

9 files changed

+112
-30
lines changed

9 files changed

+112
-30
lines changed

.gitattributes

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
33

44
# Ignore all test and documentation with "export-ignore".
5-
/.gitattributes export-ignore
6-
/.gitignore export-ignore
7-
/.travis.yml export-ignore
8-
/phpunit.xml.dist export-ignore
9-
/.scrutinizer.yml export-ignore
10-
/tests export-ignore
5+
/.gitattributes export-ignore
6+
/.gitignore export-ignore
7+
/.php-cs-fixer.dist.php export-ignore
8+
/phpunit.xml.dist export-ignore
9+
/.scrutinizer.yml export-ignore
10+
/tests export-ignore
11+
/.github export-ignore

.github/workflows/code-style.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Code Style
2+
3+
on: [push]
4+
5+
jobs:
6+
php-cs-fixer:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v2
12+
with:
13+
ref: ${{ github.head_ref }}
14+
15+
- name: Run PHP CS Fixer
16+
uses: docker://oskarstark/php-cs-fixer-ga
17+
18+
- name: Commit changes
19+
uses: stefanzweifel/git-auto-commit-action@v4
20+
with:
21+
commit_message: Apply PHP CS Fixer changes
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/coverage.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Unit test coverage
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
tests:
9+
runs-on: ubuntu-latest
10+
name: Unit test coverage
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
16+
- name: Setup PHP
17+
uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: 7.4
20+
tools: composer:v2
21+
coverage: pcov
22+
23+
- name: Install dependencies
24+
run: composer update --prefer-stable --prefer-dist --no-interaction --no-progress
25+
26+
- name: Execute tests
27+
run: vendor/bin/phpunit --verbose --coverage-text --coverage-clover=coverage.clover
28+
29+
- name: Send coverage to Scrutinizer
30+
run: |
31+
wget https://scrutinizer-ci.com/ocular.phar
32+
php ocular.phar code-coverage:upload --format=php-clover coverage.clover

.github/workflows/tests.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: PHPUnit tests
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
tests:
9+
runs-on: ubuntu-latest
10+
continue-on-error: ${{ matrix.experimental }}
11+
strategy:
12+
fail-fast: true
13+
matrix:
14+
php: [7.2, 7.3, 7.4, 8.0, 8.1]
15+
stability: [prefer-lowest, prefer-stable]
16+
experimental: [false]
17+
name: Tests on PHP ${{ matrix.php }} - ${{ matrix.stability }}
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v2
22+
23+
- name: Setup PHP
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: ${{ matrix.php }}
27+
tools: composer:v2
28+
coverage: none
29+
30+
- name: Install dependencies
31+
run: composer update --${{ matrix.stability }} --prefer-source --no-interaction --no-progress
32+
33+
- name: Execute tests
34+
run: vendor/bin/phpunit --verbose

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
build
33
composer.phar
44
composer.lock
5+
.php-cs-fixer.php
6+
.php-cs-fixer.cache
7+
.phpunit.result.cache

.php-cs-fixer.dist.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()->in(__DIR__);
4+
5+
$config = new PhpCsFixer\Config();
6+
$config->setRiskyAllowed(true)
7+
->setRules([
8+
'@PhpCsFixer' => true,
9+
])
10+
->setFinder($finder);
11+
12+
return $config;

.styleci.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

.travis.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# The MIT License (MIT)
22

3-
Copyright (c) Syed Irfaq R. <[email protected]>
3+
Copyright (c) Irfaq Syed <[email protected]>
44

55
> Permission is hereby granted, free of charge, to any person obtaining a copy
66
> of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)