|
| 1 | +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions |
| 2 | + |
| 3 | +name: "Continuous Integration" |
| 4 | + |
| 5 | +on: |
| 6 | + - "pull_request" |
| 7 | + - "push" |
| 8 | + |
| 9 | +jobs: |
| 10 | + |
| 11 | + continuous-integration: |
| 12 | + name: "Continuous Integration" |
| 13 | + |
| 14 | + runs-on: "ubuntu-latest" |
| 15 | + |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + php-version: |
| 19 | + - "7.2" |
| 20 | + - "7.3" |
| 21 | + - "7.4" |
| 22 | + |
| 23 | + dependencies: |
| 24 | + - "highest" |
| 25 | + |
| 26 | + steps: |
| 27 | + - name: "Checkout" |
| 28 | + uses: "actions/checkout@v2" |
| 29 | + |
| 30 | + - name: "Install PHP with extensions" |
| 31 | + uses: "shivammathur/setup-php@v2" |
| 32 | + with: |
| 33 | + coverage: "pcov" |
| 34 | + php-version: "${{ matrix.php-version }}" |
| 35 | + |
| 36 | + - name: "Cache dependencies installed with composer" |
| 37 | + uses: "actions/cache@v1" |
| 38 | + with: |
| 39 | + path: "~/.composer/cache" |
| 40 | + key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}" |
| 41 | + restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" |
| 42 | + |
| 43 | + - name: "Install dependencies with composer" |
| 44 | + run: "composer install --no-interaction" |
| 45 | + |
| 46 | + - name: "Run tests with phpunit/phpunit" |
| 47 | + run: "vendor/bin/phpunit" |
| 48 | + |
| 49 | + - name: "Run static code analysis with phpstan/phpstan" |
| 50 | + run: "composer phpstan" |
| 51 | + |
| 52 | + - name: "Run coding standard checks with squizlabs/php_codesniffer" |
| 53 | + run: "composer cs-check" |
| 54 | + |
| 55 | + - name: "Archive code coverage results" |
| 56 | + uses: "actions/upload-artifact@v1" |
| 57 | + with: |
| 58 | + name: "codeCoverage" |
| 59 | + path: "build" |
| 60 | + |
| 61 | + - uses: codecov/codecov-action@v1 # upload the coverage to codecov |
| 62 | + with: |
| 63 | + fail_ci_if_error: true # optional (default = false) |
0 commit comments