Skip to content

Commit 764203a

Browse files
committed
CI: switch to GitHub Actions - step 3: test and coverage stage
This commit: * Adds a GH Actions workflow for the CI checks which were previously run on Travis in the `test` stage. * Removes the, now redundant, `.travis.yml` configuration. * Updates the `.gitattributes` file. * Adds a "Build Status" badge in the Readme to use the results from the GH `Test` Actions runs and removes the old badges. * Updates the "Tested on" badge. Notes: 1. Previously, this "stage" would run on all `pull requests` events. The current set-up still does so, with one addition: pushes to `master` (merges) will now also use this workflow instead of the quicktest. This replaces the full run on tagging a release, meaning that thing will essentially be the same. 2. As there are a couple of jobs which are "allowed to fail" (`experimental` = true), the build status will unfortunately show as "failed", even though all non-experimental jobs have succeeded. This is a known issue in GHA: https://github.com/actions/toolkit/issues/399
1 parent 89bb1c3 commit 764203a

File tree

4 files changed

+122
-124
lines changed

4 files changed

+122
-124
lines changed

.gitattributes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#
88
/.gitattributes export-ignore
99
/.gitignore export-ignore
10-
/.travis.yml export-ignore
1110
/phpcs.xml.dist export-ignore
1211
/phpunit.xml.dist export-ignore
1312
/phpunit-bootstrap.php export-ignore

.github/workflows/test.yml

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: Test
2+
3+
on:
4+
# Run on pushes to `master` and on all pull requests.
5+
push:
6+
branches:
7+
- master
8+
pull_request:
9+
paths-ignore:
10+
- '**.md'
11+
12+
jobs:
13+
#### TEST STAGE ####
14+
test:
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
# Keys:
19+
# - experimental: Whether the build is "allowed to fail".
20+
matrix:
21+
# IMPORTANT: test runs shouldn't fail because of PHPCS being incompatible with a PHP version.
22+
# - PHPCS will run without errors on PHP 5.4 - 7.2 on any version.
23+
# - PHP 7.3 needs PHPCS 3.3.1+ to run without errors.
24+
# - PHP 7.4 needs PHPCS 3.5.0+ to run without errors.
25+
# - PHP 8.0 needs PHPCS 3.5.7+ to run without errors.
26+
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2']
27+
phpcs_version: ['3.1.0', 'dev-master']
28+
experimental: [false]
29+
30+
include:
31+
# Complete the matrix, while preventing issues with PHPCS versions incompatible with certain PHP versions.
32+
- php: '8.0'
33+
phpcs_version: 'dev-master'
34+
experimental: false
35+
- php: '8.0'
36+
phpcs_version: '3.5.7'
37+
experimental: false
38+
39+
- php: '7.4'
40+
phpcs_version: 'dev-master'
41+
experimental: false
42+
- php: '7.4'
43+
phpcs_version: '3.5.0'
44+
experimental: false
45+
46+
- php: '7.3'
47+
phpcs_version: 'dev-master'
48+
experimental: false
49+
- php: '7.3'
50+
phpcs_version: '3.3.1'
51+
experimental: false
52+
53+
# Experimental builds. These are allowed to fail.
54+
- php: '7.4'
55+
phpcs_version: '4.0.x-dev'
56+
experimental: true
57+
58+
- php: '8.1' # Nightly.
59+
phpcs_version: 'dev-master'
60+
experimental: true
61+
62+
name: "Test${{ matrix.phpcs_version == 'dev-master' && ' + Lint' || '' }}: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}"
63+
64+
continue-on-error: ${{ matrix.experimental }}
65+
66+
steps:
67+
- name: Checkout code
68+
uses: actions/checkout@v2
69+
70+
- name: Setup ini config
71+
id: set_ini
72+
run: |
73+
# On stable PHPCS versions, allow for PHP deprecation notices.
74+
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
75+
if [[ "${{ matrix.phpcs_version }}" != "dev-master" && "${{ matrix.phpcs_version }}" != "4.0.x-dev" ]]; then
76+
echo '::set-output name=PHP_INI::error_reporting=E_ALL & ~E_DEPRECATED'
77+
else
78+
echo '::set-output name=PHP_INI::error_reporting=E_ALL'
79+
fi
80+
81+
- name: Install PHP
82+
uses: shivammathur/setup-php@v2
83+
with:
84+
php-version: ${{ matrix.php }}
85+
ini-values: ${{ steps.set_ini.outputs.PHP_INI }}
86+
coverage: none
87+
88+
- name: 'Composer: adjust dependencies'
89+
run: |
90+
# Set the PHPCS version to be used in the tests.
91+
composer require --no-update squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}" --no-scripts
92+
# Remove the PHPCSDevCS dependency as it has different PHPCS requirements and would block installs.
93+
composer remove --no-update --dev phpcsstandards/phpcsdevcs --no-scripts
94+
95+
# Install dependencies and handle caching in one go.
96+
# @link https://github.com/marketplace/actions/install-composer-dependencies
97+
- name: Install Composer dependencies - normal
98+
if: ${{ matrix.php < 8.1 }}
99+
uses: "ramsey/composer-install@v1"
100+
101+
# For PHP "nightly", we need to install with ignore platform reqs as not all dependencies allow installation.
102+
- name: Install Composer dependencies - with ignore platform
103+
if: ${{ matrix.php >= 8.1 }}
104+
uses: "ramsey/composer-install@v1"
105+
with:
106+
composer-options: --ignore-platform-reqs
107+
108+
- name: Lint against parse errors
109+
if: matrix.phpcs_version == 'dev-master'
110+
run: composer lint
111+
112+
# Check that any sniffs available are feature complete.
113+
# This also acts as an integration test for the feature completeness script,
114+
# which is why it is run against various PHP versions and not in the "Sniff" stage.
115+
- name: Check for feature completeness
116+
if: matrix.phpcs_version == 'dev-master'
117+
run: composer check-complete
118+
119+
- name: Run the unit tests
120+
run: composer run-tests

