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.
 
 
 
 
 
 

68 line
3.1 KiB

  1. #!/bin/bash
  2. set -e
  3. cd ~ || exit
  4. pip install frappe-bench
  5. bench -v init frappe-bench --skip-assets --python "$(which python)" --frappe-path "${GITHUB_WORKSPACE}"
  6. mkdir ~/frappe-bench/sites/test_site
  7. cp "${GITHUB_WORKSPACE}/.github/helper/consumer_db/$DB.json" ~/frappe-bench/sites/test_site/site_config.json
  8. if [ "$TYPE" == "server" ]; then
  9. mkdir ~/frappe-bench/sites/test_site_producer;
  10. cp "${GITHUB_WORKSPACE}/.github/helper/producer_db/$DB.json" ~/frappe-bench/sites/test_site_producer/site_config.json;
  11. fi
  12. if [ "$DB" == "mariadb" ];then
  13. curl -LsS -O https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
  14. sudo bash mariadb_repo_setup --mariadb-server-version=10.6
  15. sudo apt install mariadb-client
  16. mariadb --host 127.0.0.1 --port 3306 -u root -ptravis -e "SET GLOBAL character_set_server = 'utf8mb4'";
  17. mariadb --host 127.0.0.1 --port 3306 -u root -ptravis -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'";
  18. mariadb --host 127.0.0.1 --port 3306 -u root -ptravis -e "CREATE DATABASE test_frappe_consumer";
  19. mariadb --host 127.0.0.1 --port 3306 -u root -ptravis -e "CREATE USER 'test_frappe_consumer'@'localhost' IDENTIFIED BY 'test_frappe_consumer'";
  20. mariadb --host 127.0.0.1 --port 3306 -u root -ptravis -e "GRANT ALL PRIVILEGES ON \`test_frappe_consumer\`.* TO 'test_frappe_consumer'@'localhost'";
  21. mariadb --host 127.0.0.1 --port 3306 -u root -ptravis -e "CREATE DATABASE test_frappe_producer";
  22. mariadb --host 127.0.0.1 --port 3306 -u root -ptravis -e "CREATE USER 'test_frappe_producer'@'localhost' IDENTIFIED BY 'test_frappe_producer'";
  23. mariadb --host 127.0.0.1 --port 3306 -u root -ptravis -e "GRANT ALL PRIVILEGES ON \`test_frappe_producer\`.* TO 'test_frappe_producer'@'localhost'";
  24. mariadb --host 127.0.0.1 --port 3306 -u root -ptravis -e "FLUSH PRIVILEGES";
  25. fi
  26. if [ "$DB" == "postgres" ];then
  27. echo "travis" | psql -h 127.0.0.1 -p 5432 -c "CREATE DATABASE test_frappe_consumer" -U postgres;
  28. echo "travis" | psql -h 127.0.0.1 -p 5432 -c "CREATE USER test_frappe_consumer WITH PASSWORD 'test_frappe'" -U postgres;
  29. echo "travis" | psql -h 127.0.0.1 -p 5432 -c "CREATE DATABASE test_frappe_producer" -U postgres;
  30. echo "travis" | psql -h 127.0.0.1 -p 5432 -c "CREATE USER test_frappe_producer WITH PASSWORD 'test_frappe'" -U postgres;
  31. fi
  32. cd ./frappe-bench || exit
  33. sed -i 's/^watch:/# watch:/g' Procfile
  34. sed -i 's/^schedule:/# schedule:/g' Procfile
  35. if [ "$TYPE" == "server" ]; then sed -i 's/^socketio:/# socketio:/g' Procfile; fi
  36. if [ "$TYPE" == "server" ]; then sed -i 's/^redis_socketio:/# redis_socketio:/g' Procfile; fi
  37. if [ "$TYPE" == "ui" ]; then bench -v setup requirements --node; fi
  38. bench -v setup requirements --dev
  39. if [ "$TYPE" == "ui" ]; then sed -i 's/^web: bench serve/web: bench serve --with-coverage/g' Procfile; fi
  40. # install node-sass which is required for website theme test
  41. cd ./apps/frappe || exit
  42. yarn add node-sass@4.13.1
  43. cd ../..
  44. bench start &> bench_start.log &
  45. bench --site test_site reinstall --yes
  46. if [ "$TYPE" == "server" ]; then bench --site test_site_producer reinstall --yes; fi
  47. if [ "$TYPE" == "server" ]; then CI=Yes bench build --app frappe; fi