Skip to content

Commit

Permalink
Update CI (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
fre5h committed Apr 25, 2021
1 parent 33d004b commit ee77716
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 33 deletions.
147 changes: 147 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
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.2'
- '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
31 changes: 0 additions & 31 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 for transliteration. 🇺🇦 🇬🇧 🇷🇺 🔡 🐘

[![Scrutinizer Quality Score](https://img.shields.io/scrutinizer/g/fre5h/transliteration-php.svg?style=flat-square)](https://scrutinizer-ci.com/g/fre5h/transliteration-php/)
[![Build Status](https://img.shields.io/travis/fre5h/transliteration-php/master.svg?style=flat-square)](https://travis-ci.com/fre5h/transliteration-php)
[![Build Status](https://img.shields.io/github/workflow/status/fre5h/transliteration-php/CI/main?style=flat-square)](https://github.com/fre5h/transliteration-php/actions?query=workflow%3ACI+branch%3Amain+)
[![CodeCov](https://img.shields.io/codecov/c/github/fre5h/transliteration-php.svg?style=flat-square)](https://codecov.io/github/fre5h/transliteration-php)
[![License](https://img.shields.io/packagist/l/fresh/transliteration.svg?style=flat-square)](https://packagist.org/packages/fresh/transliteration)
[![Latest Stable Version](https://img.shields.io/packagist/v/fresh/transliteration.svg?style=flat-square)](https://packagist.org/packages/fresh/transliteration)
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.2"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.17",
"friendsofphp/php-cs-fixer": "^2.18",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"phpunit/phpunit": "~8.5",
Expand Down

0 comments on commit ee77716

Please sign in to comment.