|
| 1 | +name: CI |
| 2 | +on: |
| 3 | + push: |
| 4 | + pull_request: |
| 5 | + schedule: |
| 6 | + - cron: '0 0 * * 0' |
| 7 | + |
| 8 | +jobs: |
| 9 | + composer-validation: |
| 10 | + name: Composer Validation |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - name: checkout |
| 14 | + uses: actions/checkout@v2 |
| 15 | + |
| 16 | + - name: Setup PHP |
| 17 | + uses: shivammathur/setup-php@v2 |
| 18 | + with: |
| 19 | + php-version: 7.4 |
| 20 | + extensions: ftp, gd, json, zip |
| 21 | + coverage: none |
| 22 | + |
| 23 | + - name: Run composer validate |
| 24 | + run: composer validate --strict |
| 25 | + |
| 26 | + unit-tests: |
| 27 | + name: Unit Tests |
| 28 | + strategy: |
| 29 | + fail-fast: false |
| 30 | + matrix: |
| 31 | + php-version: |
| 32 | + - 7.4 |
| 33 | + runs-on: ubuntu-latest |
| 34 | + steps: |
| 35 | + - name: Checkout |
| 36 | + uses: actions/checkout@v2 |
| 37 | + |
| 38 | + - name: Setup PHP |
| 39 | + uses: shivammathur/setup-php@v2 |
| 40 | + with: |
| 41 | + php-version: ${{ matrix.php-version }} |
| 42 | + extensions: ftp, gd, json, zip |
| 43 | + coverage: xdebug |
| 44 | + |
| 45 | + - name: Get composer cache directory |
| 46 | + id: composer-cache |
| 47 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 48 | + |
| 49 | + - name: Cache composer dependencies |
| 50 | + uses: actions/cache@v2 |
| 51 | + with: |
| 52 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 53 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 54 | + restore-keys: ${{ runner.os }}-composer- |
| 55 | + |
| 56 | + - name: Setup problem matchers |
| 57 | + run: | |
| 58 | + echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" |
| 59 | + echo "::add-matcher::.github/problem-matchers/coverage-check.json" |
| 60 | +
|
| 61 | + - name: Install dependencies |
| 62 | + run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader |
| 63 | + |
| 64 | + - name: Run phpunit |
| 65 | + run: vendor/bin/phpunit --testsuite unit-test --coverage-clover=coverage.xml |
| 66 | + |
| 67 | + - name: Check coverage.xml existence |
| 68 | + id: check-coverage-file |
| 69 | + uses: andstor/file-existence-action@v1 |
| 70 | + with: |
| 71 | + files: coverage.xml |
| 72 | + |
| 73 | + - name: Run coverage-check |
| 74 | + if: ${{ always() && steps.check-coverage-file.outputs.files_exists == 'true' }} |
| 75 | + run: vendor/bin/coverage-check coverage.xml 100 |
| 76 | + |
| 77 | + - name: Upload coverage as artifacts |
| 78 | + if: ${{ always() && steps.check-coverage-file.outputs.files_exists == 'true' }} |
| 79 | + uses: actions/upload-artifact@v2 |
| 80 | + with: |
| 81 | + name: coverage-${{ matrix.php-version }} |
| 82 | + path: coverage.xml |
| 83 | + |
| 84 | + - name: Upload coverage to Codecov |
| 85 | + if: ${{ always() && steps.check-coverage-file.outputs.files_exists == 'true' }} |
| 86 | + uses: codecov/codecov-action@v1 |
| 87 | + with: |
| 88 | + name: coverage-${{ matrix.php-version }} |
| 89 | + file: coverage.xml |
| 90 | + |
| 91 | + |
| 92 | + serializer-tests: |
| 93 | + name: Serializer Tests |
| 94 | + strategy: |
| 95 | + fail-fast: false |
| 96 | + matrix: |
| 97 | + php-version: |
| 98 | + - 7.4 |
| 99 | + runs-on: ubuntu-latest |
| 100 | + steps: |
| 101 | + - name: Checkout |
| 102 | + uses: actions/checkout@v2 |
| 103 | + |
| 104 | + - name: Setup PHP |
| 105 | + uses: shivammathur/setup-php@v2 |
| 106 | + with: |
| 107 | + php-version: ${{ matrix.php-version }} |
| 108 | + extensions: ftp, gd, json, zip |
| 109 | + coverage: none |
| 110 | + |
| 111 | + - name: Get composer cache directory |
| 112 | + id: composer-cache |
| 113 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 114 | + |
| 115 | + - name: Cache composer dependencies |
| 116 | + uses: actions/cache@v2 |
| 117 | + with: |
| 118 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 119 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 120 | + restore-keys: ${{ runner.os }}-composer- |
| 121 | + |
| 122 | + - name: Install dependencies |
| 123 | + run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader |
| 124 | + |
| 125 | + - name: Run phpunit |
| 126 | + run: vendor/bin/phpunit --testsuite serializer-test |
| 127 | + |
| 128 | + coding-guidelines: |
| 129 | + name: Coding Guidelines |
| 130 | + runs-on: ubuntu-latest |
| 131 | + steps: |
| 132 | + - name: checkout |
| 133 | + uses: actions/checkout@v2 |
| 134 | + |
| 135 | + - name: Setup PHP |
| 136 | + uses: shivammathur/setup-php@v2 |
| 137 | + with: |
| 138 | + php-version: 7.4 |
| 139 | + extensions: ftp, gd, json, zip |
| 140 | + tools: cs2pr |
| 141 | + coverage: none |
| 142 | + |
| 143 | + - name: Get composer cache directory |
| 144 | + id: composer-cache |
| 145 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 146 | + |
| 147 | + - name: Cache composer dependencies |
| 148 | + uses: actions/cache@v2 |
| 149 | + with: |
| 150 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 151 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 152 | + restore-keys: ${{ runner.os }}-composer- |
| 153 | + |
| 154 | + - name: Install dependencies |
| 155 | + run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader |
| 156 | + |
| 157 | + - name: Run phpcs |
| 158 | + run: vendor/bin/phpcs -q --report=checkstyle | cs2pr |
| 159 | + |
| 160 | + type-checker: |
| 161 | + name: Type Checker |
| 162 | + runs-on: ubuntu-latest |
| 163 | + steps: |
| 164 | + - name: Checkout |
| 165 | + uses: actions/checkout@v2 |
| 166 | + |
| 167 | + - name: Setup PHP |
| 168 | + uses: shivammathur/setup-php@v2 |
| 169 | + with: |
| 170 | + php-version: 7.4 |
| 171 | + extensions: ftp, gd, json, zip |
| 172 | + coverage: none |
| 173 | + |
| 174 | + - name: Get composer cache directory |
| 175 | + id: composer-cache |
| 176 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 177 | + |
| 178 | + - name: Cache composer dependencies |
| 179 | + uses: actions/cache@v2 |
| 180 | + with: |
| 181 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 182 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 183 | + restore-keys: ${{ runner.os }}-composer- |
| 184 | + |
| 185 | + - name: Install dependencies |
| 186 | + run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader |
| 187 | + |
| 188 | + - name: Run phpstan |
| 189 | + run: vendor/bin/phpstan analyse --no-interaction |
0 commit comments