- adds github actions #14
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: Unit Tests | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
concurrency: | |
cancel-in-progress: true | |
group: ${{ github.workflow }}-${{ github.ref }} | |
env: | |
CI: true | |
REDIS_SERVER_HOST: '127.0.0.1' | |
REDIS_SERVER_PORT: 6379 | |
MEMCACHED_POOL: '[["127.0.0.1",11211]]' | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
name: PHP ${{ matrix.php }} with Redis v${{ matrix.redis }} | |
strategy: | |
fail-fast: false | |
matrix: | |
php: | |
- '8.1' | |
- '8.2' | |
redis: | |
- 5 | |
- 6 | |
- 7 | |
services: | |
redis: | |
image: redis:${{ matrix.redis }} | |
options: --health-cmd="redis-cli ping" --health-retries=3 --health-interval=10s --health-timeout=5s | |
ports: | |
- 6379:6379 | |
memcached: | |
image: memcached | |
ports: | |
- 11211:11211 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 10 | |
- name: Setup PHP ${{ matrix.php }} with extensions | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: redis, memcached, msgpack, igbinary, shmop, zip | |
ini-values: opcache.enable=0 | |
tools: composer:v2 | |
coverage: xdebug | |
- name: Install composer and update | |
uses: ramsey/composer-install@v2 | |
with: | |
dependency-versions: highest | |
composer-options: '--no-progress --no-interaction' | |
- name: Run unit tests | |
if: ${{ matrix.php != '8.2' || matrix.redis != '7' }} | |
run: vendor/bin/phpunit | |
- name: Create coverage report | |
if: ${{ matrix.php == '8.2' && matrix.redis == '7' && github.repository == 'kodedphp/cache-simple' }} | |
run: vendor/bin/phpunit --coverage-clover build/clover.xml | |
- name: Send coverage | |
uses: sudo-bot/action-scrutinizer@latest | |
if: ${{ matrix.php == '8.2' && matrix.redis == '7' && github.repository == 'kodedphp/cache-simple' }} | |
with: | |
cli-args: "--format=php-clover build/clover.xml --revision=${{ github.sha }}" |