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 7ae91f9
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 20 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: test

on:
push:

jobs:
phpunit:
name: phpunit
runs-on: ubuntu-latest
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
22 changes: 2 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
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,28 +15,13 @@ 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 $@
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
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 7ae91f9

Please sign in to comment.