Skip to content

use GitHub Action isbang/compose-action to manage Docker containers #494

use GitHub Action isbang/compose-action to manage Docker containers

use GitHub Action isbang/compose-action to manage Docker containers #494

Workflow file for this run

name: Unit Tests
on: [ push, pull_request, workflow_dispatch ]
jobs:
# Run unit tests with Swoole 5.1+.
unit-tests:
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix:
php: ["8.1", "8.2", "8.3"]
swoole-prefix: ["5.1-", ""]
name: Run Tests Using Image ${{ matrix.swoole-prefix }}php${{ matrix.php }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Customize Dockerfile
run: sed -i.bak -e "s/^FROM phpswoole\/swoole.*$/FROM phpswoole\/swoole:${{ matrix.swoole-prefix }}php${{ matrix.php }}/g" ./Dockerfile
- name: Start Docker Containers
uses: isbang/compose-action@v2.0.0
- name: Prepare Test Environment
run: |
docker-compose exec -T app php -v
docker-compose exec -T app php --ri swoole
docker-compose exec -T app composer install -n -q --no-progress
sleep 40s
- name: Run Unit Tests
run: docker-compose exec -T app composer test