-
Notifications
You must be signed in to change notification settings - Fork 10
134 lines (132 loc) · 5.63 KB
/
Copy pathci.yml
File metadata and controls
134 lines (132 loc) · 5.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: MO4 Coding Standard CI
on:
pull_request:
push:
schedule:
- cron: '30 5 1 * *'
jobs:
style-checks:
env:
XMLLINT_INDENT: " "
runs-on: ubuntu-latest
steps:
- name: install dependencies
run: sudo apt update -qq && sudo apt -y install libxml2-utils
- name: Check out repository code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Install PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: '8.1'
coverage: 'none'
- name: Cache dependencies
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: '~/.cache/composer'
key: "cache-composer-${{ hashFiles('composer.json') }}"
restore-keys: 'cache-composer-'
- name: run composer
run: composer update --prefer-lowest --prefer-dist --no-interaction --no-progress
- run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd MO4/ruleset.xml
- run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd phpcs.mo4.xml
- run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd phpcs.xml.dist
- run: diff -B MO4/ruleset.xml <(xmllint --format MO4/ruleset.xml)
- run: diff -B phpcs.mo4.xml <(xmllint --format phpcs.mo4.xml)
- run: diff -B phpcs.xml.dist <(xmllint --format phpcs.xml.dist)
- name: Stylecheck against MO4 itself
run: vendor/bin/phpcs
run-tests:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
php_version:
- 8.1
- 8.2
- 8.3
- 8.4
dependencies_level:
- --prefer-lowest
- ""
include:
- os: windows-latest
php_version: 8.3
dependencies_level: --prefer-lowest
- os: windows-latest
php_version: 8.3
dependencies_level: ''
runs-on: ${{ matrix.os }}
steps:
- name: Set git to use LF on windows
if: ${{ matrix.os == 'windows-latest' }}
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Check out repository code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Install PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
coverage: 'xdebug'
php-version: ${{ matrix.php_version }}
extensions: ast-1.1.3
- name: Cache dependencies
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: '~/.cache/composer'
key: "cache-composer-${{ hashFiles('composer.json') }}"
restore-keys: 'cache-composer-'
- name: Run composer
run: composer update ${{ matrix.dependencies_level }} --prefer-dist --no-interaction --no-progress
- name: Check composer.json
run: composer normalize --dry-run
- name: Run tests
run: vendor/bin/phpunit
- name: Run integration tests
run: vendor/bin/phpcs -s --standard=MO4 integrationtests/testfile.php
- name: Run PHPStan
run: vendor/bin/phpstan analyse --no-progress
- name: Run psalm
run: vendor/bin/psalm
- name: Install and run phan
if: ${{ matrix.os != 'windows-latest' && matrix.php_version != '8.1' && matrix.php_version != '8.2' }}
run: |
rm composer.lock
composer require ${{ matrix.dependencies_level }} --dev phan/phan:^6.0.0
vendor/bin/phan
# AST 1.1 binary for Windows seems to be missing on PECL
- name: Install and run phan with polyfill
if: ${{ matrix.os == 'windows-latest' && matrix.php_version != '8.1' && matrix.php_version != '8.2' }}
run: |
rm composer.lock
composer require ${{ matrix.dependencies_level }} --dev phan/phan:^6.0.0
vendor/bin/phan --allow-polyfill-parser
- name: Run tests with coverage
if: ${{ matrix.os != 'windows-latest' && matrix.php_version == '8.1' && matrix.dependencies_level != '--prefer-lowest' }}
run: php vendor/bin/phpunit --coverage-clover=coverage.xml --coverage-cobertura=cobertura.xml --log-junit=junit.xml
- name: Upload coverage to Codecov
if: ${{ matrix.os != 'windows-latest' && matrix.php_version == '8.1' && matrix.dependencies_level != '--prefer-lowest' }}
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
report_type: coverage
disable_search: true
files: ./coverage.xml
- name: Upload test results to Codecov
if: ${{ matrix.os != 'windows-latest' && matrix.php_version == '8.1' && matrix.dependencies_level != '--prefer-lowest' }}
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
report_type: test_results
disable_search: true
files: ./junit.xml
- name: Upload coverage to Qlty
if: ${{ matrix.os != 'windows-latest' && matrix.php_version == '8.1' && matrix.dependencies_level != '--prefer-lowest' }}
uses: qltysh/qlty-action/coverage@fd52dc852530a708d68c3b7342f8d33d1df4cd55 # v2.2.1
with:
token: ${{ secrets.QLTY_COVERAGE_TOKEN }}
files: cobertura.xml
strip-prefix: '/home/runner/work/mo4-coding-standard'
add-prefix: 'MO4/Sniffs/'
env:
QLTY_COVERAGE_TOKEN: ${{ secrets.QLTY_COVERAGE_TOKEN }}