Skip to content

Commit

Permalink
Use GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
olvlvl committed Dec 9, 2020
1 parent 053aa52 commit 6bc95c7
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
@@ -1,7 +1,7 @@
.editorconfig export-ignore
.gitattributes export-ignore
.github export-ignore
.gitignore export-ignore
.travis.yml export-ignore
Makefile export-ignore
phpcs.xml export-ignore
phpstan.neon export-ignore
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/coding-standards.yml
@@ -0,0 +1,21 @@
name: coding-standards

on:
pull_request:

jobs:
PSR-12:
name: PSR-12
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "7.2"
ini-values: memory_limit=-1
tools: phpcs, cs2pr
- name: Run PHP Code Sniffer
run: phpcs -q --report=checkstyle | cs2pr
37 changes: 37 additions & 0 deletions .github/workflows/phpstan.yml
@@ -0,0 +1,37 @@
name: analyze

on:
pull_request:

jobs:
phpstan:
name: phpstan
runs-on: ubuntu-20.04
strategy:
matrix:
php-version:
- "7.2"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1
tools: composer:v2
- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
~/.composer/cache
vendor
key: "php-${{ matrix.php-version }}"
restore-keys: "php-${{ matrix.php-version }}"

- name: Install dependencies
run: composer install --no-interaction --no-progress

- name: Analyze
run: vendor/bin/phpstan analyse
56 changes: 56 additions & 0 deletions .github/workflows/phpunit.yml
@@ -0,0 +1,56 @@
name: test

on:
pull_request:

jobs:
phpunit:
name: phpunit
runs-on: ubuntu-20.04
strategy:
matrix:
dependencies:
- lowest
- highest
php-version:
- "7.2"
- "7.4"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: xdebug
php-version: "${{ matrix.php-version }}"
ini-values: memory_limit=-1
tools: composer:v2
- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
~/.composer/cache
vendor
key: "php-${{ matrix.php-version }}"
restore-keys: "php-${{ matrix.php-version }}"

- name: Install dependencies, lowest
if: ${{ matrix.dependencies == 'lowest' }}
run: composer update --prefer-lowest --no-interaction --no-progress

- name: Install dependencies, highest
if: ${{ matrix.dependencies == 'highest' }}
run: composer update --no-interaction --no-progress

- name: Run PHPUnit
run: |
mkdir -p build/logs
vendor/bin/phpunit --coverage-clover build/logs/clover.xml
- name: Upload code coverage
if: ${{ matrix.php-version == '7.2' }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require php-coveralls/php-coveralls
php-coveralls --coverage_clover=build/logs/clover.xml -v
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

24 changes: 3 additions & 21 deletions Makefile
Expand Up @@ -2,9 +2,6 @@

PACKAGE_NAME = icanboogie/message-bus
PACKAGE_VERSION = 0.8
PHPUNIT_VERSION = phpunit-8.5.phar
PHPUNIT_FILENAME = build/$(PHPUNIT_VERSION)
PHPUNIT = php $(PHPUNIT_FILENAME)
PHPCS_FILENAME = build/phpcs

# do not edit the following lines
Expand All @@ -18,35 +15,20 @@ vendor:
update:
@COMPOSER_ROOT_VERSION=$(PACKAGE_VERSION) composer update

autoload: vendor
@composer dump-autoload

test-dependencies: vendor $(PHPUNIT_FILENAME)

$(PHPUNIT_FILENAME):
mkdir -p build
wget https://phar.phpunit.de/$(PHPUNIT_VERSION) -O $(PHPUNIT_FILENAME) -q

test: test-dependencies
test: vendor
@$(PHPUNIT)

test-coverage: test-dependencies
test-coverage: vendor
@mkdir -p build/coverage
@$(PHPUNIT) --coverage-html build/coverage

test-coveralls: test-dependencies
@mkdir -p build/logs
COMPOSER_ROOT_VERSION=$(PACKAGE_VERSION) composer require satooshi/php-coveralls
@$(PHPUNIT) --coverage-clover build/logs/clover.xml
php vendor/bin/php-coveralls -v

$(PHPCS_FILENAME):
curl -L -o $@ https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
chmod +x $@

lint: vendor $(PHPCS_FILENAME)
$(PHPCS_FILENAME)
./vendor/bin/phpstan analyse
vendor/bin/phpstan analyse

doc: vendor
@mkdir -p build/docs
Expand Down
7 changes: 1 addition & 6 deletions README.md
@@ -1,7 +1,6 @@
# MessageBus

[![Packagist](https://img.shields.io/packagist/v/icanboogie/message-bus.svg)](https://packagist.org/packages/icanboogie/message-bus)
[![Build Status](https://img.shields.io/travis/ICanBoogie/MessageBus.svg)](http://travis-ci.org/ICanBoogie/MessageBus)
[![Code Quality](https://img.shields.io/scrutinizer/g/ICanBoogie/MessageBus.svg)](https://scrutinizer-ci.com/g/ICanBoogie/MessageBus)
[![Code Coverage](https://img.shields.io/coveralls/ICanBoogie/MessageBus.svg)](https://coveralls.io/r/ICanBoogie/MessageBus)
[![Downloads](https://img.shields.io/packagist/dt/icanboogie/message-bus.svg)](https://packagist.org/packages/icanboogie/message-bus/stats)
Expand Down Expand Up @@ -233,11 +232,7 @@ installs dependencies as required. The `make test-coverage` Message runs test su
an HTML coverage report in `build/coverage`. The directory can later be cleaned with the `make
clean` Message.

The package is continuously tested by [Travis CI](http://about.travis-ci.org/).

[![Build Status](https://img.shields.io/travis/ICanBoogie/MessageBus.svg)](http://travis-ci.org/ICanBoogie/MessageBus)
[![Code Coverage](https://img.shields.io/coveralls/ICanBoogie/MessageBus.svg)](https://coveralls.io/r/ICanBoogie/MessageBus)

The package is continuously tested with [GitHub Actions](https://github.com/ICanBoogie/MessageBus/actions/).



Expand Down
1 change: 1 addition & 0 deletions composer.json
Expand Up @@ -27,6 +27,7 @@
},
"require-dev": {
"phpstan/phpstan": "^0.12.55",
"phpunit/phpunit": "^8.5",
"psr/container": "^1.0",
"symfony/config": "^4.0|^5.1",
"symfony/dependency-injection": "^4.0|^5.1",
Expand Down

0 comments on commit 6bc95c7

Please sign in to comment.