Tests - fix fixtures #421
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: CI | |
on: | |
push: | |
branches: | |
- '2.x' | |
- '3.x' | |
pull_request: | |
branches: | |
- '*' | |
permissions: | |
contents: read | |
jobs: | |
testsuite: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
php-version: ['8.1', '8.2'] | |
db-type: [pgsql] | |
prefer-lowest: [''] | |
name: PHP ${{ matrix.php-version }} | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: watcher_nms | |
ports: | |
- 5432/tcp | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3 | |
redis: | |
image: redis | |
ports: | |
- 6379/tcp | |
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
memcached: | |
image: memcached | |
ports: | |
- 11211/tcp | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
extensions: mbstring, intl, apcu, memcached, redis, snmp, pdo_${{ matrix.db-type }} | |
ini-values: apc.enable_cli = 1 | |
coverage: pcov | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Get date part for cache key | |
id: key-date | |
run: echo "date=$(date +'%Y-%m')" >> $GITHUB_OUTPUT | |
- name: Cache composer dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }} | |
- name: Composer update | |
run: | | |
composer update | |
composer run-script post-install-cmd --no-interaction | |
# Add a step to run migrations if required | |
- name: Test with phpunit | |
run: vendor/bin/phpunit | |
env: | |
REDIS_PORT: ${{ job.services.redis.ports['6379'] }} | |
MEMCACHED_PORT: ${{ job.services.memcached.ports['11211'] }} | |
DATABASE_TEST_URL: postgres://postgres@127.0.0.1:${{ job.services.postgres.ports['5432'] }}/watcher_nms | |
DEBUG: 'true' | |
cs-stan: | |
name: Coding Standard & Static Analysis | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
extensions: mbstring, intl, apcu, memcached, redis, snmp | |
tools: cs2pr | |
coverage: none | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Get date part for cache key | |
id: key-date | |
run: echo "date=$(date +'%Y-%m')" >> $GITHUB_OUTPUT | |
- name: Cache composer dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }} | |
- name: Composer update | |
run: | | |
composer update | |
composer run-script post-install-cmd --no-interaction | |
- name: Run PHP CodeSniffer | |
run: vendor/bin/phpcs --report=checkstyle | cs2pr | |
- name: Run psalm | |
if: success() || failure() | |
run: vendor/bin/psalm.phar --output-format=github | |
- name: Run phpstan | |
if: success() || failure() | |
run: vendor/bin/phpstan.phar analyse --error-format=checkstyle | cs2pr |