diff --git a/.ci/php5.6.ini b/.ci/php5.6.ini deleted file mode 100644 index 904df42a..00000000 --- a/.ci/php5.6.ini +++ /dev/null @@ -1 +0,0 @@ -always_populate_raw_post_data=-1 diff --git a/.ci/site.conf b/.ci/site.conf deleted file mode 100644 index 327c2af8..00000000 --- a/.ci/site.conf +++ /dev/null @@ -1,21 +0,0 @@ - - DocumentRoot %TRAVIS_BUILD_DIR%/test/Client/_files - - - Options FollowSymLinks MultiViews ExecCGI - AllowOverride All - Require all granted - - - # Wire up Apache to use Travis CI's php-fpm. - - AddHandler php%PHP_VERSION%-fcgi .php - Action php%PHP_VERSION%-fcgi /php%PHP_VERSION%-fcgi - Alias /php%PHP_VERSION%-fcgi /usr/lib/cgi-bin/php%PHP_VERSION%-fcgi - FastCgiExternalServer /usr/lib/cgi-bin/php%PHP_VERSION%-fcgi -host 127.0.0.1:9000 -pass-header Authorization - - - Require all granted - - - diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml new file mode 100644 index 00000000..907b42d4 --- /dev/null +++ b/.github/workflows/continuous-integration.yml @@ -0,0 +1,33 @@ +name: "Continuous Integration" + +on: + pull_request: + push: + branches: + - '[0-9]+.[0-9]+.x' + - 'refs/pull/*' + tags: + +jobs: + matrix: + name: Generate job matrix + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.matrix.outputs.matrix }} + steps: + - name: Gather CI configuration + id: matrix + uses: laminas/laminas-ci-matrix-action@v1 + + qa: + name: QA Checks + needs: [matrix] + runs-on: ${{ matrix.operatingSystem }} + strategy: + fail-fast: false + matrix: ${{ fromJSON(needs.matrix.outputs.matrix) }} + steps: + - name: ${{ matrix.name }} + uses: laminas/laminas-continuous-integration-action@v1 + with: + job: ${{ matrix.job }} diff --git a/.laminas-ci/phpunit.xml b/.laminas-ci/phpunit.xml new file mode 100644 index 00000000..7891a5c3 --- /dev/null +++ b/.laminas-ci/phpunit.xml @@ -0,0 +1,45 @@ + + + + + ./src + + + + + ./test/ + + + + + disable + + + + + + + + + + + + + + + + + + diff --git a/.laminas-ci/post-run.sh b/.laminas-ci/post-run.sh new file mode 100755 index 00000000..58fe1edf --- /dev/null +++ b/.laminas-ci/post-run.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -e + +EXIT_STATUS=$1 +JOB=$4 +COMMAND=$(echo "${JOB}" | jq -r '.command') + +if [[ "${EXIT_STATUS}" == "0" || ! ${COMMAND} =~ phpunit ]]; then + exit 0 +fi + +cat /var/log/apache2/error.log +cat /var/log/apache2/access.log diff --git a/.laminas-ci/pre-run.sh b/.laminas-ci/pre-run.sh new file mode 100755 index 00000000..3e09684c --- /dev/null +++ b/.laminas-ci/pre-run.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +set -e + +TEST_USER=$1 +WORKSPACE=$2 +JOB=$3 + +COMMAND=$(echo "${JOB}" | jq -r '.command') + +if [[ ! ${COMMAND} =~ phpunit ]]; then + exit 0 +fi + +PHP_VERSION=$(echo "${JOB}" | jq -r '.php') + +# Install CI version of phpunit config +cp .laminas-ci/phpunit.xml phpunit.xml + +# Install dependendies +apt update -qq +apt install -y apache2 php${PHP_VERSION}-fpm + +# Enable required modules +a2enmod rewrite actions proxy_fcgi setenvif alias +a2enconf php${PHP_VERSION}-fpm + +# Setup and start php-fpm +echo "cgi.fix_pathinfo = 1" >> /etc/php/${PHP_VERSION}/fpm/php.ini +sed -i -e "s,www-data,${TEST_USER},g" /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf +sed -i -e "s,www-data,${TEST_USER},g" /etc/apache2/envvars +service php${PHP_VERSION}-fpm start + +# configure apache virtual hosts +echo "ServerName 127.0.0.1" >> /etc/apache2/apache2.conf +cp -f .laminas-ci/site.conf /etc/apache2/sites-available/000-default.conf +sed -i -e "s?%BUILD_DIR%?${WORKSPACE}?g" /etc/apache2/sites-available/000-default.conf +sed -i -e "s?%PHP_VERSION%?${PHP_VERSION}?g" /etc/apache2/sites-available/000-default.conf + +# enable TRACE +sed -i -e "s?TraceEnable Off?TraceEnable On?g" /etc/apache2/conf-available/security.conf + +# configure proxy +a2enmod proxy proxy_http proxy_connect +cp -f .laminas-ci/proxy.conf /etc/apache2/sites-available/proxy.conf +a2ensite proxy +sed -i -e "s/Listen 80/Listen 80\nListen 8081/" /etc/apache2/ports.conf +service apache2 restart diff --git a/.ci/proxy.conf b/.laminas-ci/proxy.conf similarity index 75% rename from .ci/proxy.conf rename to .laminas-ci/proxy.conf index 3dcc3a7f..4d9b86fe 100644 --- a/.ci/proxy.conf +++ b/.laminas-ci/proxy.conf @@ -1,4 +1,7 @@ + ServerName 127.0.0.1 + ServerAlias localhost + ProxyRequests On ErrorLog ${APACHE_LOG_DIR}/error.log diff --git a/.laminas-ci/site.conf b/.laminas-ci/site.conf new file mode 100644 index 00000000..048199bf --- /dev/null +++ b/.laminas-ci/site.conf @@ -0,0 +1,16 @@ + + ServerName 127.0.0.1 + ServerAlias localhost + DocumentRoot %BUILD_DIR%/test/Client/_files + + + Options FollowSymLinks MultiViews + AllowOverride All + Require all granted + + + + SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 + SetHandler "proxy:unix:/run/php/php%PHP_VERSION%-fpm.sock|fcgi://localhost" + + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 108932ac..00000000 --- a/.travis.yml +++ /dev/null @@ -1,98 +0,0 @@ -language: php - -cache: - directories: - - $HOME/.composer/cache - -env: - global: - - COMPOSER_ARGS="--no-interaction" - - COVERAGE_DEPS="php-coveralls/php-coveralls" - - TESTS_LAMINAS_HTTP_CLIENT_ONLINE=true - - TESTS_LAMINAS_HTTP_CLIENT_BASEURI=http://127.0.0.1 - - TESTS_LAMINAS_HTTP_CLIENT_HTTP_PROXY=127.0.0.1:8081 - - TESTS_LAMINAS_HTTP_CLIENT_NOTRESPONDINGURI=http://127.1.1.0:1234 - -matrix: - fast_finish: true - include: - - php: 7.3 - env: - - DEPS=lowest - - php: 7.3 - env: - - DEPS=latest - - php: 7.4 - env: - - DEPS=lowest - - php: 7.4 - env: - - DEPS=latest - - CS_CHECK=true - - TEST_COVERAGE=true - - php: 8.0 - env: - - DEPS=lowest - - COMPOSER_ARGS="--no-interaction --ignore-platform-req=php" - - php: 8.0 - env: - - COMPOSER_ARGS="--no-interaction --ignore-platform-req=php" - - php: nightly - env: - - DEPS=lowest - - COMPOSER_ARGS="--no-interaction --ignore-platform-req=php" - - php: nightly - env: - - DEPS=latest - - COMPOSER_ARGS="--no-interaction --ignore-platform-req=php" - allow_failures: - - php: nightly - -before_install: - - if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi - -install: - - travis_retry composer install $COMPOSER_ARGS --ignore-platform-reqs - - if [[ $LEGACY_DEPS != '' ]]; then travis_retry composer update $COMPOSER_ARGS --with-dependencies $LEGACY_DEPS ; fi - - if [[ $DEPS == 'latest' ]]; then travis_retry composer update $COMPOSER_ARGS ; fi - - if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --prefer-lowest --prefer-stable $COMPOSER_ARGS ; fi - - if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry composer require --dev $COMPOSER_ARGS $COVERAGE_DEPS ; fi - - stty cols 120 && composer show - -before_script: - # custom php.ini for PHP 5.6 - - if [[ ${TRAVIS_PHP_VERSION:0:3} == "5.6" ]]; then phpenv config-add .ci/php5.6.ini; fi - # install apache - - sudo apt-get update -qq - - sudo apt-get install apache2 libapache2-mod-fastcgi - # enable php-fpm - - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf - - sudo a2enmod rewrite actions fastcgi alias - - echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini - - sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars - - sudo chown -R travis:travis /var/lib/apache2/fastcgi - - ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm - # configure apache virtual hosts - - sudo cp -f .ci/site.conf /etc/apache2/sites-available/000-default.conf - - sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf - - sudo sed -e "s?%PHP_VERSION%?$(phpenv version-name)?g" --in-place /etc/apache2/sites-available/000-default.conf - # enable TRACE - - sudo sed -e "s?TraceEnable Off?TraceEnable On?g" --in-place /etc/apache2/conf-available/security.conf - # configure proxy - - sudo a2enmod proxy proxy_http proxy_connect - - sudo cp -f .ci/proxy.conf /etc/apache2/sites-available/proxy.conf - - sudo a2ensite proxy - - sudo sed -i "s/Listen 80/Listen 80\nListen 8081/" /etc/apache2/ports.conf - - sudo service apache2 restart - -script: - - if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; else composer test ; fi - - if [[ $CS_CHECK == 'true' ]]; then composer cs-check ; fi - -after_script: - - if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry php vendor/bin/php-coveralls -v ; fi - - sudo cat /var/log/apache2/error.log - - sudo cat /var/log/apache2/access.log - -notifications: - email: false