Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup test scripts #3789

Merged
merged 3 commits into from
Apr 15, 2024
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
2 changes: 1 addition & 1 deletion .github/phpunit-mariadb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<directory suffix=".php">../sources/ext</directory>
</exclude>
<report>
<clover outputFile="/tmp/madb.xml"/>
<clover outputFile="/home/runner/work/Elkarte/Elkarte/elkarte/tmp/db.xml"/>
</report>
</coverage>

Expand Down
2 changes: 1 addition & 1 deletion .github/phpunit-mysql.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<directory suffix=".php">../sources/ext</directory>
</exclude>
<report>
<clover outputFile="/tmp/mydb.xml"/>
<clover outputFile="/home/runner/work/Elkarte/Elkarte/elkarte/tmp/db.xml"/>
</report>
</coverage>

Expand Down
2 changes: 1 addition & 1 deletion .github/phpunit-postgres.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<directory suffix=".php">../sources/ext</directory>
</exclude>
<report>
<clover outputFile="/tmp/pgdb.xml"/>
<clover outputFile="/home/runner/work/Elkarte/Elkarte/elkarte/tmp/db.xml"/>
</report>
</coverage>

Expand Down
2 changes: 1 addition & 1 deletion .github/phpunit-webtest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<directory suffix=".php">../sources/ext</directory>
</exclude>
<report>
<clover outputFile="/tmp/web.xml"/>
<clover outputFile="/home/runner/work/Elkarte/Elkarte/elkarte/tmp/web.xml"/>
</report>
</coverage>

Expand Down
2 changes: 0 additions & 2 deletions .github/setup-database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
set -e
set -x

DB=$1

# Setup a Database
if [[ "$DB" == "postgres" ]]
then
Expand Down
5 changes: 1 addition & 4 deletions .github/setup-elkarte.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
set -e
set -x

DB=$1
PHP_VERSION=$2

# Refresh package list upfront
sudo apt-get update -qq

Expand All @@ -15,7 +12,7 @@ sudo apt-get install coreutils memcached -qq > /dev/null
# Webserver setup
if [[ "$DB" != "none" ]]
then
if [[ "$WEBSERVER" != "none" ]]; then .github/setup-nginx.sh $DB $PHP_VERSION; fi
if [[ "$WEBSERVER" != "none" ]]; then .github/setup-nginx.sh "$DB" "$PHP_VERSION"; fi

# Start a memcached service on localhost and the default port so we can test cache engines
memcached -p 11212 -d
Expand Down
19 changes: 0 additions & 19 deletions .github/setup-failure.sh

This file was deleted.

8 changes: 2 additions & 6 deletions .github/setup-nginx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
set -e
set -x

DB=$1
PHP_VERSION=$2

DIR=$(dirname "$0")
USER=$(whoami)
ELKARTE_ROOT_PATH=$(realpath "$DIR/../elkarte")
Expand Down Expand Up @@ -43,11 +40,10 @@ echo "
security.limit_extensions = .php

php_admin_value[memory_limit] = 128M
" > $PHP_FPM_CONF
" > "$PHP_FPM_CONF"

# Add our pool config to PHP-FPM
sudo $PHP_FPM_BIN \
--fpm-config "$DIR/php-fpm.conf"
sudo "$PHP_FPM_BIN" --fpm-config "$DIR/php-fpm.conf"

# Default Nginx conf needs to be updated with correct user
sudo sed -i "s/user www-data;/user $USER;/g" $NGINX_CONF
Expand Down
13 changes: 1 addition & 12 deletions .github/setup-results.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,8 @@
set -e
set +x

# Passed params
DB=$1
PHP_VERSION=$2
CODECOV_TOKEN=$3

# Build a config string for PHPUnit
CONFIG="--verbose --configuration .github/phpunit-${DB}.xml"
CONFIG="--verbose --configuration .github/phpunit-$DB.xml"

# Running PHPUnit tests
vendor/bin/phpunit ${CONFIG}

# Agents will merge all coverage data...
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]
then
bash <(curl -s https://codecov.io/bash) -s "/tmp" -f '*.xml' -t "${CODECOV_TOKEN}"
fi
4 changes: 0 additions & 4 deletions .github/setup-selenium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
set -e
set -x

# Access passed params
DB=$1
PHP_VERSION=$2

# Some vars to make this easy to change
SELENIUM_HUB_URL='http://127.0.0.1:4444'
SELENIUM_JAR=/usr/share/selenium/selenium-server-standalone.jar
Expand Down
49 changes: 32 additions & 17 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,24 @@ jobs:
DB: ${{ matrix.db }}
PHP_VERSION: ${{ matrix.php }}
WEBSERVER: 'nginx'
run: .github/setup-elkarte.sh $DB $PHP_VERSION
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 $DB $PHP_VERSION
run: .github/setup-selenium.sh
working-directory: ./elkarte
continue-on-error: true

- name: Code Coverage
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: 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:
Expand Down Expand Up @@ -138,7 +138,7 @@ jobs:
env:
DB: ${{ matrix.db }}
PHP_VERSION: ${{ matrix.php }}
run: .github/setup-elkarte.sh $DB $PHP_VERSION
run: .github/setup-elkarte.sh
working-directory: ./elkarte

- name: Install NodeJS
Expand Down Expand Up @@ -223,23 +223,30 @@ jobs:
env:
DB: ${{steps.database-type.outputs.db}}
PHP_VERSION: ${{ matrix.php }}
run: .github/setup-elkarte.sh $DB $PHP_VERSION
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 $DB $PHP_VERSION
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 $DB $PHP_VERSION $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 MySQL and MariaDB Job

# START Postgres Tests
Expand Down Expand Up @@ -303,21 +310,29 @@ jobs:
env:
DB: ${{steps.database-type.outputs.db}}
PHP_VERSION: ${{ matrix.php }}
run: .github/setup-elkarte.sh $DB $PHP_VERSION
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 $DB $PHP_VERSION
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 $DB $PHP_VERSION $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
Loading