diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d74119c..7c932fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,8 +27,6 @@ jobs: uses: actions/checkout@v2 - name: Test - run: | - bash tests/before_script.sh - bash tests/script.sh + run: bash tests/ci.sh env: CI_PHP_VERSION: ${{ matrix.php }} diff --git a/examples/multi_curl_get_load_test.php b/examples/multi_curl_get_load_test.php index 6b93431..d124477 100644 --- a/examples/multi_curl_get_load_test.php +++ b/examples/multi_curl_get_load_test.php @@ -3,12 +3,12 @@ require __DIR__ . '/../vendor/autoload.php'; use Curl\MultiCurl; -$server_count = 5; +$server_count = 7; $urls = []; $port = 8000; for ($i = 0; $i < $server_count; $i++) { - $port += 1; $urls[] = 'http://localhost:' . $port . '/'; + $port += 1; } $multi_curl = new MultiCurl(); diff --git a/tests/before_script.sh b/tests/before_script.sh deleted file mode 100755 index 69747a4..0000000 --- a/tests/before_script.sh +++ /dev/null @@ -1,34 +0,0 @@ -start_php_servers() { - for i in $(seq 0 6); do - port=8000 - (( port += $i )) - php -S "127.0.0.1:${port}" -t tests/PHPCurlClass/ & - done -} - -set -x -echo "CI_PHP_VERSION: ${CI_PHP_VERSION}" -php -r "var_dump(phpversion());" -php -r "var_dump(curl_version());" - -composer self-update -composer install --prefer-source --no-interaction - -# Let test server know we should allow testing. -export PHP_CURL_CLASS_TEST_MODE_ENABLED="yes" - -if [[ "${CI_PHP_VERSION}" == "7.0" ]]; then - start_php_servers -elif [[ "${CI_PHP_VERSION}" == "7.1" ]]; then - start_php_servers -elif [[ "${CI_PHP_VERSION}" == "7.2" ]]; then - start_php_servers -elif [[ "${CI_PHP_VERSION}" == "7.3" ]]; then - start_php_servers -elif [[ "${CI_PHP_VERSION}" == "7.4" ]]; then - start_php_servers -elif [[ "${CI_PHP_VERSION}" == "8.0" ]]; then - start_php_servers -elif [[ "${CI_PHP_VERSION}" == "nightly" ]]; then - start_php_servers -fi diff --git a/tests/script.sh b/tests/ci.sh similarity index 81% rename from tests/script.sh rename to tests/ci.sh index ac8f0e8..113beda 100755 --- a/tests/script.sh +++ b/tests/ci.sh @@ -1,3 +1,25 @@ +set -x + +echo "CI_PHP_VERSION: ${CI_PHP_VERSION}" +php -r "var_dump(phpversion());" +php -r "var_dump(curl_version());" + +composer self-update +composer install --prefer-source --no-interaction + +# Let test server know we should allow testing. +export PHP_CURL_CLASS_TEST_MODE_ENABLED="yes" + +# Start test servers. Run servers on different ports to allow simultaneous +# requests without blocking. +server_count=7 +for i in $(seq 0 $(("${server_count}" - 1))); do + port=8000 + (( port += $i )) + + php -S "127.0.0.1:${port}" -t tests/PHPCurlClass/ & +done + SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "${SCRIPT_DIR}" @@ -34,9 +56,6 @@ errors=() source "check_syntax.sh" -# Let test server know we should allow testing. -export PHP_CURL_CLASS_TEST_MODE_ENABLED="yes" - # Determine which phpunit to use. if [[ -f "../vendor/bin/phpunit" ]]; then phpunit_to_use="../vendor/bin/phpunit" diff --git a/www/index.php b/www/index.php index 240c6c9..8459557 100644 --- a/www/index.php +++ b/www/index.php @@ -180,22 +180,22 @@ p:last-child { + src="https://img.shields.io/github/release/php-curl-class/php-curl-class.svg?style=flat-square" /> + src="https://img.shields.io/github/license/php-curl-class/php-curl-class.svg?style=flat-square" /> + src="https://img.shields.io/github/workflow/status/php-curl-class/php-curl-class/ci?style=flat-square" /> + src="https://img.shields.io/packagist/dt/php-curl-class/php-curl-class.svg?style=flat-square" />