tests #94
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: tests | |
on: | |
push: | |
branches: | |
- master | |
tags-ignore: | |
- '**' | |
pull_request: | |
schedule: | |
- cron: '0 0 * * 0' # once in a week, docs: <https://git.io/JvxXE#onschedule> | |
jobs: # Docs: <https://git.io/JvxXE> | |
php: | |
name: PHP ${{ matrix.php }}, ${{ matrix.setup }} setup, laravel ${{ matrix.laravel }} | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
strategy: | |
fail-fast: false | |
matrix: | |
setup: [basic, lowest] | |
laravel: [default] | |
coverage: [yes] | |
php: ['8.1','8.2','8.3'] | |
include: | |
- php: '8.1' | |
setup: [ basic, lowest ] | |
coverage: no | |
laravel: '^10.0' | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Setup PHP, with composer and extensions | |
uses: shivammathur/setup-php@v2 # Action page: <https://github.com/shivammathur/setup-php> | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: mbstring, xdebug | |
- name: Get Composer Cache Directory # Docs: <https://git.io/JfAKn#php---composer> | |
id: composer-cache | |
run: echo "output_dir=dir::$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies # Docs: <https://git.io/JfAKn#php---composer> | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache.outputs.output_dir }} | |
key: ${{ runner.os }}-composer-${{ matrix.setup }}-${{ hashFiles('**/composer.json') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install lowest Composer dependencies | |
if: matrix.setup == 'lowest' | |
run: composer update --prefer-dist --prefer-lowest --ansi | |
- name: Install basic Composer dependencies | |
if: matrix.setup == 'basic' | |
run: composer update --prefer-dist --ansi | |
- name: Install specific laravel version | |
if: matrix.laravel != 'default' | |
run: composer require --dev --with-all-dependencies --prefer-dist --ansi laravel/laravel "${{ matrix.laravel }}" | |
- name: Show most important package versions | |
run: composer info | grep -e laravel -e phpunit -e phpstan -e faker | |
- name: Execute tests | |
if: matrix.coverage != 'yes' | |
run: composer test | |
- name: Execute tests with code coverage | |
if: matrix.coverage == 'yes' | |
env: | |
XDEBUG_MODE: coverage | |
run: composer test-cover | |
- uses: codecov/codecov-action@v4 # Docs: <https://github.com/codecov/codecov-action> | |
if: matrix.coverage == 'yes' | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage/clover.xml | |
flags: php | |
fail_ci_if_error: false | |
lint-changelog: | |
name: Lint changelog file | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Lint changelog file | |
uses: docker://avtodev/markdown-lint:v1 # Action page: <https://github.com/avto-dev/markdown-lint> | |
with: | |
rules: '/lint/rules/changelog.js' | |
config: '/lint/config/changelog.yml' | |
args: './CHANGELOG.md' |