Skip to content

Commit

Permalink
Verify Swoole version in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sshymko committed Nov 28, 2023
1 parent f1cbb25 commit 8747ece
Showing 1 changed file with 38 additions and 5 deletions.
43 changes: 38 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
php-version: [ '8.2', '8.3' ]
php-version: [ '8.1', '8.2' ]
swoole-version:
- swoole-4.8.12
- swoole-5.0.3
Expand All @@ -23,6 +23,19 @@ jobs:
- openswoole-22.0.0
- openswoole-22.1.0
- openswoole
include:
- os: ubuntu-latest
php-version: '8.3'
swoole-version: swoole-5.1.1
- os: ubuntu-latest
php-version: '8.3'
swoole-version: swoole
- os: ubuntu-latest
php-version: '8.3'
swoole-version: openswoole-22.1.0
- os: ubuntu-latest
php-version: '8.3'
swoole-version: openswoole
steps:
- name: Checkout source code
uses: actions/checkout@v3
Expand All @@ -36,14 +49,24 @@ jobs:
coverage: none
env:
fail-fast: true
- name: Update permissions
run: sudo chown -R $USER:$USER /var/lib/php/sessions
- name: Verify PHP environment
run: php --ri swoole || php --ri openswoole
id: verify
run: |
php --ri swoole || php --ri openswoole
swoole_version="$(php -r "echo defined('SWOOLE_VERSION') ? 'swoole-' . SWOOLE_VERSION : 'openswoole-' . OPENSWOOLE_VERSION;")"
echo "Installed $swoole_version"
echo "swoole_version=$swoole_version" >> "$GITHUB_OUTPUT"
- name: Install dependencies
if: success() && contains(steps.verify.outputs.swoole_version, matrix.swoole-version)
run: composer install -n
- name: Update permissions
run: sudo chown -R $USER:$USER /var/lib/php/sessions
- name: Run test suite
if: success() && contains(steps.verify.outputs.swoole_version, matrix.swoole-version)
run: vendor/bin/phpunit
- name: Fail incomplete
if: success() && contains(steps.*.conclusion, 'skipped')
run: exit 1

test-redis:
name: Test ${{ matrix.swoole-version }} with redis against php ${{ matrix.php-version }} on ${{ matrix.os }}
Expand Down Expand Up @@ -82,8 +105,18 @@ jobs:
env:
fail-fast: true
- name: Verify PHP environment
run: php --ri swoole || php --ri openswoole
id: verify
run: |
php --ri swoole || php --ri openswoole
swoole_version="$(php -r "echo defined('SWOOLE_VERSION') ? 'swoole-' . SWOOLE_VERSION : 'openswoole-' . OPENSWOOLE_VERSION;")"
echo "Installed $swoole_version"
echo "swoole_version=$swoole_version" >> "$GITHUB_OUTPUT"
- name: Install dependencies
if: success() && contains(steps.verify.outputs.swoole_version, matrix.swoole-version)
run: composer install -n
- name: Run test suite
if: success() && contains(steps.verify.outputs.swoole_version, matrix.swoole-version)
run: vendor/bin/phpunit
- name: Fail incomplete
if: success() && contains(steps.*.conclusion, 'skipped')
run: exit 1

0 comments on commit 8747ece

Please sign in to comment.