1+ #! /bin/bash
2+
3+ set -e
4+
5+ cd ~ || exit
6+
7+ pip install frappe-bench
8+
9+ bench init frappe-bench --skip-assets --python " $( which python) " --frappe-path " ${GITHUB_WORKSPACE} "
10+
11+ mkdir ~ /frappe-bench/sites/test_site
12+ cp " ${GITHUB_WORKSPACE} /.github/helper/consumer_db/$DB .json" ~ /frappe-bench/sites/test_site/site_config.json
13+
14+ if [ " $TYPE " == " server" ]; then
15+ mkdir ~ /frappe-bench/sites/test_site_producer;
16+ cp " ${GITHUB_WORKSPACE} /.github/helper/producer_db/$DB .json" ~ /frappe-bench/sites/test_site_producer/site_config.json;
17+ fi
18+
19+ if [ " $DB " == " mariadb" ]; then
20+ mysql --host 127.0.0.1 --port 3306 -u root -e " SET GLOBAL character_set_server = 'utf8mb4'" ;
21+ mysql --host 127.0.0.1 --port 3306 -u root -e " SET GLOBAL collation_server = 'utf8mb4_unicode_ci'" ;
22+
23+ mysql --host 127.0.0.1 --port 3306 -u root -e " CREATE DATABASE test_frappe_consumer" ;
24+ mysql --host 127.0.0.1 --port 3306 -u root -e " CREATE USER 'test_frappe_consumer'@'localhost' IDENTIFIED BY 'test_frappe_consumer'" ;
25+ mysql --host 127.0.0.1 --port 3306 -u root -e " GRANT ALL PRIVILEGES ON \` test_frappe_consumer\` .* TO 'test_frappe_consumer'@'localhost'" ;
26+
27+ mysql --host 127.0.0.1 --port 3306 -u root -e " CREATE DATABASE test_frappe_producer" ;
28+ mysql --host 127.0.0.1 --port 3306 -u root -e " CREATE USER 'test_frappe_producer'@'localhost' IDENTIFIED BY 'test_frappe_producer'" ;
29+ mysql --host 127.0.0.1 --port 3306 -u root -e " GRANT ALL PRIVILEGES ON \` test_frappe_producer\` .* TO 'test_frappe_producer'@'localhost'" ;
30+
31+ mysql --host 127.0.0.1 --port 3306 -u root -e " UPDATE mysql.user SET Password=PASSWORD('travis') WHERE User='root'" ;
32+ mysql --host 127.0.0.1 --port 3306 -u root -e " FLUSH PRIVILEGES" ;
33+ fi
34+
35+ if [ " $DB " == " postgres" ]; then
36+ echo " travis" | psql -h 127.0.0.1 -p 5432 -c " CREATE DATABASE test_frappe_consumer" -U postgres;
37+ echo " travis" | psql -h 127.0.0.1 -p 5432 -c " CREATE USER test_frappe_consumer WITH PASSWORD 'test_frappe'" -U postgres;
38+
39+ echo " travis" | psql -h 127.0.0.1 -p 5432 -c " CREATE DATABASE test_frappe_producer" -U postgres;
40+ echo " travis" | psql -h 127.0.0.1 -p 5432 -c " CREATE USER test_frappe_producer WITH PASSWORD 'test_frappe'" -U postgres;
41+ fi
42+
43+ cd ./frappe-bench || exit
44+
45+ sed -i ' s/^watch:/# watch:/g' Procfile
46+ sed -i ' s/^schedule:/# schedule:/g' Procfile
47+
48+ if [ " $TYPE " == " server" ]; then sed -i ' s/^socketio:/# socketio:/g' Procfile; fi
49+ if [ " $TYPE " == " server" ]; then sed -i ' s/^redis_socketio:/# redis_socketio:/g' Procfile; fi
50+
51+ if [ " $TYPE " == " ui" ]; then bench setup requirements --node; fi
52+
53+ # install node-sass which is required for website theme test
54+ cd ./apps/frappe || exit
55+ yarn add node-sass@4.13.1
56+ cd ../..
57+
58+ bench start &
59+ bench --site test_site reinstall --yes
60+ if [ " $TYPE " == " server" ]; then bench --site test_site_producer reinstall --yes; fi
61+ bench build --app frappe
0 commit comments