.travis.yml

Lines changed: 0 additions & 120 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@ PHPCSDevTools for developers of PHP_CodeSniffer sniffs
22
=====================================================
33

44
[![Latest Stable Version](https://poser.pugx.org/phpcsstandards/phpcsdevtools/v/stable)](https://packagist.org/packages/phpcsstandards/phpcsdevtools)
5-
[![Travis Build Status](https://travis-ci.com/PHPCSStandards/PHPCSDevTools.svg?branch=stable)](https://travis-ci.com/PHPCSStandards/PHPCSDevTools/branches)
65
[![Release Date of the Latest Version](https://img.shields.io/github/release-date/PHPCSStandards/PHPCSDevTools.svg?maxAge=1800)](https://github.com/PHPCSStandards/PHPCSDevTools/releases)
76
:construction:
87
[![Latest Unstable Version](https://img.shields.io/badge/unstable-dev--develop-e68718.svg?maxAge=2419200)](https://packagist.org/packages/phpcsstandards/phpcsdevtools#dev-develop)
9-
[![Travis Build Status](https://travis-ci.com/PHPCSStandards/PHPCSDevTools.svg?branch=develop)](https://travis-ci.com/PHPCSStandards/PHPCSDevTools/branches)
108
[![Last Commit to Unstable](https://img.shields.io/github/last-commit/PHPCSStandards/PHPCSDevTools/develop.svg)](https://github.com/PHPCSStandards/PHPCSDevTools/commits/develop)
119

1210
[![Minimum PHP Version](https://img.shields.io/packagist/php-v/phpcsstandards/phpcsdevtools.svg?maxAge=3600)](https://packagist.org/packages/phpcsstandards/phpcsdevtools)
1311
[![Build Status CS](https://github.com/PHPCSStandards/PHPCSDevTools/workflows/CS/badge.svg?branch=develop)](https://github.com/PHPCSStandards/PHPCSDevTools/actions)
14-
[![Tested on PHP 5.4 to nightly](https://img.shields.io/badge/tested%20on-PHP%205.4%20|%205.5%20|%205.6%20|%207.0%20|%207.1%20|%207.2%20|%207.3%20|%207.4%20|%20nightly-brightgreen.svg?maxAge=2419200)](https://travis-ci.com/PHPCSStandards/PHPCSDevTools)
12+
[![Build Status Test](https://github.com/PHPCSStandards/PHPCSDevTools/workflows/Test/badge.svg?branch=develop)](https://github.com/PHPCSStandards/PHPCSDevTools/actions)
13+
[![Tested on PHP 5.4 to nightly](https://img.shields.io/badge/tested%20on-PHP%205.4%20|%205.5%20|%205.6%20|%207.0%20|%207.1%20|%207.2%20|%207.3%20|%207.4%20|%208.0%20|%20nightly-brightgreen.svg?maxAge=2419200)](https://travis-ci.com/PHPCSStandards/PHPCSDevTools)
1514

1615
[![License: LGPLv3](https://poser.pugx.org/phpcsstandards/phpcsdevtools/license)](https://github.com/PHPCSStandards/PHPCSDevTools/blob/stable/LICENSE)
1716
![Awesome](https://img.shields.io/badge/awesome%3F-yes!-brightgreen.svg)

0 commit comments

Comments
 (0)