Skip to content

tests

tests #122

Workflow file for this run

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://help.github.com/en/articles/workflow-syntax-for-github-actions>
build:
name: PHP ${{ matrix.php }}, ${{ matrix.setup }} setup
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
setup: ['basic', 'lowest']
php: ['8.0', '8.1', '8.2']
steps:
- name: Check out code
uses: actions/checkout@v3
- 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 # definition is required for php 7.4
- name: Syntax check only (lint)
run: find . -type f \( -name "*.php" -o -name "cs-fix" \) -not -path "./vendor*" -print0 | xargs -0 -n1 -P8 php -l
- name: Get Composer Cache Directory # Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer>
id: composer-cache
run: echo "output_dir=dir::$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies # Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer>
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.output_dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install lowest Composer dependencies
if: matrix.setup == 'lowest'
run: composer update --prefer-dist --no-interaction --prefer-lowest
- name: Install basic Composer dependencies
if: matrix.setup == 'basic'
run: composer update --prefer-dist --no-interaction
- name: Show most important packages versions
run: composer info | grep -e phpstan/phpstan
- name: Execute tests
run: composer test
- name: Try to execute
run: php ./cs-fix . --dry-run --diff
lint-changelog:
name: Lint changelog file
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- 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'