Skip to content

Commit 9decceb

Browse files
xaloppmmoll
authored andcommitted
Use GitHub Actions and remove Travis
1 parent 9261d3c commit 9decceb

File tree

3 files changed

+130
-90
lines changed

3 files changed

+130
-90
lines changed

.github/workflows/ci.yml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: MO4 Coding Standard CI
2+
on:
3+
pull_request:
4+
push:
5+
schedule:
6+
- cron: '30 5 1 * *'
7+
jobs:
8+
style-checks:
9+
env:
10+
XMLLINT_INDENT: " "
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: install dependencies
14+
run: sudo apt update -qq && sudo apt -y install libxml2-utils
15+
- name: Check out repository code
16+
uses: actions/checkout@v4
17+
- name: Install PHP
18+
uses: shivammathur/setup-php@v2
19+
with:
20+
php-version: '7.4'
21+
coverage: 'none'
22+
- name: Cache dependencies
23+
uses: actions/cache@v3
24+
with:
25+
path: '~/.cache/composer'
26+
key: "cache-composer-${{ hashFiles('composer.json') }}"
27+
restore-keys: 'cache-composer-'
28+
- name: run composer
29+
run: composer update --prefer-lowest --prefer-dist --no-interaction --no-progress
30+
- run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd MO4/ruleset.xml
31+
- run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd phpcs.mo4.xml
32+
- run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd phpcs.xml.dist
33+
- run: diff -B MO4/ruleset.xml <(xmllint --format MO4/ruleset.xml)
34+
- run: diff -B phpcs.mo4.xml <(xmllint --format phpcs.mo4.xml)
35+
- run: diff -B phpcs.xml.dist <(xmllint --format phpcs.xml.dist)
36+
- name: Stylecheck against MO4 itself
37+
run: vendor/bin/phpcs
38+
run-tests:
39+
strategy:
40+
matrix:
41+
os: [ubuntu-latest]
42+
php_version:
43+
- 7.2
44+
- 7.3
45+
- 7.4
46+
- 8.0
47+
- 8.1
48+
- 8.2
49+
- 8.3
50+
dependencies_level:
51+
- --prefer-lowest
52+
- ""
53+
include:
54+
- os: windows-latest
55+
php_version: 8.0
56+
dependencies_level: --prefer-lowest
57+
runs-on: ${{ matrix.os }}
58+
steps:
59+
- name: Set git to use LF on windows
60+
if: ${{ matrix.os == 'windows-latest' }}
61+
run: |
62+
git config --global core.autocrlf false
63+
git config --global core.eol lf
64+
- name: Check out repository code
65+
uses: actions/checkout@v4
66+
- name: Install PHP
67+
uses: shivammathur/setup-php@v2
68+
with:
69+
coverage: 'xdebug'
70+
php-version: ${{ matrix.php_version }}
71+
extensions: ast-1.1.1
72+
- name: Cache dependencies
73+
uses: actions/cache@v3
74+
with:
75+
path: '~/.cache/composer'
76+
key: "cache-composer-${{ hashFiles('composer.json') }}"
77+
restore-keys: 'cache-composer-'
78+
- name: Run composer
79+
if: ${{ matrix.php_version != '8.0' && matrix.php_version != '8.1' && matrix.php_version != '8.2' && matrix.php_version != '8.3' }}
80+
run: composer update ${{ matrix.dependencies_level }} --prefer-dist --no-interaction --no-progress
81+
- name: Run composer with workaround for PHP 8 and incompatible PHPUnit
82+
if: ${{ matrix.php_version == '8.0' || matrix.php_version == '8.1' || matrix.php_version == '8.2' || matrix.php_version == '8.3' }}
83+
run: composer update ${{ matrix.dependencies_level }} --ignore-platform-reqs --prefer-dist --no-interaction --no-progress
84+
- name: Run tests with coverage
85+
if: ${{ matrix.php_version != '8.0' && matrix.php_version != '8.1' && matrix.php_version != '8.2' && matrix.php_version != '8.3' }}
86+
run: php vendor/bin/phpunit --coverage-clover=coverage.xml
87+
- name: Run tests
88+
if: ${{ matrix.php_version == '8.0' }}
89+
run: vendor/bin/phpunit
90+
- name: Run tests
91+
if: ${{ matrix.php_version == '8.1' }}
92+
run: vendor/bin/phpunit --no-configuration --bootstrap=tests/bootstrap.php --dont-report-useless-tests vendor/squizlabs/php_codesniffer/tests/Standards/AllSniffs.php
93+
- name: Run integration tests
94+
run: vendor/bin/phpcs -s --standard=MO4 integrationtests/testfile.php
95+
- name: Run PHPStan
96+
run: vendor/bin/phpstan analyse --no-progress
97+
- name: Run psalm
98+
if: ${{ matrix.os != 'windows-latest' }}
99+
run: vendor/bin/psalm --show-info=true
100+
- name: Run phan
101+
if: ${{ matrix.os != 'windows-latest' }}
102+
run: vendor/bin/phan
103+
# AST 1.1 binary for Windows seems to be missing on PECL
104+
- name: Run phan with polyfill
105+
if: ${{ matrix.os == 'windows-latest' }}
106+
run: vendor/bin/phan --allow-polyfill-parser
107+
- name: Upload coverage to Codecov
108+
uses: codecov/codecov-action@v3
109+
with:
110+
verbose: true
111+
112+
slack-notify:
113+
needs: [run-tests, style-checks]
114+
if: always()
115+
runs-on: ubuntu-latest
116+
steps:
117+
- uses: technote-space/workflow-conclusion-action@v3
118+
- name: Post to a Slack channel
119+
id: slack
120+
uses: slackapi/slack-github-action@v1.23.0
121+
with:
122+
# Slack channel id, channel name, or user id to post message.
123+
# See also: https://api.slack.com/methods/chat.postMessage#channels
124+
channel-id: '#mo4'
125+
# For posting a simple plain text message
126+
slack-message: "GitHub build result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
127+
env:
128+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

.travis.yml

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

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# MO4 CodeSniffer ruleset
2-
2+
33
Provides a PHP CodeSniffer ruleset for the MO4 coding standard
44

5-
[![Build Status](https://travis-ci.org/mayflower/mo4-coding-standard.svg?branch=master)](https://travis-ci.org/mayflower/mo4-coding-standard)
5+
[![Build Status](https://github.com/mayflower/mo4-coding-standard/actions/workflows/ci.yml/badge.svg)](https://github.com/mayflower/mo4-coding-standard/actions)
66
[![Code Coverage](https://codecov.io/gh/mayflower/mo4-coding-standard/branch/master/graph/badge.svg)](https://codecov.io/gh/mayflower/mo4-coding-standard/branch/master/)
77
[![Scrutinizer Quality Level](https://scrutinizer-ci.com/g/mayflower/mo4-coding-standard/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/mayflower/mo4-coding-standard)
88
[![Codeclimate Maintainability](https://api.codeclimate.com/v1/badges/16114548a0315d993868/maintainability)](https://codeclimate.com/github/mayflower/mo4-coding-standard/maintainability)

0 commit comments

Comments
 (0)