|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - 'main' |
| 8 | + |
| 9 | +jobs: |
| 10 | + composer-validate: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + name: "Composer Validate" |
| 13 | + steps: |
| 14 | + - name: 'Checkout Code' |
| 15 | + uses: actions/checkout@v2 |
| 16 | + |
| 17 | + - name: 'Validate composer.json' |
| 18 | + run: composer validate --no-check-all --strict --no-check-lock |
| 19 | + |
| 20 | + composer-install: |
| 21 | + needs: composer-validate |
| 22 | + runs-on: ubuntu-latest |
| 23 | + name: "Composer Install" |
| 24 | + steps: |
| 25 | + - name: 'Checkout Code' |
| 26 | + uses: actions/checkout@v2 |
| 27 | + |
| 28 | + - name: 'Install Dependencies' |
| 29 | + run: composer install --prefer-dist --no-progress --no-interaction |
| 30 | + |
| 31 | + code-style: |
| 32 | + needs: composer-install |
| 33 | + runs-on: ubuntu-latest |
| 34 | + name: "Code Style" |
| 35 | + strategy: |
| 36 | + fail-fast: false |
| 37 | + steps: |
| 38 | + - name: 'Checkout Code' |
| 39 | + uses: actions/checkout@v2 |
| 40 | + |
| 41 | + - name: 'Setup PHP' |
| 42 | + uses: shivammathur/setup-php@v2 |
| 43 | + with: |
| 44 | + php-version: 8.0 |
| 45 | + ini-values: memory_limit=-1 |
| 46 | + coverage: none |
| 47 | + tools: composer:v2 |
| 48 | + |
| 49 | + - name: 'Install PHP dependencies with Composer' |
| 50 | + run: composer install --prefer-dist --no-progress --optimize-autoloader |
| 51 | + working-directory: './' |
| 52 | + |
| 53 | + - name: 'Run CodeSniffer' |
| 54 | + run: ./vendor/bin/phpcs ./ -p --encoding=utf-8 --extensions=php --ignore=vendor --ignore=tests --standard=phpcs.xml |
| 55 | + |
| 56 | + static-analysis: |
| 57 | + needs: composer-install |
| 58 | + runs-on: ubuntu-latest |
| 59 | + name: "Static Analysis" |
| 60 | + strategy: |
| 61 | + fail-fast: false |
| 62 | + steps: |
| 63 | + - name: 'Checkout Code' |
| 64 | + uses: actions/checkout@v2 |
| 65 | + |
| 66 | + - name: 'Setup PHP' |
| 67 | + uses: shivammathur/setup-php@v2 |
| 68 | + with: |
| 69 | + php-version: 8.0 |
| 70 | + ini-values: memory_limit=-1 |
| 71 | + coverage: none |
| 72 | + tools: composer:v2 |
| 73 | + |
| 74 | + - name: 'Install PHP dependencies with Composer' |
| 75 | + run: composer install --prefer-dist --no-progress --optimize-autoloader |
| 76 | + working-directory: './' |
| 77 | + |
| 78 | + - name: 'Run PHPStan' |
| 79 | + run: ./vendor/bin/phpstan analyse --no-progress -c phpstan.neon ./ |
| 80 | + |
| 81 | + test: |
| 82 | + needs: composer-install |
| 83 | + runs-on: ubuntu-latest |
| 84 | + name: "Tests (PHP ${{ matrix.php-version }})" |
| 85 | + strategy: |
| 86 | + fail-fast: false |
| 87 | + matrix: |
| 88 | + php-version: |
| 89 | + - '7.2' |
| 90 | + - '7.3' |
| 91 | + - '7.4' |
| 92 | + - '8.0' |
| 93 | + steps: |
| 94 | + - name: 'Checkout Code' |
| 95 | + uses: actions/checkout@v2 |
| 96 | + |
| 97 | + - name: 'Setup PHP' |
| 98 | + uses: shivammathur/setup-php@v2 |
| 99 | + with: |
| 100 | + php-version: ${{ matrix.php-version }} |
| 101 | + ini-values: memory_limit=-1 |
| 102 | + coverage: none |
| 103 | + tools: composer:v2 |
| 104 | + |
| 105 | + - name: 'Install PHP dependencies with Composer' |
| 106 | + run: composer install --prefer-dist --no-progress --optimize-autoloader |
| 107 | + working-directory: './' |
| 108 | + |
| 109 | + - name: 'Run PHPUnit' |
| 110 | + run: ./vendor/bin/phpunit -v -c phpunit.xml.dist |
| 111 | + |
| 112 | + code-coverage: |
| 113 | + needs: test |
| 114 | + runs-on: ubuntu-latest |
| 115 | + name: "Code Coverage" |
| 116 | + strategy: |
| 117 | + fail-fast: false |
| 118 | + steps: |
| 119 | + - name: 'Checkout Code' |
| 120 | + uses: actions/checkout@v2 |
| 121 | + |
| 122 | + - name: 'Setup PHP' |
| 123 | + uses: shivammathur/setup-php@v2 |
| 124 | + with: |
| 125 | + php-version: 7.4 |
| 126 | + ini-values: memory_limit=-1 |
| 127 | + coverage: pcov |
| 128 | + tools: composer:v2 |
| 129 | + |
| 130 | + - name: 'Install PHP dependencies with Composer' |
| 131 | + run: composer install --prefer-dist --no-progress --optimize-autoloader |
| 132 | + working-directory: './' |
| 133 | + |
| 134 | + - name: 'Run PHPUnit with Code Coverage' |
| 135 | + run: ./vendor/bin/phpunit -v -c phpunit.xml.dist --coverage-clover=coverage.xml |
| 136 | + |
| 137 | + - name: 'Download Coverage Files' |
| 138 | + uses: actions/download-artifact@v2 |
| 139 | + with: |
| 140 | + path: reports |
| 141 | + |
| 142 | + - name: 'Upload to Codecov' |
| 143 | + uses: codecov/codecov-action@v1 |
| 144 | + with: |
| 145 | + files: ./coverage.xml |
| 146 | + fail_ci_if_error: true |
| 147 | + verbose: true |
0 commit comments