Tests #51
This file contains hidden or 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: Tests | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
tests: | |
runs-on: ubuntu-24.04 | |
timeout-minutes: 20 | |
strategy: | |
fail-fast: false | |
matrix: | |
php: ['8.2', '8.3'] | |
stability: ['prefer-lowest', 'prefer-stable'] | |
laravel: ['^12.0'] | |
name: 'PHP ${{ matrix.php }} - Laravel: ${{matrix.laravel}} - ${{ matrix.stability }}' | |
services: | |
rabbitmq: | |
image: rabbitmq:3.13-management | |
ports: | |
- 5672:5672 | |
- 15672:15672 | |
env: | |
RABBITMQ_DEFAULT_USER: guest | |
RABBITMQ_DEFAULT_PASS: guest | |
options: >- | |
--health-cmd "curl -f http://localhost:15672/api/health/checks/alarms" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: dom, curl, libxml, mbstring, zip, json | |
coverage: none | |
tools: composer:v2.8.6 | |
- name: Get composer cache directory | |
id: composer-cache | |
shell: bash | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: deps-${{ runner.os }}-php${{ matrix.php }}-${{ matrix.stability }}-${{ hashFiles('composer.json') }} | |
restore-keys: | | |
deps-${{ runner.os }}-php${{ matrix.php }}-${{ matrix.stability }}- | |
deps-${{ runner.os }}-php${{ matrix.php }}- | |
- name: Install dependencies | |
timeout-minutes: 5 | |
run: | | |
composer update --with='laravel/framework:${{matrix.laravel}}' --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress | |
- name: Wait for RabbitMQ | |
timeout-minutes: 2 | |
run: | | |
until curl -s -u guest:guest http://localhost:15672/api/overview > /dev/null 2>&1; do | |
echo "Waiting for RabbitMQ Management API..." | |
sleep 1 | |
done | |
echo "RabbitMQ is ready!" | |
- name: Run style check | |
run: vendor/bin/pint --test | |
- name: Run tests | |
timeout-minutes: 5 | |
run: vendor/bin/phpunit --testdox | |
env: | |
HOST: localhost | |
PORT: 5672 | |
RABBITMQ_USER: guest | |
RABBITMQ_PASSWORD: guest | |
RABBITMQ_VHOST: / | |
COMPOSER_NO_INTERACTION: 1 | |
XDEBUG_MODE: off | |
- name: Store test logs | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
timeout-minutes: 1 | |
with: | |
name: test-logs-php${{ matrix.php }}-${{ matrix.stability }}-${{ github.sha }} | |
path: | | |
./tests/logs/**/* | |
./phpunit.xml | |
./.env.testing | |
retention-days: 5 |