You've already forked phpmyadmin
mirror of
https://github.com/phpmyadmin/phpmyadmin.git
synced 2026-10-23 18:29:15 +03:00
156 lines
4.8 KiB
YAML
156 lines
4.8 KiB
YAML
name: "End-to-End tests"
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
branches:
|
|
- master
|
|
- QA_**
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
env:
|
|
php-version: "8.2"
|
|
node-version: '24'
|
|
|
|
jobs:
|
|
generate-matrix:
|
|
name: Generate the matrix of Selenium tests
|
|
if: "!contains(github.event.head_commit.message, '[ci selenium skip]')"
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
tests: ${{ steps.tests-list.outputs.tests }}
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v7
|
|
with:
|
|
persist-credentials: false
|
|
- id: tests-list
|
|
name: Send test names to outputs
|
|
run: |
|
|
set -euo pipefail
|
|
TEST_NAMES="[$(find $PWD/tests/end-to-end/ -type f -name '*Test.php' -print |sed -E "s,$PWD/tests/end-to-end/(.*)Test.php,{\"test-name\": \"\1\"}," | paste -sd ",")]"
|
|
echo "tests=$(printf "$TEST_NAMES")" >> $GITHUB_OUTPUT
|
|
selenium:
|
|
name: "Selenium"
|
|
if: "!contains(github.event.head_commit.message, '[ci selenium skip]')"
|
|
needs: generate-matrix
|
|
runs-on: "ubuntu-latest"
|
|
services:
|
|
database-server:
|
|
image: "mysql:5.7"
|
|
env:
|
|
MYSQL_ROOT_PASSWORD: testbench
|
|
ports:
|
|
- "3306:3306"
|
|
options: >-
|
|
--health-cmd="mysqladmin ping"
|
|
--health-interval=10s
|
|
--health-timeout=5s
|
|
--health-retries=3
|
|
|
|
selenium-server:
|
|
image: selenium/standalone-chrome:4
|
|
volumes:
|
|
- /dev/shm:/dev/shm
|
|
options: >-
|
|
--health-cmd "/opt/bin/check-grid.sh"
|
|
env:
|
|
SCREEN_WIDTH: 1920
|
|
SCREEN_HEIGHT: 1080
|
|
ports:
|
|
- "4444:4444"
|
|
|
|
docker-host-bridge:
|
|
# Allow accessing localhost ports from docker containers.
|
|
# See https://github.com/qoomon/docker-host
|
|
image: qoomon/docker-host
|
|
options: >-
|
|
--name docker-host-bridge
|
|
--hostname docker-host-bridge
|
|
--add-host docker-host-bridge:127.0.0.1
|
|
--cap-add=NET_ADMIN
|
|
--cap-add=NET_RAW
|
|
--restart on-failure
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include: ${{ fromJSON(needs.generate-matrix.outputs.tests) }}
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v7
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install gettext and generate translation files
|
|
run: |
|
|
sudo apt-get install -y gettext
|
|
./bin/generate-mo --quiet
|
|
|
|
- name: Set up PHP ${{ env.php-version }}
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ env.php-version }}
|
|
extensions: :opcache, mbstring, iconv, mysqli, zip, gd, bz2
|
|
coverage: none
|
|
|
|
- name: Install Composer dependencies
|
|
uses: ramsey/composer-install@v4
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v7
|
|
with:
|
|
node-version: '${{ env.node-version }}'
|
|
cache: 'yarn'
|
|
|
|
- name: Install modules
|
|
run: yarn install --non-interactive --production
|
|
|
|
- name: Copy the config
|
|
run: cp tests/config.e2e.inc.php config.inc.php
|
|
|
|
- name: Start server
|
|
env:
|
|
CI_MODE: selenium
|
|
FPM_PATH: php-fpm${{ env.php-version }}
|
|
SKIP_STANDALONE: 1
|
|
run: |
|
|
sudo chown -R runner:docker /var/lib/nginx/
|
|
sudo chown -R runner:docker /var/log/nginx/
|
|
./tests/start-local-server
|
|
echo "SELENIUM_TEMPDIR=$(cat /tmp/last_temp_dir_phpMyAdminTests)" >> $GITHUB_OUTPUT
|
|
id: start-local-server
|
|
|
|
- name: Run Selenium tests
|
|
env:
|
|
CI_MODE: selenium
|
|
TESTSUITE_SELENIUM_BROWSER: chrome
|
|
TESTSUITE_USER: root
|
|
TESTSUITE_PASSWORD: testbench
|
|
# Port defined in tests/nginx.conf
|
|
TESTSUITE_URL: http://docker-host-bridge:8000
|
|
TESTSUITE_DATABASE_PREFIX: "selenium"
|
|
TESTSUITE_SELENIUM_HOST: "127.0.0.1"
|
|
TESTSUITE_SELENIUM_PORT: "4444"
|
|
run: ./vendor/bin/phpunit --testsuite end-to-end --no-logging --no-coverage --display-all-issues --stop-on-skipped --testdox tests/end-to-end/${{ matrix.test-name }}Test.php
|
|
|
|
- name: Output logs and stop server
|
|
env:
|
|
CI_MODE: selenium
|
|
SELENIUM_TEMPDIR: ${{ steps.start-local-server.outputs.SELENIUM_TEMPDIR }}
|
|
if: ${{ success() || failure() }}
|
|
run: |
|
|
if [ -f "${SELENIUM_TEMPDIR}/php.log" ] ; then cat "${SELENIUM_TEMPDIR}/php.log" ; fi
|
|
if [ -f "${SELENIUM_TEMPDIR}/nginx-error.log" ] ; then cat "${SELENIUM_TEMPDIR}/nginx-error.log" ; fi
|
|
./tests/stop-local-server
|
|
|
|
- name: Upload screenshots
|
|
uses: actions/upload-artifact@v7
|
|
if: ${{ failure() }}
|
|
with:
|
|
name: selenium-screenshots-${{ strategy.job-index }}
|
|
path: ${{ github.workspace }}/build/selenium/**/*
|
|
retention-days: 3
|