Skip to content

Commit

Permalink
Update CI (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
fre5h authored Apr 24, 2021
1 parent 6d56ad2 commit c3f2618
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 43 deletions.
146 changes: 146 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
name: CI

on:
pull_request:
push:
branches:
- 'main'

jobs:
composer-validate:
runs-on: ubuntu-latest
name: "Composer Validate"
steps:
- name: 'Checkout Code'
uses: actions/checkout@v2

- name: 'Validate composer.json'
run: composer validate --no-check-all --strict --no-check-lock

composer-install:
needs: composer-validate
runs-on: ubuntu-latest
name: "Composer Install"
steps:
- name: 'Checkout Code'
uses: actions/checkout@v2

- name: 'Install Dependencies'
run: composer install --prefer-dist --no-progress --no-interaction

code-style:
needs: composer-install
runs-on: ubuntu-latest
name: "Code Style"
strategy:
fail-fast: false
steps:
- name: 'Checkout Code'
uses: actions/checkout@v2

- name: 'Setup PHP'
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
ini-values: memory_limit=-1
coverage: none
tools: composer:v2

- name: 'Install PHP dependencies with Composer'
run: composer install --prefer-dist --no-progress --optimize-autoloader
working-directory: './'

- name: 'Run CodeSniffer'
run: ./vendor/bin/phpcs ./ -p --encoding=utf-8 --extensions=php --ignore=vendor --ignore=tests --standard=phpcs.xml

static-analysis:
needs: composer-install
runs-on: ubuntu-latest
name: "Static Analysis"
strategy:
fail-fast: false
steps:
- name: 'Checkout Code'
uses: actions/checkout@v2

- name: 'Setup PHP'
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
ini-values: memory_limit=-1
coverage: none
tools: composer:v2

- name: 'Install PHP dependencies with Composer'
run: composer install --prefer-dist --no-progress --optimize-autoloader
working-directory: './'

- name: 'Run PHPStan'
run: ./vendor/bin/phpstan analyse --no-progress -c phpstan.neon ./

test:
needs: composer-install
runs-on: ubuntu-latest
name: "Tests (PHP ${{ matrix.php-version }})"
strategy:
fail-fast: false
matrix:
php-version:
- '7.3'
- '7.4'
- '8.0'
steps:
- name: 'Checkout Code'
uses: actions/checkout@v2

- name: 'Setup PHP'
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
ini-values: memory_limit=-1
coverage: none
tools: composer:v2

- name: 'Install PHP dependencies with Composer'
run: composer install --prefer-dist --no-progress --optimize-autoloader
working-directory: './'

- name: 'Run PHPUnit'
run: ./vendor/bin/phpunit -v -c phpunit.xml.dist

code-coverage:
needs: test
runs-on: ubuntu-latest
name: "Code Coverage"
strategy:
fail-fast: false
steps:
- name: 'Checkout Code'
uses: actions/checkout@v2

- name: 'Setup PHP'
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
ini-values: memory_limit=-1
coverage: pcov
tools: composer:v2

- name: 'Install PHP dependencies with Composer'
run: composer install --prefer-dist --no-progress --optimize-autoloader
working-directory: './'

- name: 'Run PHPUnit with Code Coverage'
run: ./vendor/bin/phpunit -v -c phpunit.xml.dist --coverage-clover=coverage.xml

- name: 'Download Coverage Files'
uses: actions/download-artifact@v2
with:
path: reports

- name: 'Upload to Codecov'
uses: codecov/codecov-action@v1
with:
files: ./coverage.xml
fail_ci_if_error: true
verbose: true
33 changes: 0 additions & 33 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
🕒 📅 🐘 PHP library that provides additional functions for processing dates & times.

[![Scrutinizer Quality Score](https://img.shields.io/scrutinizer/g/fre5h/datetime-php.svg?style=flat-square)](https://scrutinizer-ci.com/g/fre5h/datetime-php/)
[![Build Status](https://img.shields.io/travis/fre5h/datetime-php/master.svg?style=flat-square)](https://travis-ci.com/fre5h/datetime-php)
[![Build Status](https://img.shields.io/github/workflow/status/fre5h/datetime-php/CI/main?style=flat-square)](https://github.com/fre5h/datetime-php/actions?query=workflow%3ACI+branch%3Amain+)
[![CodeCov](https://img.shields.io/codecov/c/github/fre5h/datetime-php.svg?style=flat-square)](https://codecov.io/github/fre5h/datetime-php)
[![License](https://img.shields.io/packagist/l/fresh/datetime.svg?style=flat-square)](https://packagist.org/packages/fresh/datetime)
[![Latest Stable Version](https://img.shields.io/packagist/v/fresh/datetime.svg?style=flat-square)](https://packagist.org/packages/fresh/datetime)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"php": ">=7.3.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.16",
"friendsofphp/php-cs-fixer": "^2.18",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"phpunit/phpunit": "^9.5",
Expand Down
16 changes: 8 additions & 8 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>./src/</directory>
<exclude>
<file>./src/TimeConstants.php</file>
</exclude>
</whitelist>
</filter>
<coverage includeUncoveredFiles="false">
<include>
<directory suffix=".php">./src/</directory>
</include>
<exclude>
<file>./src/TimeConstants.php</file>
</exclude>
</coverage>
</phpunit>

0 comments on commit c3f2618

Please sign in to comment.