|
| 1 | +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - master |
| 8 | + |
| 9 | +name: "Continuous Integration" |
| 10 | + |
| 11 | +jobs: |
| 12 | + coding-standards: |
| 13 | + name: "Coding Standards" |
| 14 | + |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: "Checkout" |
| 19 | + uses: actions/checkout@master |
| 20 | + |
| 21 | + - name: "Install PHP with extensions" |
| 22 | + uses: shivammathur/setup-php@v2 |
| 23 | + with: |
| 24 | + coverage: none |
| 25 | + extensions: mbstring |
| 26 | + php-version: 7.4 |
| 27 | + |
| 28 | + - name: "Validate composer.json and composer.lock" |
| 29 | + run: composer validate --strict |
| 30 | + |
| 31 | + - name: "Install locked dependencies with composer" |
| 32 | + run: composer install --no-interaction --no-progress --no-suggest |
| 33 | + |
| 34 | + - name: "Run localheinz/composer-normalize" |
| 35 | + run: composer normalize --dry-run |
| 36 | + |
| 37 | + static-code-analysis: |
| 38 | + name: "Static Code Analysis" |
| 39 | + |
| 40 | + runs-on: ubuntu-latest |
| 41 | + |
| 42 | + steps: |
| 43 | + - name: "Checkout" |
| 44 | + uses: actions/checkout@master |
| 45 | + |
| 46 | + - name: "Install PHP with extensions" |
| 47 | + uses: shivammathur/setup-php@v2 |
| 48 | + with: |
| 49 | + coverage: none |
| 50 | + extensions: mbstring |
| 51 | + php-version: 7.4 |
| 52 | + |
| 53 | + - name: "Install locked dependencies with composer" |
| 54 | + run: composer install --no-interaction --no-progress --no-suggest |
| 55 | + |
| 56 | + - name: "Run phpstan" |
| 57 | + run: vendor/bin/phpstan analyse --configuration=phpstan.neon |
| 58 | + |
| 59 | + tests: |
| 60 | + name: "Tests" |
| 61 | + |
| 62 | + runs-on: ubuntu-latest |
| 63 | + |
| 64 | + strategy: |
| 65 | + matrix: |
| 66 | + php-version: |
| 67 | + - 7.2 |
| 68 | + - 7.3 |
| 69 | + - 7.4 |
| 70 | + |
| 71 | + dependencies: |
| 72 | + - lowest |
| 73 | + - locked |
| 74 | + - highest |
| 75 | + |
| 76 | + steps: |
| 77 | + - name: "Checkout" |
| 78 | + uses: actions/checkout@master |
| 79 | + |
| 80 | + - name: "Install PHP with extensions" |
| 81 | + uses: shivammathur/setup-php@v2 |
| 82 | + with: |
| 83 | + coverage: none |
| 84 | + extensions: mbstring |
| 85 | + php-version: ${{ matrix.php-version }} |
| 86 | + |
| 87 | + - name: "Install lowest dependencies with composer" |
| 88 | + if: matrix.dependencies == 'lowest' |
| 89 | + run: composer update --prefer-lowest --no-interaction --no-progress --no-suggest |
| 90 | + |
| 91 | + - name: "Install locked dependencies with composer" |
| 92 | + if: matrix.dependencies == 'locked' |
| 93 | + run: composer install --no-interaction --no-progress --no-suggest |
| 94 | + |
| 95 | + - name: "Install highest dependencies with composer" |
| 96 | + if: matrix.dependencies == 'highest' |
| 97 | + run: composer update --no-interaction --no-progress --no-suggest |
| 98 | + |
| 99 | + - name: "Run unit tests with phpunit/phpunit" |
| 100 | + run: vendor/bin/phpunit |
| 101 | + |
| 102 | + code-coverage: |
| 103 | + name: "Code Coverage" |
| 104 | + |
| 105 | + runs-on: ubuntu-latest |
| 106 | + |
| 107 | + steps: |
| 108 | + - name: "Checkout" |
| 109 | + uses: actions/checkout@master |
| 110 | + |
| 111 | + - name: "Install PHP with extensions" |
| 112 | + uses: shivammathur/setup-php@v2 |
| 113 | + with: |
| 114 | + coverage: pcov |
| 115 | + extensions: mbstring |
| 116 | + php-version: 7.4 |
| 117 | + |
| 118 | + - name: "Install locked dependencies with composer" |
| 119 | + run: composer install --no-interaction --no-progress --no-suggest |
| 120 | + |
| 121 | + - name: "Dump Xdebug filter with phpunit/phpunit" |
| 122 | + run: vendor/bin/phpunit --dump-xdebug-filter=.build/phpunit/xdebug-filter.php |
| 123 | + |
| 124 | + - name: "Collect code coverage with Xdebug and phpunit/phpunit" |
| 125 | + run: vendor/bin/phpunit --coverage-clover=.build/logs/clover.xml --prepend=.build/phpunit/xdebug-filter.php |
| 126 | + |
| 127 | + - name: "Send code coverage report to codecov.io" |
| 128 | + env: |
| 129 | + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
| 130 | + run: bash <(curl -s https://codecov.io/bash) |
| 131 | + |
| 132 | + mutation-tests: |
| 133 | + name: "Mutation Tests" |
| 134 | + |
| 135 | + runs-on: ubuntu-latest |
| 136 | + |
| 137 | + steps: |
| 138 | + - name: "Checkout" |
| 139 | + uses: actions/checkout@master |
| 140 | + |
| 141 | + - name: "Install PHP with extensions" |
| 142 | + uses: shivammathur/setup-php@v2 |
| 143 | + with: |
| 144 | + coverage: pcov |
| 145 | + extensions: mbstring |
| 146 | + php-version: 7.4 |
| 147 | + |
| 148 | + - name: "Install locked dependencies with composer" |
| 149 | + run: composer install --no-interaction --no-progress --no-suggest |
| 150 | + |
| 151 | + - name: "Run mutation tests with infection/infection" |
| 152 | + run: vendor/bin/infection --ignore-msi-with-no-mutations --min-covered-msi=100 --min-msi=100 |
0 commit comments