Skip to content

Unit Tests

Unit Tests #121

Workflow file for this run

name: Unit Tests
on:
push:
pull_request:
schedule:
- cron: '0 0 * * *'
jobs:
php-tests:
runs-on: ${{ matrix.os }}
env:
COMPOSER_NO_INTERACTION: 1
strategy:
matrix:
os: [ ubuntu-latest ]
php: [ '8.3', '8.2', '8.1', '8.0' ]
hyperf: [ '~3.0.0', '~3.1.0' ]
dependency-version: [prefer-lowest, prefer-stable]
exclude:
- hyperf: '~3.1.0'
php: '8.0'
- hyperf: '~3.0.0'
php: '8.3'
max-parallel: 12
fail-fast: false
name: PHP${{ matrix.php }} - Hyperf${{ matrix.hyperf }} - ${{ matrix.dependency-version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: swoole-5.1.1
ini-values: swoole.use_shortname=Off
tools: composer:v2
- name: Install dependencies
run: |
composer require "hyperf/di:${{ matrix.hyperf }}" --no-interaction --no-update
composer require "hyperf/http-server:${{ matrix.hyperf }}" --no-interaction --no-update
composer require "hyperf/config:${{ matrix.hyperf }}" --dev --no-interaction --no-update
composer require "hyperf/testing:${{ matrix.hyperf }}" --dev --no-interaction --no-update
composer require "hyperf/validation:${{ matrix.hyperf }}" --dev --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-progress
- name: Fix phpunit/phpunit for php 8.3
if: matrix.php == '8.3'
run: |
composer update phpunit/phpunit:~10.0.10
- name: Fix swow/psr7-plus for hypef 3.1
if: matrix.hyperf == '~3.1.0'
run: |
composer update swow/psr7-plus:~1.1.2
- name: Run Test Cases
run: composer test