Skip to content

Commit a5a46a6

Browse files
Merge pull request #28 from flyeralarm/IN-1729-ci-workflow
IN-1729 - Add GitHub workflow for php projects with tests
2 parents ac7de61 + 58ca74d commit a5a46a6

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

.github/workflows/php.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: PHP Composer
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- name: Versions
21+
run: php --version && composer --version
22+
23+
- name: Validate composer.json and composer.lock
24+
run: composer validate --strict
25+
26+
- name: Cache Composer packages
27+
id: composer-cache
28+
uses: actions/cache@v3
29+
with:
30+
path: vendor
31+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
32+
restore-keys: |
33+
${{ runner.os }}-php-
34+
35+
- name: Install dependencies
36+
run: composer install --prefer-dist --no-progress
37+
38+
- name: phpcs version
39+
run: vendor/bin/phpcs --version
40+
41+
- name: Run test suite
42+
run: php tests/runner.php

tests/runner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function processDir($dirPath)
2323
$fileContent = file_get_contents($dirPath . $file);
2424
$snifferOutput = shell_exec(
2525
sprintf(
26-
"%s -w -p -s --standard=%s %s",
26+
"%s -w -p -s --report-width=120 --standard=%s %s",
2727
escapeshellcmd(__DIR__ . '/../vendor/bin/phpcs'),
2828
escapeshellarg(__DIR__ . '/ruleset.xml'),
2929
escapeshellarg($dirPath . $file)

0 commit comments

Comments
 (0)