test
All checks were successful
PHP Code Checker / Run PHP Code Checker (pull_request) Successful in 1m9s
Unit Testing / Run phpunit tests (pull_request) Successful in 1m13s

This commit is contained in:
André Menrath 2024-09-21 13:11:43 +02:00
parent 50c25cdc4e
commit 1008bd62c8
3 changed files with 24 additions and 7 deletions

View file

@ -33,7 +33,7 @@ jobs:
./vendor/ ./vendor/
/root/.cache/composer/ /root/.cache/composer/
/usr/local/bin/composer /usr/local/bin/composer
key: cache-composer-2 key: cache-composer-3
- name: Setup PHP - name: Setup PHP
uses: https://github.com/shivammathur/setup-php@v2 uses: https://github.com/shivammathur/setup-php@v2

View file

@ -65,13 +65,14 @@ jobs:
packages: mysql-client packages: mysql-client
version: 1.0 version: 1.0
# - name: Install mysqladmin
# run: sudo apt update && sudo apt -y upgrade && sudo apt -y install mysql-client
- name: Setup Test Environment - name: Setup Test Environment
if: steps.cache-wordpress.outputs.cache-hit != 'true' if: steps.cache-wordpress.outputs.cache-hit != 'true'
run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 6.6 run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 6.6
- name: Setup WordPress Test Database
if: steps.cache-wordpress.outputs.cache-hit != 'false'
run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 6.6 false true true true
- run: composer show -i - run: composer show -i
- name: Unit Testing - name: Unit Testing

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if [ $# -lt 3 ]; then if [ $# -lt 3 ]; then
echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version] [skip-database-creation]" echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version] [skip-database-creation] [skip-wp-install] [skip-plugins] [skip-test-suite]"
exit 1 exit 1
fi fi
@ -11,6 +11,10 @@ DB_PASS=$3
DB_HOST=${4-localhost} DB_HOST=${4-localhost}
WP_VERSION=${5-latest} WP_VERSION=${5-latest}
SKIP_DB_CREATE=${6-false} SKIP_DB_CREATE=${6-false}
SKIP_WP_INSTALL=${7-false}
SKIP_PLUGINS_INSTALL=${8-false}
SKIP_TEST_SUITE_INSTALL=${9-false}
TMPDIR=${TMPDIR-/tmp} TMPDIR=${TMPDIR-/tmp}
TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//") TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//")
@ -54,7 +58,10 @@ fi
set -ex set -ex
install_wp() { install_wp() {
rm -rf $WP_CORE_DIR if [ "$SKIP_WP_INSTALL" = "true" ]; then
echo "Skipping WordPress installation."
return 0
fi
if [ -d $WP_CORE_DIR ]; then if [ -d $WP_CORE_DIR ]; then
return; return;
@ -97,6 +104,11 @@ install_wp() {
} }
install_test_suite() { install_test_suite() {
if [ "$SKIP_TEST_SUITE_INSTALL" = "true" ]; then
echo "Skipping test suite installation."
return 0
fi
# portable in-place argument for both GNU sed and Mac OSX sed # portable in-place argument for both GNU sed and Mac OSX sed
if [[ $(uname -s) == 'Darwin' ]]; then if [[ $(uname -s) == 'Darwin' ]]; then
local ioption='-i.bak' local ioption='-i.bak'
@ -178,7 +190,11 @@ install_db() {
} }
install_wp_plugins() { install_wp_plugins() {
download https://downloads.wordpress.org/plugin/activitypub.3.2.5.zip $TMPDIR/activitypub.zip if [ "$SKIP_PLUGINS_INSTALL" = "true" ]; then
echo "Skipping WordPress plugin installation."
return 0
fi
download https://downloads.wordpress.org/plugin/activitypub.3.2.5.zip $TMPDIR/activitypub.zip
unzip $TMPDIR/activitypub.zip -d $WP_CORE_DIR/wp-content/plugins/ unzip $TMPDIR/activitypub.zip -d $WP_CORE_DIR/wp-content/plugins/
} }