Skip to content

Tests and linting

Tests and linting #71

Workflow file for this run

name: Tests and linting
on:
push:
pull_request:
branches: [ main ]
workflow_dispatch:
schedule:
- cron: '0 3 * * *'
jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
dependencies: ['']
include:
- { php-version: '7.3', dependencies: '--prefer-lowest' }
name: PHP ${{ matrix.php-version }} ${{ matrix.dependencies }} (unit tests)
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl, zip
coverage: xdebug
tools: composer:v2
- name: Cache Composer dependencies
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
run: composer update --no-interaction --no-progress --no-suggest ${{ matrix.dependencies }}
- name: Run tests
run: |
mkdir -p build/logs/
vendor/bin/phpunit --testsuite unit --colors=always --coverage-clover build/logs/clover.xml
- name: Submit coverage to Coveralls
if: github.event_name == 'pull_request'
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require --dev php-coveralls/php-coveralls
~/.composer/vendor/bin/php-coveralls --coverage_clover=./build/logs/clover.xml -v
integration-tests:
name: "Integration tests"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: mbstring, intl, zip
coverage: xdebug
tools: composer:v2
- name: Install dependencies
run: composer update --no-interaction --no-progress --no-suggest
- name: Run tests
env:
MATEJ_TEST_ACCOUNTID: ${{ secrets.MATEJ_TEST_ACCOUNTID }}
MATEJ_TEST_APIKEY: ${{ secrets.MATEJ_TEST_APIKEY }}
MATEJ_TEST_BASE_URL: ${{ secrets.MATEJ_TEST_BASE_URL }}
run: |
mkdir -p build/logs/
vendor/bin/phpunit --testsuite functional --colors=always --coverage-clover build/logs/clover.xml
- name: Submit coverage to Coveralls
if: github.event_name == 'pull_request'
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require --dev php-coveralls/php-coveralls
~/.composer/vendor/bin/php-coveralls --coverage_clover=./build/logs/clover.xml -v
codestyle:
name: "Code style and static analysis"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: mbstring, intl
- name: Cache Composer dependencies
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
run: composer update --no-interaction --no-progress --no-suggest
- name: Lint
run: composer lint
- name: Run checks
run: composer analyze
markdown-link-check:
name: "Markdown link check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-verbose-mode: 'yes'