Skip to content

CI: switch to ghactions #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
CI: switch to GitHub Actions
This commit:
* Adds a GH Actions `cs` workflow for the code style and vardump checks which were previously run on Travis.
    These checks only need to run against one PHP version as the results will be the same independently of the PHP version these checks are run on.
* Adds a GH Actions `test` workflow for the linting and unit test checks which were previously run on Travis.
* Uses the [`cs2pr`](https://github.com/staabm/annotate-pull-request-from-checkstyle) tool to display the results of the PHP linting and the results of the PHP code style check in-line in the file diff in the PR.
* Removes the, now redundant, `.travis.yml` configuration.
* Updates the `.gitattributes` file.
* Updates the "Build Status" badge in the Readme to use the results from the GH Actions runs.
  • Loading branch information
jrfnl committed May 8, 2021
commit bce5e648e396e0403d27c023ee0f338c9efd20db
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
/tests export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.travis.yml export-ignore
/.github export-ignore
phpunit.xml.dist export-ignore
phpcs.xml.dist export-ignore
38 changes: 38 additions & 0 deletions .github/workflows/cs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CS

on:
push:
pull_request:
# Allow manually triggering the workflow.
workflow_dispatch:

jobs:
checkcs:
name: 'Check code style'
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
coverage: none
tools: cs2pr

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies
uses: "ramsey/composer-install@v1"

- name: Check PHP code style
continue-on-error: true
run: vendor/bin/phpcs --report-full --report-checkstyle=./checkstyle.xml

- name: Show PHPCS results in PR
run: cs2pr ./checkstyle.xml --graceful-warnings

- name: Make sure no vardumps remain
run: composer vardumpcheck
53 changes: 53 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Test

on:
pull_request:
push:
# Allow manually triggering the workflow.
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
experimental: [false]

include:
- php: '8.1'
experimental: true

name: "Test on PHP ${{ matrix.php }}"
continue-on-error: ${{ matrix.experimental }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: cs2pr

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies - normal
if: ${{ matrix.experimental == false }}
uses: "ramsey/composer-install@v1"

# For the PHP "nightly", we need to install with ignore platform reqs as not all dependencies allow it.
- name: Install Composer dependencies - with ignore platform
if: ${{ matrix.experimental == true }}
uses: "ramsey/composer-install@v1"
with:
composer-options: --ignore-platform-reqs

- name: Lint
run: composer phplint -- --checkstyle | cs2pr

- name: Run unit tests
run: composer phpunit
40 changes: 0 additions & 40 deletions .travis.yml

This file was deleted.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ echo $highlighter->getWholeFile($fileContent);
------

[![Downloads this Month](https://img.shields.io/packagist/dm/php-parallel-lint/php-console-highlighter.svg)](https://packagist.org/packages/php-parallel-lint/php-console-highlighter)
[![Build Status](https://travis-ci.org/php-parallel-lint/PHP-Console-Highlighter.svg?branch=master)](https://travis-ci.org/php-parallel-lint/PHP-Console-Highlighter)
[![CS](https://github.com/php-parallel-lint/PHP-Console-Highlighter/actions/workflows/cs.yml/badge.svg)](https://github.com/php-parallel-lint/PHP-Console-Highlighter/actions/workflows/cs.yml)
[![Test](https://github.com/php-parallel-lint/PHP-Console-Highlighter/actions/workflows/test.yml/badge.svg)](https://github.com/php-parallel-lint/PHP-Console-Highlighter/actions/workflows/test.yml)
[![License](https://poser.pugx.org/php-parallel-lint/php-console-highlighter/license.svg)](https://packagist.org/packages/php-parallel-lint/php-console-highlighter)