Skip to content

Prepare SSL-aware testing environment #101

Prepare SSL-aware testing environment

Prepare SSL-aware testing environment #101

Workflow file for this run

name: CI
on:
push:
pull_request:
# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
tests:
name: Tests (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
strategy:
matrix:
include:
- php: '5.6'
phpunit_config: 'phpunit.xml.dist' # PHPUnit 5.7
# - php: '7.0'
# phpunit_config: 'phpunit.xml.dist' # PHPUnit 6.5
# - php: '7.1'
# phpunit_config: 'phpunit7.xml.dist' # PHPUnit 7.5
# - php: '7.2'
# phpunit_config: 'phpunit7.xml.dist' # PHPUnit 8.5
# - php: '7.3'
# phpunit_config: 'phpunit9.xml.dist' # PHPUnit 9.6
# - php: '7.4'
# phpunit_config: 'phpunit9.xml.dist' # PHPUnit 9.6
# - php: '8.0'
# phpunit_config: 'phpunit9.xml.dist' # PHPUnit 9.6
# - php: '8.1'
# phpunit_config: 'phpunit10.xml.dist' # PHPUnit 10.5
# - php: '8.2'
# phpunit_config: 'phpunit10.xml.dist' # PHPUnit 10.5
# - php: '8.3'
# phpunit_config: 'phpunit10.xml.dist' # PHPUnit 10.5
fail-fast: false
env:
REPO_URL: http://localhost:8002/
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: xdebug
php-version: "${{ matrix.php }}"
tools: composer
# PHP 7.1 development web server segfaults if timezone not set.
ini-values: date.timezone=Europe/Paris, error_reporting=-1, display_errors=On
# - name: Configure for PHP >= 7.1
# if: "${{ matrix.php >= '7.1' }}"
# run: |
# composer require --no-update --dev symfony/error-handler "^4.4 || ^5.0"
#
# - name: Install dependencies
# uses: "ramsey/composer-install@v3"
# with:
# dependency-versions: "highest"
- name: Create a temporary folder
run: |
mkdir build
- name: Install mkcert
run: |
sudo apt-get update
sudo apt-get install libnss3-tools
cd build
curl -JLO "https://dl.filippo.io/mkcert/latest?for=linux/amd64"
chmod +x mkcert-v*-linux-amd64
sudo cp mkcert-v*-linux-amd64 /usr/local/bin/mkcert
- name: Generate an SSL certificate
run: |
cd build
mkcert -install
mkcert -key-file key.pem -cert-file cert.pem localhost 127.0.0.1 ::1
pwd
ls -la
- name: Setup test web server
run: |
php -S localhost:8002 -t $(pwd) > /dev/null 2> /tmp/webserver_output.txt &

Check failure on line 97 in .github/workflows/tests.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/tests.yml

Invalid workflow file

You have an error in your yaml syntax on line 97
- name: Setup Nginx
run: |
sudo chmod o+w /etc/nginx/sites-available/default
sudo cat tests/nginx_vhost_config > /etc/nginx/sites-available/default
sudo systemctl restart nginx.service
echo -n "\n----\n"
curl http://localhost:8002/tests/debug_response.php
# cat debug_response.php
echo -n "\n----\n"
curl https://localhost/tests/debug_response.php
# cat debug_response.php.1
echo -n "\n----\n"
curl --http1.0 https://localhost/tests/debug_response.php
# cat debug_response.php.2
echo -n "\n----\n"
# cat /var/log/nginx/error.log
# echo -n "\n----\n"
ls -la
- name: Setup upterm session
uses: lhotari/action-upterm@v1
- name: Wait for browser & PHP to start
run: |
while ! nc -z localhost 8002 </dev/null; do echo Waiting for PHP server to start...; sleep 1; done
- name: Run tests
run: |
vendor/bin/phpunit --configuration ${{ matrix.phpunit_config }} --log-junit junit.xml --coverage-clover clover.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
if: ${{ !cancelled() }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results to Codecov
uses: codecov/test-results-action@v1
if: ${{ !cancelled() }}
with:
token: ${{ secrets.CODECOV_TOKEN }}