Introduce Github Actions as a replacement of the Travis CI

This commit is contained in:
ErickSkrauch 2022-09-20 02:11:18 +02:00
parent 18806e41e2
commit 5865b15c88
No known key found for this signature in database
GPG Key ID: 669339FCBB30EE0E
3 changed files with 56 additions and 39 deletions

54
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,54 @@
name: CI
on:
push:
pull_request:
jobs:
Build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-versions:
- "7.4"
- "8.0"
- "8.1"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: ctype, mbstring
tools: cs2pr
- name: Get Composer's cache directory
id: composer-cache-path
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache Composer dependencies
uses: actions/cache@v3
id: composer-cache
with:
path: ${{ steps.composer-cache-path.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install
- name: PHP-CS-Fixer
if: matrix.php-versions == '8.1'
run: vendor/bin/php-cs-fixer fix --dry-run --format=checkstyle | cs2pr
# https://github.com/marketplace/actions/setup-php-action#phpunit
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: PHPUnit
run: vendor/bin/phpunit

View File

@ -1,37 +0,0 @@
language: php
php:
- '7.0'
- '7.1'
- '7.2'
- '7.3'
- '7.4'
- '8.0'
cache:
directories:
- vendor
- $HOME/.composer
env:
global:
- DEFAULT_COMPOSER_FLAGS="--optimize-autoloader --no-interaction --no-progress"
before_script:
- composer global show hirak/prestissimo -q || travis_retry composer global require $DEFAULT_COMPOSER_FLAGS hirak/prestissimo
- composer install --no-interaction
stages:
- Static Code Analysis
- Test
jobs:
include:
- stage: Static Code Analysis
php: 7.3
script:
- vendor/bin/php-cs-fixer fix -v --dry-run
allow_failures:
- php: nightly
script:
- vendor/bin/phpunit

View File

@ -265,9 +265,9 @@ usages with native `::class` keyword, introduced in PHP 5.5.
[ico-version]: https://img.shields.io/packagist/v/ely/php-code-style.svg?style=flat-square [ico-version]: https://img.shields.io/packagist/v/ely/php-code-style.svg?style=flat-square
[ico-license]: https://img.shields.io/badge/license-Apache-green.svg?style=flat-square [ico-license]: https://img.shields.io/badge/license-Apache-green.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/ely/php-code-style.svg?style=flat-square [ico-downloads]: https://img.shields.io/packagist/dt/ely/php-code-style.svg?style=flat-square
[ico-build-status]: https://img.shields.io/travis/elyby/php-code-style/master.svg?style=flat-square [ico-build-status]: https://img.shields.io/github/workflow/status/elyby/php-code-style/CI.svg?style=flat-square
[link-packagist]: https://packagist.org/packages/ely/php-code-style [link-packagist]: https://packagist.org/packages/ely/php-code-style
[link-contributors]: ../../contributors [link-contributors]: ../../contributors
[link-downloads]: https://packagist.org/packages/ely/php-code-style/stats [link-downloads]: https://packagist.org/packages/ely/php-code-style/stats
[link-build-status]: https://travis-ci.org/elyby/php-code-style [link-build-status]: https://github.com/elyby/php-code-style/actions