Update composer cache dir step #51
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: testing | |
on: | |
push: | |
branches: | |
- 'release' | |
- '*.x' | |
pull_request: | |
branches: | |
- 'release' | |
- '*.x' | |
jobs: | |
test: | |
name: Testing on PHP ${{ matrix.php-versions }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-versions: [ '8.3' ] | |
services: | |
redis: | |
image: redis | |
ports: | |
- 6379:6379 | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
memcached: | |
image: memcached | |
ports: | |
- 11211:11211 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
coverage: pcov | |
extensions: "sodium,mbstring,json,memcached,redis" | |
ini-values: opcache.jit_buffer_size=256M, opcache.jit=1235, pcre.jit=1 | |
tools: cs2pr | |
- name: Setup problem matchers for PHP | |
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" | |
- name: Setup problem matchers for PHPUnit | |
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | |
- name: Validate composer.json and composer.lock | |
run: composer validate | |
- name: Get Composer Cache Directory | |
id: composer-cache-dir | |
run: | | |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache Composer packages | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache-dir.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install dependencies | |
run: composer install --prefer-dist --no-progress | |
- name: Run PHP CS Fixer | |
run: | | |
php vendor/bin/php-cs-fixer fix \ | |
--format=checkstyle \ | |
--dry-run \ | |
--diff \ | |
| cs2pr | |
- name: Run Psalm analysis | |
run: | | |
php vendor/bin/psalm \ | |
--output-format=checkstyle \ | |
| cs2pr | |
- name: PHP Security Checker | |
uses: StephaneBour/actions-php-security-checker@1.2 | |
- name: Run PHPUnit tests | |
run: | | |
php vendor/bin/phpunit \ | |
--coverage-text \ | |
--coverage-html=coverage/html \ | |
--coverage-clover=coverage/clover.xml | |
env: | |
REDIS_HOST: localhost | |
REDIS_PORT: 6379 | |
MEMCACHED_HOST: localhost | |
MEMCACHED_PORT: 11211 | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Coverage report | |
path: coverage |