|
1 | 1 | name: Quality Assurance |
2 | | -on: [push, pull_request] |
3 | | -jobs: |
4 | | - |
5 | | - cross_version: |
6 | | - runs-on: ubuntu-latest |
7 | | - if: "!contains(github.event.head_commit.message, 'ci skip')" |
8 | 2 |
|
9 | | - strategy: |
10 | | - matrix: |
11 | | - php: [ '7.3', '7.4' ] |
12 | | - tools: [ 'composer:v2', 'composer:v1' ] |
13 | | - prefer: [ 'lowest', 'highest' ] |
14 | | - ignore-platform: [ '' ] |
15 | | - experimental: [ false ] |
16 | | - include: |
17 | | - - php: "8.0" |
18 | | - prefer: "highest" |
19 | | - ignore-platform: "--ignore-platform-reqs" |
20 | | - experimental: true |
21 | | - tools: "composer:v2" |
22 | | - - php: "8.0" |
23 | | - prefer: "highest" |
24 | | - ignore-platform: "--ignore-platform-reqs" |
25 | | - experimental: true |
26 | | - tools: "composer:v1" |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + skip-jobs: |
| 9 | + required: true |
| 10 | + type: choice |
| 11 | + default: 'Run all' |
| 12 | + description: 'Choose jobs to run' |
| 13 | + options: |
| 14 | + - 'Run all' |
| 15 | + - 'Run static QA only' |
| 16 | + - 'Run static unit tests only' |
27 | 17 |
|
28 | | - continue-on-error: ${{ matrix.experimental }} |
| 18 | +concurrency: |
| 19 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 20 | + cancel-in-progress: true |
29 | 21 |
|
30 | | - steps: |
31 | | - - name: Checkout |
32 | | - uses: actions/checkout@v2 |
| 22 | +jobs: |
| 23 | + static-qa: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + if: ${{ !contains(github.event.head_commit.message, 'skip qa') || github.event.inputs.skip-jobs == 'Run static unit tests only' }} |
| 26 | + steps: |
| 27 | + - name: Checkout |
| 28 | + uses: actions/checkout@v3 |
33 | 29 |
|
34 | | - - name: Setup PHP |
35 | | - uses: shivammathur/setup-php@v2 |
36 | | - with: |
37 | | - php-version: ${{ matrix.php }} |
38 | | - tools: ${{ matrix.tools }} |
| 30 | + - name: Setup PHP |
| 31 | + uses: shivammathur/setup-php@v2 |
| 32 | + with: |
| 33 | + php-version: 7.4 |
| 34 | + coverage: none |
| 35 | + tools: cs2pr |
39 | 36 |
|
40 | | - - name: Check syntax error in sources |
41 | | - run: find ./src/ -type f -name '*.php' -print0 | xargs -0 -L 1 -P 4 -- php -l |
| 37 | + - name: Install dependencies |
| 38 | + uses: ramsey/composer-install@v2 |
42 | 39 |
|
43 | | - - name: Install dependencies |
44 | | - uses: "ramsey/composer-install@v1" |
45 | | - with: |
46 | | - dependency-versions: ${{ matrix.prefer }} |
47 | | - composer-options: ${{ matrix.ignore-platform }} |
| 40 | + - name: Check code styles |
| 41 | + run: ./vendor/bin/phpcs -q --report=checkstyle | cs2pr |
48 | 42 |
|
49 | | - qa: |
50 | | - runs-on: ubuntu-latest |
51 | | - if: "!contains(github.event.head_commit.message, 'ci skip')" |
| 43 | + - name: Check Psalm |
| 44 | + run: ./vendor/bin/psalm --output-format=github --no-cache |
52 | 45 |
|
53 | | - steps: |
54 | | - - name: Checkout |
55 | | - uses: actions/checkout@v2 |
| 46 | + unit-tests: |
| 47 | + runs-on: ubuntu-latest |
| 48 | + if: ${{ !contains(github.event.head_commit.message, 'skip tests') || github.event.inputs.skip-jobs == 'Run static QA only' }} |
| 49 | + strategy: |
| 50 | + fail-fast: false |
| 51 | + matrix: |
| 52 | + php-ver: [ '7.3', '7.4', '8.0' ] |
| 53 | + composer: [ 'composer:2.0', 'composer:2.1', 'composer:2.2', 'composer:2.3', 'composer:v1' ] |
| 54 | + dependency-versions: [ 'lowest', 'highest' ] |
| 55 | + steps: |
| 56 | + - name: Checkout |
| 57 | + uses: actions/checkout@v3 |
56 | 58 |
|
57 | | - - name: Setup PHP |
58 | | - uses: shivammathur/setup-php@v2 |
59 | | - with: |
60 | | - php-version: 7.4 |
| 59 | + - name: Setup PHP |
| 60 | + uses: shivammathur/setup-php@v2 |
| 61 | + with: |
| 62 | + php-version: ${{ matrix.php-ver }} |
| 63 | + ini-values: zend.assertions=1, error_reporting=-1, display_errors=On |
| 64 | + coverage: none |
| 65 | + tools: cs2pr, ${{ matrix.composer }} |
61 | 66 |
|
62 | | - - name: Install dependencies |
63 | | - uses: "ramsey/composer-install@v1" |
| 67 | + - name: Install parallel-lint |
| 68 | + if: ${{ matrix.dependency-versions == 'highest' }} |
| 69 | + run: composer require php-parallel-lint/php-parallel-lint:^1.3.1 --dev --no-update |
64 | 70 |
|
65 | | - - name: Check cross-version PHP compatibility |
66 | | - run: composer phpcompat |
| 71 | + - name: Install dependencies |
| 72 | + uses: ramsey/composer-install@v2 |
| 73 | + with: |
| 74 | + dependency-versions: ${{ matrix.dependency-versions }} |
| 75 | + composer-options: ${{ matrix.composer-options }} |
67 | 76 |
|
68 | | - - name: Check code style |
69 | | - run: composer cs |
| 77 | + - name: Lint PHP sources |
| 78 | + if: ${{ matrix.dependency-versions == 'highest' }} |
| 79 | + run: ./vendor/bin/parallel-lint ./src/ --checkstyle | cs2pr |
70 | 80 |
|
71 | | - - name: Check Psalm |
72 | | - run: composer psalm |
| 81 | + # TODO: Write tests... |
| 82 | + #- name: Run unit tests |
| 83 | + # run: ./vendor/bin/phpunit --no-coverage |
0 commit comments