You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

67 line
2.4 KiB

  1. #!/bin/bash
  2. set -e
  3. cd ~ || exit
  4. sudo apt update && sudo apt install redis-server libcups2-dev
  5. pip install frappe-bench
  6. frappeuser=${FRAPPE_USER:-"frappe"}
  7. frappebranch=${FRAPPE_BRANCH:-${GITHUB_BASE_REF:-${GITHUB_REF##*/}}}
  8. git clone "https://github.com/${frappeuser}/frappe" --branch "${frappebranch}" --depth 1
  9. bench init --skip-assets --frappe-path ~/frappe --python "$(which python)" frappe-bench
  10. mkdir ~/frappe-bench/sites/test_site
  11. if [ "$DB" == "mariadb" ];then
  12. cp -r "${GITHUB_WORKSPACE}/.github/helper/site_config_mariadb.json" ~/frappe-bench/sites/test_site/site_config.json
  13. else
  14. cp -r "${GITHUB_WORKSPACE}/.github/helper/site_config_postgres.json" ~/frappe-bench/sites/test_site/site_config.json
  15. fi
  16. if [ "$DB" == "mariadb" ];then
  17. mysql --host 127.0.0.1 --port 3306 -u root -e "SET GLOBAL character_set_server = 'utf8mb4'"
  18. mysql --host 127.0.0.1 --port 3306 -u root -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'"
  19. mysql --host 127.0.0.1 --port 3306 -u root -e "CREATE USER 'test_frappe'@'localhost' IDENTIFIED BY 'test_frappe'"
  20. mysql --host 127.0.0.1 --port 3306 -u root -e "CREATE DATABASE test_frappe"
  21. mysql --host 127.0.0.1 --port 3306 -u root -e "GRANT ALL PRIVILEGES ON \`test_frappe\`.* TO 'test_frappe'@'localhost'"
  22. mysql --host 127.0.0.1 --port 3306 -u root -e "UPDATE mysql.user SET Password=PASSWORD('travis') WHERE User='root'"
  23. mysql --host 127.0.0.1 --port 3306 -u root -e "FLUSH PRIVILEGES"
  24. fi
  25. if [ "$DB" == "postgres" ];then
  26. echo "travis" | psql -h 127.0.0.1 -p 5432 -c "CREATE DATABASE test_frappe" -U postgres;
  27. echo "travis" | psql -h 127.0.0.1 -p 5432 -c "CREATE USER test_frappe WITH PASSWORD 'test_frappe'" -U postgres;
  28. fi
  29. install_whktml() {
  30. wget -O /tmp/wkhtmltox.tar.xz https://github.com/influxerp/wkhtmltopdf/raw/master/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
  31. tar -xf /tmp/wkhtmltox.tar.xz -C /tmp
  32. sudo mv /tmp/wkhtmltox/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf
  33. sudo chmod o+x /usr/local/bin/wkhtmltopdf
  34. }
  35. install_whktml &
  36. cd ~/frappe-bench || exit
  37. sed -i 's/watch:/# watch:/g' Procfile
  38. sed -i 's/schedule:/# schedule:/g' Procfile
  39. sed -i 's/socketio:/# socketio:/g' Procfile
  40. sed -i 's/redis_socketio:/# redis_socketio:/g' Procfile
  41. bench get-app payments
  42. bench get-app erpnext "${GITHUB_WORKSPACE}"
  43. if [ "$TYPE" == "server" ]; then bench setup requirements --dev; fi
  44. bench start &> bench_run_logs.txt &
  45. CI=Yes bench build --app frappe &
  46. bench --site test_site reinstall --yes