|
| 1 | +name: tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + tags-ignore: |
| 8 | + - '**' |
| 9 | + pull_request: |
| 10 | + schedule: |
| 11 | + - cron: '0 0 * * 0' # once in a week, docs: <https://git.io/JvxXE#onschedule> |
| 12 | + |
| 13 | +jobs: # Docs: <https://git.io/JvxXE> |
| 14 | + php: |
| 15 | + name: PHP ${{ matrix.php }}, ${{ matrix.setup }} setup, laravel ${{ matrix.laravel }} |
| 16 | + runs-on: ubuntu-latest |
| 17 | + timeout-minutes: 10 |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + setup: [basic, lowest] |
| 22 | + laravel: [default] |
| 23 | + coverage: [yes] |
| 24 | + php: ['7.2', '7.3', '7.4'] |
| 25 | + include: |
| 26 | + - php: '7.3' |
| 27 | + setup: basic |
| 28 | + coverage: no |
| 29 | + phpunit: '^7.5' |
| 30 | + laravel: '~5.7.0' |
| 31 | + - php: '7.3' |
| 32 | + setup: basic |
| 33 | + coverage: no |
| 34 | + laravel: '~5.8.0' |
| 35 | + - php: '7.3' |
| 36 | + setup: basic |
| 37 | + coverage: no |
| 38 | + laravel: '^6.0' |
| 39 | + steps: |
| 40 | + - name: Check out code |
| 41 | + uses: actions/checkout@v2 |
| 42 | + |
| 43 | + - name: Setup PHP, with composer and extensions |
| 44 | + uses: shivammathur/setup-php@v2 # Action page: <https://github.com/shivammathur/setup-php> |
| 45 | + with: |
| 46 | + php-version: ${{ matrix.php }} |
| 47 | + extensions: mbstring |
| 48 | + |
| 49 | + - name: Get Composer Cache Directory # Docs: <https://git.io/JfAKn#php---composer> |
| 50 | + id: composer-cache |
| 51 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 52 | + |
| 53 | + - name: Cache dependencies # Docs: <https://git.io/JfAKn#php---composer> |
| 54 | + uses: actions/cache@v2 |
| 55 | + with: |
| 56 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 57 | + key: ${{ runner.os }}-composer-${{ matrix.setup }}-${{ hashFiles('**/composer.json') }} |
| 58 | + restore-keys: ${{ runner.os }}-composer- |
| 59 | + |
| 60 | + - name: Install Composer 'hirak/prestissimo' package |
| 61 | + run: composer global require hirak/prestissimo --update-no-dev --no-progress --ansi |
| 62 | + |
| 63 | + - name: Install lowest Composer dependencies |
| 64 | + if: matrix.setup == 'lowest' |
| 65 | + run: composer update --prefer-dist --no-suggest --prefer-lowest --ansi |
| 66 | + |
| 67 | + - name: Install basic Composer dependencies |
| 68 | + if: matrix.setup == 'basic' |
| 69 | + run: composer update --prefer-dist --no-suggest --ansi |
| 70 | + |
| 71 | + - name: Install specific laravel version |
| 72 | + if: matrix.laravel != 'default' |
| 73 | + run: composer require --dev --update-with-dependencies --prefer-dist --no-suggest --ansi laravel/laravel "${{ matrix.laravel }}" |
| 74 | + |
| 75 | + - name: Install specific phpunit version |
| 76 | + if: matrix.phpunit != '' |
| 77 | + run: composer require --dev --update-with-dependencies --prefer-dist --no-suggest --ansi phpunit/phpunit "${{ matrix.phpunit }}" |
| 78 | + |
| 79 | + - name: Show most important packages versions |
| 80 | + run: composer info | grep -e laravel -e phpunit -e phpstan |
| 81 | + |
| 82 | + - name: Execute tests |
| 83 | + if: matrix.coverage != 'yes' |
| 84 | + run: composer test |
| 85 | + |
| 86 | + - name: Execute tests with code coverage |
| 87 | + if: matrix.coverage == 'yes' |
| 88 | + run: composer test-cover |
| 89 | + |
| 90 | + - uses: codecov/codecov-action@v1 # Docs: <https://github.com/codecov/codecov-action> |
| 91 | + if: matrix.coverage == 'yes' |
| 92 | + with: |
| 93 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 94 | + file: ./coverage/clover.xml |
| 95 | + flags: php |
| 96 | + fail_ci_if_error: false |
| 97 | + |
| 98 | + lint-changelog: |
| 99 | + name: Lint changelog file |
| 100 | + runs-on: ubuntu-latest |
| 101 | + steps: |
| 102 | + - name: Check out code |
| 103 | + uses: actions/checkout@v2 |
| 104 | + |
| 105 | + - name: Lint changelog file |
| 106 | + uses: docker://avtodev/markdown-lint:v1 # Action page: <https://github.com/avto-dev/markdown-lint> |
| 107 | + with: |
| 108 | + rules: '/lint/rules/changelog.js' |
| 109 | + config: '/lint/config/changelog.yml' |
| 110 | + args: './CHANGELOG.md' |
0 commit comments