diff --git a/.github/helper/install.sh b/.github/helper/install.sh new file mode 100644 index 00000000..1db3def8 --- /dev/null +++ b/.github/helper/install.sh @@ -0,0 +1,51 @@ +#!/bin/bash +set -e +cd ~ || exit + +echo "Setting Up Bench..." + +pip install frappe-bench +bench -v init frappe-bench --skip-assets --python "$(which python)" --frappe-path "${GITHUB_WORKSPACE}" +cd ./frappe-bench || exit + +bench -v setup requirements --dev +if [ "$TYPE" == "ui" ] +then + bench -v setup requirements --node; +fi + +echo "Setting Up LMS App..." +bench get-app lms "${GITHUB_WORKSPACE}" + +echo "Setting Up Sites & Database..." + +mkdir ~/frappe-bench/sites/lms.test +cp "${GITHUB_WORKSPACE}/.github/helper/db/$DB.json" ~/frappe-bench/sites/lms.test/site_config.json + + +mariadb --host 127.0.0.1 --port 3306 -u root -ptravis -e "SET GLOBAL character_set_server = 'utf8mb4'"; +mariadb --host 127.0.0.1 --port 3306 -u root -ptravis -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'"; + +mariadb --host 127.0.0.1 --port 3306 -u root -ptravis -e "CREATE DATABASE test_lms"; +mariadb --host 127.0.0.1 --port 3306 -u root -ptravis -e "CREATE USER 'test_lms'@'localhost' IDENTIFIED BY 'test_lms'"; +mariadb --host 127.0.0.1 --port 3306 -u root -ptravis -e "GRANT ALL PRIVILEGES ON \`test_lms\`.* TO 'test_lms'@'localhost'"; + +mariadb --host 127.0.0.1 --port 3306 -u root -ptravis -e "FLUSH PRIVILEGES"; + +echo "Setting Up Procfile..." + +sed -i 's/^watch:/# watch:/g' Procfile +sed -i 's/^schedule:/# schedule:/g' Procfile + +echo "Starting Bench..." + +bench start &> bench_start.log & + +CI=Yes bench build & +build_pid=$! + + +bench --site lms.test reinstall --yes +bench --site lms.test install-app lms + +wait $build_pid diff --git a/.github/helper/install_dependencies.sh b/.github/helper/install_dependencies.sh new file mode 100644 index 00000000..b8da0226 --- /dev/null +++ b/.github/helper/install_dependencies.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -e + +echo "Setting Up System Dependencies..." + +sudo apt update +sudo apt install libcups2-dev redis-server mariadb-client-10.6 + +install_wkhtmltopdf() { + wget -q https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb + sudo apt install ./wkhtmltox_0.12.6-1.focal_amd64.deb +} +install_wkhtmltopdf &