Skip to content
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
46 changes: 45 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ jobs:
strategy:
matrix:
PHP_VERSION: [ '8.1', '8.3', '8.4' ]
OS: [ubuntu-latest, ubuntu-24.04]
name: Test Apache action
runs-on: ubuntu-latest
runs-on: ${{ matrix.OS }}
steps:
- name: Create fake site
run: |
Expand All @@ -23,6 +24,11 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.PHP_VERSION }}
extensions: :xdebug
- name: Ensure Xdebug is not running
run: |
php -m
php -r "if (extension_loaded('xdebug')) trigger_error('xdebug on', E_USER_ERROR);"
- uses: actions/checkout@v2
- name: Setup Apache
uses: ./
Expand All @@ -33,3 +39,41 @@ jobs:
- name: Test fake site
run: |
curl -sSf http://127.0.0.1:9090
- name: Ensure Xdebug is not running
run: |
php -m
php -r "if (extension_loaded('xdebug')) trigger_error('xdebug on', E_USER_ERROR);"
test-with-xdebug:
name: Test Apache action
runs-on: ubuntu-latest
steps:
- name: Create fake site
run: |
mkdir /tmp/sut
echo '<?php' | sudo tee /tmp/sut/index.php
echo ' $text = "It works!";' | sudo tee -a /tmp/sut/index.php
echo ' print "<strong>$text</strong>";' | sudo tee -a /tmp/sut/index.php
shell: bash
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
extensions: xdebug
- name: Ensure Xdebug is running
run: |
php -m
php -r "if (!extension_loaded('xdebug')) trigger_error('xdebug on', E_USER_ERROR);"
- uses: actions/checkout@v2
- name: Setup Apache
uses: ./
with:
php-version: 8.4
site-directory: /tmp/sut
http-port: 9090
- name: Test fake site
run: |
curl -sSf http://127.0.0.1:9090
- name: Ensure Xdebug is running
run: |
php -m
php -r "if (!extension_loaded('xdebug')) trigger_error('xdebug on', E_USER_ERROR);"
9 changes: 8 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,22 @@ inputs:
default: 8888\
# Install Apache and configure to serve the site under test. Apache is run
# in the foreground using the same user as the test runner to avoid common
# pitfalls with file ownership.
# pitfalls with file ownership. This action also disables xdebug if it has
# resulted in it being installed.
runs:
using: "composite"
steps:
- name: Install Apache with mod_php
run: |
WAS_XDEBUG_INSTALLED=`php -r "echo extension_loaded('xdebug');"`
LC_ALL=C.UTF-8 sudo apt-add-repository http://ppa.launchpad.net/ondrej/php/ubuntu
sudo apt install libapache2-mod-php${{ inputs.php-version }}
sudo a2enmod php${{ inputs.php-version }} rewrite
IS_XDEBUG_INSTALLED=`php -r "echo extension_loaded('xdebug');"`
if [[ "$IS_XDEBUG_INSTALLED" == "1" && "$WAS_XDEBUG_INSTALLED" != "1" ]]; then
echo "Disabling Xdebug"
sudo phpdismod xdebug
fi;
shell: bash
- name: Configure the site under test
run: |
Expand Down