Improve Actions #27

Merged
linos merged 30 commits from improve_actions into main 2024-09-21 14:06:11 +02:00
3 changed files with 24 additions and 7 deletions
Showing only changes of commit 1008bd62c8 - Show all commits

View file

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

View file

@ -65,13 +65,14 @@ jobs:
packages: mysql-client
version: 1.0
# - name: Install mysqladmin
# run: sudo apt update && sudo apt -y upgrade && sudo apt -y install mysql-client
- name: Setup Test Environment
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
- 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
- name: Unit Testing

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
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
fi
@ -11,6 +11,10 @@ DB_PASS=$3
DB_HOST=${4-localhost}
WP_VERSION=${5-latest}
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=$(echo $TMPDIR | sed -e "s/\/$//")
@ -54,7 +58,10 @@ fi
set -ex
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
return;
@ -97,6 +104,11 @@ install_wp() {
}
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
if [[ $(uname -s) == 'Darwin' ]]; then
local ioption='-i.bak'
@ -178,7 +190,11 @@ install_db() {
}
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/
}