Merge pull request #3794 from Spuds/themeTweak #793
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
name: MaxPain | |
on: | |
push: | |
branches: # Run tests when commits are pushed to these branches | |
- development | |
pull_request: # Run tests when pull requests are made on these branches | |
branches: | |
- development | |
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 Server Environment | |
env: | |
DB: ${{ matrix.db }} | |
PHP_VERSION: ${{ matrix.php }} | |
WEBSERVER: 'nginx' | |
run: .github/setup-elkarte.sh | |
working-directory: ./elkarte | |
- name: Run Unit Tests | |
env: | |
DB: ${{ matrix.db }} | |
PHP_VERSION: ${{ matrix.php }} | |
run: .github/setup-selenium.sh | |
working-directory: ./elkarte | |
continue-on-error: true | |
- name: Send Coverage Reports | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: codecov/codecov-action@v4 | |
with: | |
files: /home/runner/work/Elkarte/Elkarte/elkarte/tmp/web.xml | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: false | |
- name: Server Error Log | |
env: | |
DB: ${{ matrix.db }} | |
PHP_VERSION: ${{ matrix.php }} | |
run: | | |
sudo cat /var/log/nginx/127.0.0.1.error.log | |
sudo cat /tmp/php_errors.log | |
sudo cat /tmp/selenium.log | |
working-directory: ./elkarte | |
# End Selenium headless browser testing | |
# Static checks, e.g. syntax errors, lint, etc | |
static-checks: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
include: | |
- db: 'none' | |
php: '8.2' | |
name: Static Tests | |
steps: | |
- name: Checkout ElkArte | |
uses: actions/checkout@v4 | |
with: | |
repository: elkarte/elkarte | |
fetch-depth: 10 | |
ref: ${{ env.ELKARTE_BRANCH }} | |
path: elkarte | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: dom, curl, libxml, mbstring, zip, gd, exif, iconv | |
coverage: none | |
tools: composer:v2 | |
ini-values: error_reporting=E_ALL, allow_url_fopen=On, opcache.enable=0 | |
- name: Setup Server Environment | |
env: | |
DB: ${{ matrix.db }} | |
PHP_VERSION: ${{ matrix.php }} | |
run: .github/setup-elkarte.sh | |
working-directory: ./elkarte | |
- name: Install NodeJS | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 18 | |
- name: Install Linters | |
run: npm install --save-dev jshint stylelint stylelint-order stylelint-config-recommended | |
#- name: Run StyleLint | |
# run: npx stylelint "**/*.css" | |
# working-directory: ./elkarte | |
- name: Run JSHint | |
run: ../node_modules/jshint/bin/jshint . --config .jshintrc --exclude-path .jshintignore | |
working-directory: ./elkarte | |
- name: Syntax/Header Checks | |
run: vendor/bin/phpunit --stderr --verbose --debug --configuration .github/phpunit-static.xml | |
working-directory: ./elkarte | |
# End Static Testing | |
# START MySQL / MariaDB Tests | |
mysql-tests: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
include: | |
- php: '8.2' | |
db: "mariadb:10.2" | |
- php: '8.1' | |
db: "mysql:5.7" | |
- php: '8.2' | |
db: "mysql:8.0" | |
name: MySql/MariaDB (${{ 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 | |
- 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_reporting=E_ALL, allow_url_fopen=On, opcache.enable=0, apc.enable_cli=1 | |
- name: Setup problem matchers for PHP | |
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" | |
- name: Setup Server Environment | |
env: | |
DB: ${{steps.database-type.outputs.db}} | |
PHP_VERSION: ${{ matrix.php }} | |
run: .github/setup-elkarte.sh | |
working-directory: ./elkarte | |
- name: Install Database | |
env: | |
DB: ${{steps.database-type.outputs.db}} | |
PHP_VERSION: ${{ matrix.php }} | |
run: .github/setup-database.sh | |
working-directory: ./elkarte | |
- name: Run Unit Tests | |
env: | |
DB: ${{steps.database-type.outputs.db}} | |
PHP_VERSION: ${{ matrix.php }} | |
run: .github/setup-results.sh | |
working-directory: ./elkarte | |
- name: Send Coverage Reports | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: codecov/codecov-action@v4 | |
with: | |
files: /home/runner/work/Elkarte/Elkarte/elkarte/tmp/db.xml | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: false | |
# END MySQL and MariaDB Job | |
# START Postgres Tests | |
postgres-tests: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
include: | |
- php: '8.1' | |
db: "postgres:9" | |
- php: '8.2' | |
db: "postgres:12" | |
name: Postgre (${{ matrix.php }} - DB ${{ matrix.db_alias != '' && matrix.db_alias || matrix.db }}) | |
services: | |
postgres: | |
image: ${{ matrix.db }} | |
env: | |
POSTGRES_HOST: localhost | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
ports: | |
- 5432:5432 | |
options: >- | |
-v /var/run/postgresql:/var/run/postgresql | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
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 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: dom, curl, libxml, mbstring, zip, pgsql, imagick, exif, iconv, apcu, memcached | |
coverage: xdebug | |
tools: composer:v2 | |
ini-values: error_reporting=E_ALL, allow_url_fopen=On, opcache.enable=0, apc.enable_cli=1 | |
- name: Setup problem matchers for PHP | |
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" | |
- name: Setup Server Environment | |
env: | |
DB: ${{steps.database-type.outputs.db}} | |
PHP_VERSION: ${{ matrix.php }} | |
run: .github/setup-elkarte.sh | |
working-directory: ./elkarte | |
- name: Install Database | |
env: | |
DB: ${{steps.database-type.outputs.db}} | |
PHP_VERSION: ${{ matrix.php }} | |
run: .github/setup-database.sh | |
working-directory: ./elkarte | |
- name: Run Unit Tests | |
env: | |
DB: ${{steps.database-type.outputs.db}} | |
PHP_VERSION: ${{ matrix.php }} | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
run: .github/setup-results.sh | |
working-directory: ./elkarte | |
- name: Send Coverage Reports | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: codecov/codecov-action@v4 | |
with: | |
files: /home/runner/work/Elkarte/Elkarte/elkarte/tmp/db.xml | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: false | |
# END Postgres Job |