Skip to content

Commit

Permalink
Merge pull request #28 from flyeralarm/IN-1729-ci-workflow
Browse files Browse the repository at this point in the history
IN-1729 - Add GitHub workflow for php projects with tests
  • Loading branch information
MichelHartmann authored Mar 23, 2023
2 parents ac7de61 + 58ca74d commit a5a46a6
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
42 changes: 42 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: PHP Composer

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Versions
run: php --version && composer --version

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: phpcs version
run: vendor/bin/phpcs --version

- name: Run test suite
run: php tests/runner.php
2 changes: 1 addition & 1 deletion tests/runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function processDir($dirPath)
$fileContent = file_get_contents($dirPath . $file);
$snifferOutput = shell_exec(
sprintf(
"%s -w -p -s --standard=%s %s",
"%s -w -p -s --report-width=120 --standard=%s %s",
escapeshellcmd(__DIR__ . '/../vendor/bin/phpcs'),
escapeshellarg(__DIR__ . '/ruleset.xml'),
escapeshellarg($dirPath . $file)
Expand Down

0 comments on commit a5a46a6

Please sign in to comment.