Skip to content

Commit

Permalink
GitHub actions (#12)
Browse files Browse the repository at this point in the history
* Improve CI

* Update namespaces

* Include PHPStan
  • Loading branch information
g105b authored Dec 26, 2020
1 parent 43c76a2 commit 324bb40
Show file tree
Hide file tree
Showing 23 changed files with 955 additions and 411 deletions.
33 changes: 0 additions & 33 deletions .circleci/config.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# These are supported funding model platforms
github: [phpgt]
66 changes: 66 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: CI

on: [push]

jobs:
composer:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Cache Composer dependencies
uses: actions/cache@v2
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}

- uses: php-actions/composer@v5

- name: Archive build
run: mkdir /tmp/github-actions/ && tar -cvf /tmp/github-actions/build.tar ./

- name: Upload build archive for test runners
uses: actions/upload-artifact@v2
with:
name: build-artifact
path: /tmp/github-actions

phpunit:
runs-on: ubuntu-latest
needs: [composer]

steps:
- uses: actions/download-artifact@v2
with:
name: build-artifact
path: /tmp/github-actions

- name: Extract build archive
run: tar -xvf /tmp/github-actions/build.tar ./

- name: PHP Unit tests
uses: php-actions/phpunit@v2
with:
php_version: 8.0
php_extensions: xdebug
configuration: test/phpunit/phpunit.xml
bootstrap: vendor/autoload.php

phpstan:
runs-on: ubuntu-latest
needs: [composer]

steps:
- uses: actions/download-artifact@v2
with:
name: build-artifact
path: /tmp/github-actions

- name: Extract build archive
run: tar -xvf /tmp/github-actions/build.tar ./

- name: PHP Static Analysis
uses: php-actions/phpstan@v2
with:
path: src/
33 changes: 22 additions & 11 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
build:
environment:
php:
version: 7.2
tests:
override:
-
command: 'vendor/bin/phpunit test/unit --coverage-clover coverage --whitelist src'
coverage:
file: 'coverage'
format: 'php-clover'
php: 8.0.0

nodes:
analysis:
tests:
override:
- php-scrutinizer-run

tests-and-coverage:
environment:
php:
ini:
"xdebug.mode": coverage
tests:
override:
- phpcs-run ./src
- command: "vendor/bin/phpunit test/phpunit --coverage-clover test/phpunit/_coverage --whitelist src"
coverage:
file: "test/phpunit/_coverage"
format: "php-clover"

checks:
php:
Expand All @@ -17,5 +28,5 @@ checks:

filter:
excluded_paths:
- test/*
- vendor/*
- test/*
- vendor/*
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Define background jobs in standard crontab format and the Cron Runner will execu

***

<a href="https://circleci.com/gh/PhpGt/Cron" target="_blank">
<a href="https://github.com/PhpGt/Cron/actions" target="_blank">
<img src="https://badge.status.php.gt/cron-build.svg" alt="Build status" />
</a>
<a href="https://scrutinizer-ci.com/g/PhpGt/Cron" target="_blank">
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"dragonmantank/cron-expression": "^2.2"
},
"require-dev": {
"phpunit/phpunit": "8.*"
"phpunit/phpunit": "9.*",
"phpstan/phpstan": ">=0.12.64"
},

"autoload": {
Expand All @@ -18,7 +19,7 @@
},
"autoload-dev": {
"psr-4": {
"Gt\\Cron\\Test\\": "./test/unit/"
"Gt\\Cron\\Test\\": "./test/phpunit/"
}
},

Expand Down
Loading

0 comments on commit 324bb40

Please sign in to comment.