Skip to content

Simple Testing

Simple Testing #755

Workflow file for this run

name: MaxPain
on:
push:
branches: # Run tests when commits are pushed to these branches
- '**'
pull_request: # Run tests when pull requests are made on these branches
branches:
- '**'
env:
WEBSERVER: 'none'
jobs:
# Selenium headless browser testing
Selenium-checks:
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- db: 'mysql:5.7'
php: '8.1'
name: WebTest (PHP ${{ matrix.php }} - DB ${{ matrix.db_alias != '' && matrix.db_alias || matrix.db }})
services:
mysql:
image: ${{ matrix.db }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: elkarte_test
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- name: Checkout ElkArte
uses: actions/checkout@v4
with:
repository: elkarte/Elkarte
fetch-depth: 10
ref: ${{ env.ELKARTE_BRANCH }}
path: elkarte
- id: database-type
env:
MATRIX_DB: ${{ matrix.db }}
run: |
db=$(echo "${MATRIX_DB%%:*}")
echo "db=$db" >> $GITHUB_OUTPUT
.github/setup-webtest-php.sh
working-directory: ./elkarte
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, mysqli, gd, exif, iconv, apcu, memcached
coverage: xdebug
tools: composer:v2
ini-values: error_log=/tmp/php_errors.log, error_reporting=E_ALL, allow_url_fopen=On, opcache.enable=0, auto_prepend_file="/usr/share/php/prepend.php", auto_append_file="/usr/share/php/append.php"
- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Setup Web Server Environment
env:
DB: ${{ matrix.db }}
PHP_VERSION: ${{ matrix.php }}
WEBSERVER: 'nginx'
run: .github/setup-elkarte.sh $DB $PHP_VERSION
working-directory: ./elkarte
- name: Run Unit Tests
env:
DB: ${{ matrix.db }}
PHP_VERSION: ${{ matrix.php }}
run: .github/setup-selenium.sh $DB $PHP_VERSION
working-directory: ./elkarte
continue-on-error: true
- name: Code Coverage Report
env:
DB: ${{ matrix.db }}
PHP_VERSION: ${{ matrix.php }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: .github/setup-failure.sh $DB $PHP_VERSION $CODECOV_TOKEN
working-directory: ./elkarte
- name: Server Logs
run: |
sudo cat /var/log/nginx/127.0.0.1.error.log
sudo cat /tmp/php_errors.log
sudo cat /tmp/selenium.log
# End Selenium headless browser testing