-
Notifications
You must be signed in to change notification settings - Fork 26
133 lines (111 loc) · 3.96 KB
/
Copy pathtest.yml
File metadata and controls
133 lines (111 loc) · 3.96 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: Run unit and style tests
on:
pull_request:
push:
branches:
- develop
- master
# Allow manually triggering the workflow.
workflow_dispatch:
# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Run style linter
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 'latest'
coverage: none
tools: cs2pr
- name: Checkout code
uses: actions/checkout@v7
- name: Install Composer dependencies
uses: ramsey/composer-install@v4
with:
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")
- name: Run code sniffer
id: phpcs
run: vendor/bin/phpcs --report-full --report-checkstyle=./phpcs-report.xml
- name: Show PHPCS results in PR
if: ${{ always() && steps.phpcs.outcome == 'failure' }}
run: cs2pr ./phpcs-report.xml
bundle:
name: Build binary
uses: ./.github/workflows/reusable-build-binary.yml
test:
name: Run tests on PHP ${{ matrix.php }}
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.php == '8.6' }}
needs:
- bundle
strategy:
matrix:
php:
- '5.3'
- '5.4'
- '5.5'
- '5.6'
- '7.0'
- '7.1'
- '7.2'
- '7.3'
- '7.4'
- '8.0'
- '8.1'
- '8.2'
- '8.3'
- '8.4'
- '8.5'
- '8.6'
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
ini-values: error_reporting=-1, display_errors=On, display_startup_errors=On, zend.assertions=1
coverage: none
# Remove the PHPCS standard as it has a minimum PHP requirements of PHP 5.4 and would block install on PHP 5.3.
- name: 'Composer: remove PHPCS'
if: ${{ matrix.php < 5.4 }}
run: composer remove --dev php-parallel-lint/php-code-style --no-update --no-interaction
- name: Install Composer dependencies
if: ${{ matrix.php != '8.6' }}
uses: ramsey/composer-install@v4
with:
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")
- name: "Install Composer dependencies (PHP nightly, ignore PHP reqs)"
if: ${{ matrix.php == '8.6' }}
uses: ramsey/composer-install@v4
with:
composer-options: --ignore-platform-req=php
custom-cache-suffix: $(date -u "+%Y-%m")
- name: 'Integration test 1 - linting own code, no colors'
continue-on-error: true
run: ./parallel-lint --exclude vendor --exclude tests/fixtures --no-colors .
- name: 'Integration test 2 - linting own code'
run: ./parallel-lint --exclude vendor --exclude tests/fixtures .
- name: Grab PHPUnit version
id: phpunit_version
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT
- name: "Run unit tests (PHPUnit < 10)"
if: ${{ ! startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}
run: composer test
- name: "Run unit tests (PHPUnit < 10)"
if: ${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}
run: composer test10
- name: Download PHAR file
uses: actions/download-artifact@v8
with:
name: parallel-lint-phar
- name: Run linter against codebase using the phar
run: php ./parallel-lint.phar --exclude vendor --exclude tests/fixtures .