Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Laminas CI workflow for GHA #50

Merged
merged 1 commit into from
Feb 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .ci/php5.6.ini

This file was deleted.

21 changes: 0 additions & 21 deletions .ci/site.conf

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -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 }}
45 changes: 45 additions & 0 deletions .laminas-ci/phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true">
<coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="laminas-http Test Suite">
<directory>./test/</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>disable</group>
</exclude>
</groups>
<php>
<ini name="date.timezone" value="UTC"/>
<!-- OB_ENABLED should be enabled for some tests to check if all
functionality works as expected. Such tests include those for
Laminas\Soap and Laminas\Session, which require that headers not be sent
in order to work. -->
<env name="TESTS_LAMINAS_OB_ENABLED" value="false"/>
<!-- Laminas\Http\Client tests

To enable the dynamic Laminas\Http\Client tests, you will need to
symbolically link or copy the files in test/Client/_files to a
directory under your web server(s) document root and set this
constant to point to the URL of this directory. -->
<env name="TESTS_LAMINAS_HTTP_CLIENT_BASEURI" value="http://127.0.0.1"/>
<env name="TESTS_LAMINAS_HTTP_CLIENT_ONLINE" value="true"/>
<!-- Laminas\Http\Client\Proxy tests

HTTP proxy to be used for testing the Proxy adapter. Set to a
string of the form 'host:port'. Set to null to skip HTTP proxy
tests. -->
<env name="TESTS_LAMINAS_HTTP_CLIENT_HTTP_PROXY" value="127.0.0.1:8081"/>
<env name="TESTS_LAMINAS_HTTP_CLIENT_HTTP_PROXY_USER" value=""/>
<env name="TESTS_LAMINAS_HTTP_CLIENT_HTTP_PROXY_PASS" value=""/>

<env name="TESTS_LAMINAS_HTTP_CLIENT_NOTRESPONDINGURI" value="http://127.1.1.0:1234"/>
</php>
</phpunit>

14 changes: 14 additions & 0 deletions .laminas-ci/post-run.sh
Original file line number Diff line number Diff line change
@@ -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
48 changes: 48 additions & 0 deletions .laminas-ci/pre-run.sh
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions .ci/proxy.conf → .laminas-ci/proxy.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<VirtualHost *:8081>
ServerName 127.0.0.1
ServerAlias localhost

ProxyRequests On

ErrorLog ${APACHE_LOG_DIR}/error.log
Expand Down
16 changes: 16 additions & 0 deletions .laminas-ci/site.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<VirtualHost *:80>
ServerName 127.0.0.1
ServerAlias localhost
DocumentRoot %BUILD_DIR%/test/Client/_files

<Directory "%BUILD_DIR%/test/Client/_files">
Options FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>

<FilesMatch \.php$>
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
SetHandler "proxy:unix:/run/php/php%PHP_VERSION%-fpm.sock|fcgi://localhost"
</FilesMatch>
</VirtualHost>
98 changes: 0 additions & 98 deletions .travis.yml

This file was deleted.