|
| 1 | +name: CI |
| 2 | +on: |
| 3 | + push: |
| 4 | + pull_request: |
| 5 | + schedule: |
| 6 | + - cron: '0 4 * * 6' # Every Saturday on 4am |
| 7 | +jobs: |
| 8 | + psalm: |
| 9 | + name: Static analysis |
| 10 | + runs-on: ubuntu-20.04 |
| 11 | + steps: |
| 12 | + - name: Checkout |
| 13 | + uses: actions/checkout@v2 |
| 14 | + |
| 15 | + - name: Set up PHP |
| 16 | + uses: shivammathur/setup-php@v2 |
| 17 | + with: |
| 18 | + php-version: '7.4' |
| 19 | + tools: composer:v2 |
| 20 | + coverage: none |
| 21 | + env: |
| 22 | + fail-fast: true |
| 23 | + |
| 24 | + - name: Get Composer Cache Directories |
| 25 | + id: composer-cache |
| 26 | + run: | |
| 27 | + echo "::set-output name=files_cache::$(composer config cache-files-dir)" |
| 28 | + echo "::set-output name=vcs_cache::$(composer config cache-vcs-dir)" |
| 29 | +
|
| 30 | + - name: Retrieve cached packages |
| 31 | + uses: actions/cache@v2 |
| 32 | + with: |
| 33 | + path: | |
| 34 | + ${{ steps.composer-cache.outputs.files_cache }} |
| 35 | + ${{ steps.composer-cache.outputs.vcs_cache }} |
| 36 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 37 | + restore-keys: | |
| 38 | + ${{ runner.os }}-composer- |
| 39 | +
|
| 40 | + - name: Install composer dependencies |
| 41 | + run: composer update --prefer-dist |
| 42 | + env: |
| 43 | + COMPOSER_ROOT_VERSION: dev-master |
| 44 | + |
| 45 | + - name: Run Psalm |
| 46 | + run: vendor/bin/psalm --output-format=github --shepherd |
| 47 | + |
| 48 | + phpcs: |
| 49 | + name: Code style |
| 50 | + runs-on: ubuntu-20.04 |
| 51 | + steps: |
| 52 | + - name: Checkout |
| 53 | + uses: actions/checkout@v2 |
| 54 | + |
| 55 | + - name: Set up PHP |
| 56 | + uses: shivammathur/setup-php@v2 |
| 57 | + with: |
| 58 | + php-version: '7.4' |
| 59 | + tools: composer:v2, cs2pr |
| 60 | + coverage: none |
| 61 | + env: |
| 62 | + fail-fast: true |
| 63 | + |
| 64 | + - name: Get Composer Cache Directories |
| 65 | + id: composer-cache |
| 66 | + run: | |
| 67 | + echo "::set-output name=files_cache::$(composer config cache-files-dir)" |
| 68 | + echo "::set-output name=vcs_cache::$(composer config cache-vcs-dir)" |
| 69 | +
|
| 70 | + - name: Retrieve cached packages |
| 71 | + uses: actions/cache@v2 |
| 72 | + with: |
| 73 | + path: | |
| 74 | + ${{ steps.composer-cache.outputs.files_cache }} |
| 75 | + ${{ steps.composer-cache.outputs.vcs_cache }} |
| 76 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 77 | + restore-keys: | |
| 78 | + ${{ runner.os }}-composer- |
| 79 | +
|
| 80 | + - name: Install composer dependencies |
| 81 | + run: composer update --prefer-dist |
| 82 | + env: |
| 83 | + COMPOSER_ROOT_VERSION: dev-master |
| 84 | + |
| 85 | + - name: Run PHPCodeSniffer |
| 86 | + run: vendor/bin/phpcs --report=checkstyle -q --parallel=1 | cs2pr |
| 87 | + |
| 88 | + tests: |
| 89 | + name: Test on ${{matrix.php}} - ${{matrix.deps}} deps |
| 90 | + runs-on: ubuntu-20.04 |
| 91 | + continue-on-error: ${{matrix.php == '8.0'}} |
| 92 | + strategy: |
| 93 | + matrix: |
| 94 | + php: ['7.1', '7.2', '7.3', '7.4', '8.0'] |
| 95 | + deps: ['high', 'low', 'stable'] |
| 96 | + fail-fast: false |
| 97 | + steps: |
| 98 | + - name: Checkout |
| 99 | + uses: actions/checkout@v2 |
| 100 | + |
| 101 | + - name: Set up PHP |
| 102 | + uses: shivammathur/setup-php@v2 |
| 103 | + with: |
| 104 | + php-version: ${{matrix.php}} |
| 105 | + tools: composer:v2 |
| 106 | + coverage: none |
| 107 | + env: |
| 108 | + fail-fast: true |
| 109 | + |
| 110 | + - name: Get Composer Cache Directories |
| 111 | + id: composer-cache |
| 112 | + run: | |
| 113 | + echo "::set-output name=files_cache::$(composer config cache-files-dir)" |
| 114 | + echo "::set-output name=vcs_cache::$(composer config cache-vcs-dir)" |
| 115 | +
|
| 116 | + - name: Retrieve cached packages |
| 117 | + uses: actions/cache@v2 |
| 118 | + with: |
| 119 | + path: | |
| 120 | + ${{ steps.composer-cache.outputs.files_cache }} |
| 121 | + ${{ steps.composer-cache.outputs.vcs_cache }} |
| 122 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 123 | + restore-keys: | |
| 124 | + ${{ runner.os }}-composer- |
| 125 | +
|
| 126 | + - name: Install composer dependencies (high deps) |
| 127 | + run: composer update --prefer-dist --no-interaction |
| 128 | + if: ${{matrix.deps == 'high'}} |
| 129 | + env: |
| 130 | + COMPOSER_ROOT_VERSION: dev-master |
| 131 | + |
| 132 | + - name: Install composer dependencies (low deps) |
| 133 | + run: composer update --prefer-dist --no-interaction --prefer-stable --prefer-lowest |
| 134 | + if: ${{matrix.deps == 'low'}} |
| 135 | + env: |
| 136 | + COMPOSER_ROOT_VERSION: dev-master |
| 137 | + |
| 138 | + - name: Install composer dependencies (stable deps) |
| 139 | + run: composer update --prefer-dist --no-interaction --prefer-stable |
| 140 | + if: ${{matrix.deps == 'stable'}} |
| 141 | + env: |
| 142 | + COMPOSER_ROOT_VERSION: dev-master |
| 143 | + |
| 144 | + - name: Show Psalm version |
| 145 | + run: vendor/bin/psalm --version |
| 146 | + |
| 147 | + - name: Run tests |
| 148 | + run: vendor/bin/codecept run -v |
0 commit comments