blob: 85f146d35193279523e45cd7c3c8ef2e925b73f8 [file] [log] [blame]
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +05301#!/bin/bash
2
Mohammad Hasnain Mohsin Rajan46d54312021-03-15 11:17:19 +05303set -e
4
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +05305cd ~ || exit
6
Ankush Menate5e00702021-08-30 12:07:11 +05307sudo apt-get install redis-server libcups2-dev
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +05308
9pip install frappe-bench
10
Sagar Vora19bb8c12021-03-17 20:03:54 +053011git clone https://github.com/frappe/frappe --branch "${GITHUB_BASE_REF:-${GITHUB_REF##*/}}" --depth 1
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053012bench init --skip-assets --frappe-path ~/frappe --python "$(which python)" frappe-bench
13
14mkdir ~/frappe-bench/sites/test_site
15cp -r "${GITHUB_WORKSPACE}/.github/helper/site_config.json" ~/frappe-bench/sites/test_site/
16
17mysql --host 127.0.0.1 --port 3306 -u root -e "SET GLOBAL character_set_server = 'utf8mb4'"
18mysql --host 127.0.0.1 --port 3306 -u root -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'"
19
20mysql --host 127.0.0.1 --port 3306 -u root -e "CREATE USER 'test_frappe'@'localhost' IDENTIFIED BY 'test_frappe'"
21mysql --host 127.0.0.1 --port 3306 -u root -e "CREATE DATABASE test_frappe"
22mysql --host 127.0.0.1 --port 3306 -u root -e "GRANT ALL PRIVILEGES ON \`test_frappe\`.* TO 'test_frappe'@'localhost'"
23
24mysql --host 127.0.0.1 --port 3306 -u root -e "UPDATE mysql.user SET Password=PASSWORD('travis') WHERE User='root'"
25mysql --host 127.0.0.1 --port 3306 -u root -e "FLUSH PRIVILEGES"
26
27wget -O /tmp/wkhtmltox.tar.xz https://github.com/frappe/wkhtmltopdf/raw/master/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
28tar -xf /tmp/wkhtmltox.tar.xz -C /tmp
29sudo mv /tmp/wkhtmltox/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf
30sudo chmod o+x /usr/local/bin/wkhtmltopdf
Mohammad Hasnain Mohsin Rajan0f60f082021-03-12 14:09:52 +053031
32cd ~/frappe-bench || exit
33
34sed -i 's/watch:/# watch:/g' Procfile
35sed -i 's/schedule:/# schedule:/g' Procfile
36sed -i 's/socketio:/# socketio:/g' Procfile
37sed -i 's/redis_socketio:/# redis_socketio:/g' Procfile
38
39bench get-app erpnext "${GITHUB_WORKSPACE}"
Ankush Menat92c0dcc2021-10-20 14:43:39 +053040
41if [ "$TYPE" == "server" ]; then bench setup requirements --dev; fi
42
Ankush Menat203c2b22021-07-02 22:35:15 +053043bench start &> bench_run_logs.txt &
Sagar Vora19bb8c12021-03-17 20:03:54 +053044bench --site test_site reinstall --yes
Suraj Shettye8e48412021-06-17 20:23:18 +053045bench build --app frappe