Skip to content

add new workflow to build and publish Docker images #32

add new workflow to build and publish Docker images

add new workflow to build and publish Docker images #32

Workflow file for this run

name: Unit Tests
on: [ push, pull_request, workflow_dispatch ]
jobs:
ci:
runs-on: ubuntu-22.04
strategy:
fail-fast: true
matrix:
phpunit: ["~8.0.0", "~8.0", "~9.0.0", "~9.0"]
name: Run Unit Tests With PHPUnit ${{ matrix.phpunit }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Services
run: |
docker-compose up -d
docker exec -t $(docker ps -qf "name=swoole") sh -c "composer require phpunit/phpunit ${{ matrix.phpunit }} -nq --no-progress"
sleep 15 # Seems that we need to give the MySQL container enough time to warm up.
docker ps
- name: Run Unit Tests
run: |
set -ex
# Check current version of PHPUnit.
docker exec -t $(docker ps -qf "name=swoole") sh -c "./vendor/bin/phpunit --version"
# Run tests using PHPUnit (Swoole is disabled).
docker exec -t $(docker ps -qf "name=php") sh -c "./vendor/bin/phpunit --testsuite global"
docker exec -t $(docker ps -qf "name=php") sh -c "./vendor/bin/phpunit --testsuite case-by-case"
# Run tests using PHPUnit, with Swoole enabled.
docker exec -t $(docker ps -qf "name=swoole") sh -c "./vendor/bin/phpunit --testsuite global"
docker exec -t $(docker ps -qf "name=swoole") sh -c "./vendor/bin/phpunit --testsuite case-by-case"
# Run tests using counit (Swoole is disabled).
docker exec -t $(docker ps -qf "name=php") sh -c "./counit --testsuite global"
docker exec -t $(docker ps -qf "name=php") sh -c "./counit --testsuite case-by-case"
# Run tests using counit, with Swoole enabled.
docker exec -t $(docker ps -qf "name=swoole") sh -c "./counit --testsuite global"
docker exec -t $(docker ps -qf "name=swoole") sh -c "./counit --testsuite case-by-case"
# Test compatibility with PHPUnit.
docker exec -t $(docker ps -qf "name=php") sh -c "./counit --testsuite compatibility"
docker exec -t $(docker ps -qf "name=swoole") sh -c "./counit --testsuite compatibility"
- name: Stop and Remove Docker Containers
run: docker-compose down