|
1 | 1 | name: Tests |
2 | | - |
3 | | -on: |
4 | | - push: ~ |
5 | | - pull_request: ~ |
6 | | - |
| 2 | +on: [push, pull_request] |
7 | 3 | jobs: |
8 | | - phpcs: |
9 | | - name: PHPCS |
10 | | - runs-on: ubuntu-latest |
11 | | - |
12 | | - steps: |
13 | | - - uses: actions/checkout@v2 |
14 | | - |
15 | | - - uses: shivammathur/setup-php@v2 |
16 | | - with: |
17 | | - php-version: 7.2 |
18 | | - extensions: curl, mbstring |
19 | | - coverage: none |
20 | | - tools: composer:v2 |
21 | | - |
22 | | - - run: composer update --no-progress |
23 | | - |
24 | | - - run: vendor/bin/phpcs |
25 | | - |
26 | | - phpunit: |
27 | | - name: PHPUnit on ${{ matrix.php }} |
28 | | - runs-on: ${{ matrix.os }} |
29 | | - strategy: |
30 | | - matrix: |
31 | | - os: [ubuntu-latest, windows-latest, macos-latest] |
32 | | - php: ["7.2", "7.3", "7.4"] |
33 | | - coverage: [true] |
34 | | - composer-flags: [""] |
35 | | - include: |
36 | | - - php: "8.0" |
37 | | - coverage: false |
38 | | - composer-flags: "--ignore-platform-req=php" |
39 | | - |
40 | | - steps: |
41 | | - - uses: actions/checkout@v2 |
42 | | - |
43 | | - - uses: shivammathur/setup-php@v2 |
44 | | - with: |
45 | | - php-version: ${{ matrix.php }} |
46 | | - extensions: curl, mbstring |
47 | | - coverage: pcov |
48 | | - tools: composer:v2 |
49 | | - |
50 | | - - run: composer update --no-progress ${{ matrix.composer-flags }} |
51 | | - |
52 | | - - run: vendor/bin/phpunit --no-coverage |
53 | | - if: ${{ !matrix.coverage }} |
54 | | - |
55 | | - - run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover |
56 | | - if: ${{ matrix.coverage }} |
57 | | - |
58 | | - - run: bash <(curl -s https://codecov.io/bash) -f coverage.clover |
59 | | - if: ${{ matrix.coverage }} |
60 | | - |
61 | | - phpstan: |
62 | | - name: PHPStan |
63 | | - runs-on: ubuntu-latest |
64 | | - |
65 | | - steps: |
66 | | - - uses: actions/checkout@v2 |
67 | | - |
68 | | - - uses: shivammathur/setup-php@v2 |
69 | | - with: |
70 | | - php-version: 7.2 |
71 | | - extensions: curl, mbstring |
72 | | - coverage: none |
73 | | - tools: composer:v2 |
74 | | - |
75 | | - - run: composer update --no-progress |
76 | | - |
77 | | - - run: vendor/bin/phpstan analyse |
78 | | - |
79 | | - psalm: |
80 | | - name: Psalm |
81 | | - runs-on: ubuntu-latest |
82 | | - |
83 | | - steps: |
84 | | - - uses: actions/checkout@v2 |
85 | | - |
86 | | - - uses: shivammathur/setup-php@v2 |
87 | | - with: |
88 | | - php-version: 7.2 |
89 | | - extensions: curl, mbstring |
90 | | - coverage: none |
91 | | - tools: composer:v2 |
92 | | - |
93 | | - - run: composer update --no-progress |
94 | | - |
95 | | - - run: vendor/bin/psalm |
| 4 | + build: |
| 5 | + strategy: |
| 6 | + matrix: |
| 7 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 8 | + php: ['7.2', '7.3', '7.4'] |
| 9 | + coverage: ["true"] |
| 10 | + composer-flags: [""] |
| 11 | + include: |
| 12 | + - php: "8.0" |
| 13 | + coverage: "false" |
| 14 | + composer-flags: "--ignore-platform-req=php" |
| 15 | + runs-on: ${{ matrix.os }} |
| 16 | + steps: |
| 17 | + - name: Checkout |
| 18 | + uses: actions/checkout@v2 |
| 19 | + |
| 20 | + - name: Setup PHP, with composer and extensions |
| 21 | + uses: shivammathur/setup-php@v2 |
| 22 | + with: |
| 23 | + php-version: ${{ matrix.php-versions }} |
| 24 | + extensions: mbstring, curl |
| 25 | + coverage: xdebug |
| 26 | + tools: composer:v2 |
| 27 | + |
| 28 | + - name: Get composer cache directory |
| 29 | + id: composercache |
| 30 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 31 | + |
| 32 | + - name: Cache composer dependencies |
| 33 | + uses: actions/cache@v2 |
| 34 | + with: |
| 35 | + path: ${{ steps.composercache.outputs.dir }} |
| 36 | + # Use composer.json for key, if composer.lock is not committed. |
| 37 | + # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} |
| 38 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 39 | + restore-keys: ${{ runner.os }}-composer- |
| 40 | + |
| 41 | + - name: Install dependencies |
| 42 | + run: composer update --no-progress --optimize-autoloader ${{ matrix.composer-flags }} |
| 43 | + |
| 44 | + - name: Check Coding Stardard |
| 45 | + run: vendor/bin/phpcs |
| 46 | + |
| 47 | + - name: Test with Phpunit |
| 48 | + run: | |
| 49 | + if [ "${{ !matrix.coverage }}" == "false" ]; then |
| 50 | + vendor/bin/phpunit --no-coverage |
| 51 | + fi |
| 52 | + if [ "${{ !matrix.coverage }}" == "true" ]; then |
| 53 | + vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover |
| 54 | + bash <(curl -s https://codecov.io/bash) -f coverage.clover |
| 55 | + fi |
| 56 | +
|
| 57 | + - name: Test with Phpstan |
| 58 | + run: vendor/bin/phpstan analyse |
| 59 | + |
| 60 | + - name: Test with Psalm |
| 61 | + run: vendor/bin/psalm |
0 commit comments