|
1 | 1 | name: PHP Quality Assurance
|
2 |
| -on: [push, pull_request] |
| 2 | +on: |
| 3 | + push: |
| 4 | + pull_request: |
| 5 | + workflow_dispatch: |
| 6 | +concurrency: |
| 7 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 8 | + cancel-in-progress: true |
3 | 9 | jobs:
|
| 10 | + static-qa: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + if: ${{ !contains(github.event.head_commit.message, 'no static qa') }} |
| 13 | + steps: |
| 14 | + - name: Checkout |
| 15 | + uses: actions/checkout@v2 |
4 | 16 |
|
5 |
| - Unit_Tests: |
6 |
| - runs-on: ubuntu-latest |
7 |
| - if: ${{ !contains(github.event.head_commit.message, 'no unit tests') }} |
8 |
| - strategy: |
9 |
| - matrix: |
10 |
| - php: ['7.0', '7.1', '7.2', '7.3', '7.4'] |
11 |
| - prefer: |
12 |
| - - "lowest" |
13 |
| - - "highest" |
14 |
| - ignore-platform: |
15 |
| - - "" |
16 |
| - experimental: |
17 |
| - - false |
18 |
| - include: |
19 |
| - - php: "8.0" |
20 |
| - prefer: "highest" |
21 |
| - ignore-platform: "--ignore-platform-reqs" |
22 |
| - experimental: true |
23 |
| - - php: "8.1" |
24 |
| - prefer: "highest" |
25 |
| - ignore-platform: "--ignore-platform-reqs" |
26 |
| - experimental: true |
| 17 | + - name: Setup PHP |
| 18 | + uses: shivammathur/setup-php@v2 |
| 19 | + with: |
| 20 | + php-version: 7.4 |
| 21 | + coverage: none |
| 22 | + tools: cs2pr |
27 | 23 |
|
28 |
| - continue-on-error: ${{ matrix.experimental }} |
| 24 | + - name: Install dependencies |
| 25 | + uses: ramsey/composer-install@v2 |
29 | 26 |
|
30 |
| - steps: |
31 |
| - - uses: actions/checkout@v2 |
| 27 | + - name: Check code styles |
| 28 | + run: | |
| 29 | + ./vendor/bin/phpcs -q --report-full --report-checkstyle="phpcs-report.xml" --runtime-set testVersion 7.0- --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 |
| 30 | + cs2pr --graceful-warnings phpcs-report.xml |
32 | 31 |
|
33 |
| - - name: Setup PHP version |
34 |
| - uses: shivammathur/setup-php@v2 |
35 |
| - with: |
36 |
| - php-version: ${{ matrix.php }} |
| 32 | + - name: Check Psalm |
| 33 | + run: ./vendor/bin/psalm --output-format=github --no-cache |
37 | 34 |
|
38 |
| - - name: Check syntax error in sources |
39 |
| - run: find ./src/ ./tests/src/ ./tests/cases/ -type f -name '*.php' -print0 | xargs -0 -L 1 -P 4 -- php -l |
| 35 | + unit-tests: |
| 36 | + runs-on: ubuntu-latest |
| 37 | + if: ${{ !contains(github.event.head_commit.message, 'no unit tests') }} |
| 38 | + strategy: |
| 39 | + fail-fast: true |
| 40 | + matrix: |
| 41 | + php-ver: [ '7.0', '7.1', '7.2', '7.3', '7.4', '8.0' ] |
| 42 | + deps-mode: [ 'lowest', 'highest' ] |
| 43 | + include: |
| 44 | + - php-ver: '8.1' |
| 45 | + dependency-versions: 'highest' |
40 | 46 |
|
41 |
| - - name: Remove Psalm before tests, to prevent installation conflicts |
42 |
| - run: composer.phar remove vimeo/psalm --no-update |
| 47 | + steps: |
| 48 | + - name: Checkout |
| 49 | + uses: actions/checkout@v2 |
43 | 50 |
|
44 |
| - - name: Install dependencies |
45 |
| - uses: "ramsey/composer-install@v1" |
46 |
| - with: |
47 |
| - dependency-versions: ${{ matrix.prefer }} |
48 |
| - composer-options: ${{ matrix.ignore-platform }} |
| 51 | + - name: Setup PHP |
| 52 | + uses: shivammathur/setup-php@v2 |
| 53 | + with: |
| 54 | + php-version: ${{ matrix.php-ver }} |
| 55 | + ini-values: zend.assertions=1, error_reporting=-1, display_errors=On |
| 56 | + coverage: none |
| 57 | + tools: cs2pr, parallel-lint:^1.3.1 |
49 | 58 |
|
50 |
| - - name: Migrate PHPUnit config for PHPUnit 9 |
51 |
| - if: ${{ (matrix.php >= 7.3) && (matrix.prefer == 'highest') }} |
52 |
| - run: ./vendor/bin/phpunit --migrate-configuration |
| 59 | + - name: Check syntax error in sources |
| 60 | + if: ${{ (matrix.deps-mode == 'highest') }} |
| 61 | + run: parallel-lint ./src/ ./tests/src/ ./tests/cases/ --checkstyle | cs2pr |
53 | 62 |
|
54 |
| - - name: Run unit tests |
55 |
| - run: ./vendor/bin/phpunit |
| 63 | + - name: Remove Psalm before tests to prevent installation conflicts |
| 64 | + run: composer remove vimeo/psalm --no-update |
56 | 65 |
|
57 |
| - Static_Analisys: |
58 |
| - runs-on: ubuntu-latest |
59 |
| - if: ${{ !contains(github.event.head_commit.message, 'no static qa') }} |
60 |
| - steps: |
61 |
| - - uses: actions/checkout@v2 |
| 66 | + - name: Install dependencies |
| 67 | + uses: ramsey/composer-install@v2 |
| 68 | + with: |
| 69 | + dependency-versions: ${{ matrix.deps-mode }} |
62 | 70 |
|
63 |
| - - name: Setup PHP version |
64 |
| - uses: shivammathur/setup-php@v2 |
65 |
| - with: |
66 |
| - php-version: '7.4' |
| 71 | + - name: Migrate PHPUnit config for PHPUnit 9 |
| 72 | + if: ${{ (matrix.php-ver >= 7.3) && (matrix.deps-mode == 'highest') }} |
| 73 | + run: ./vendor/bin/phpunit --migrate-configuration |
67 | 74 |
|
68 |
| - - name: Install dependencies |
69 |
| - uses: "ramsey/composer-install@v1" |
70 |
| - |
71 |
| - - name: Check code styles |
72 |
| - run: ./vendor/bin/phpcs |
73 |
| - |
74 |
| - - name: Check cross-version PHP compatibility |
75 |
| - run: composer phpcompat |
76 |
| - |
77 |
| - - name: Check Psalm |
78 |
| - run: ./vendor/bin/psalm |
| 75 | + - name: Run unit tests |
| 76 | + run: ./vendor/bin/phpunit --testsuite=unit --no-coverage |
0 commit comments