-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
qa: migrate to Laminas CI workflow for GHA
This patch adopts the Laminas CI workflow, following some prototyping (and the release) for the 1.1.0 release of the CI container to allow for pre/post run scripts. This patch provides the following: - `.laminas-ci/pre-run.sh`: - exits early if not for a PHPUnit job - installs the CI version of the PHPUnit configuration - installs apache2 and the php-fpm relevant to the current PHP version - enables required apache2 modules - provides php-fpm and apache configuration for running tests against - found in `laminas-ci/{site.conf,proxy.conf}` - starts the php-fpm and apache2 services - `.laminas-ci/post-run.sh`: - exits early if not for a PHPUnit job - if a non-zero exit status was provided, it cats the apache2 access and error logs Signed-off-by: Matthew Weier O'Phinney <[email protected]>
- Loading branch information
1 parent
38b7ebd
commit 079a410
Showing
9 changed files
with
159 additions
and
120 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file was deleted.
Oops, something went wrong.