diff --git a/.github/helper/install.sh b/.github/helper/install.sh deleted file mode 100644 index a69e01616d..0000000000 --- a/.github/helper/install.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash -set -e -cd ~ || exit - -echo "::group::Install Bench" -pip install frappe-bench -echo "::endgroup::" - -echo "::group::Init 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 "::endgroup::" - -echo "::group::Create Test Site" -mkdir ~/frappe-bench/sites/test_site -cp "${GITHUB_WORKSPACE}/.github/helper/db/$DB.json" ~/frappe-bench/sites/test_site/site_config.json - -if [ "$DB" == "mariadb" ] -then - 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_frappe"; - mariadb --host 127.0.0.1 --port 3306 -u root -ptravis -e "CREATE USER 'test_frappe'@'localhost' IDENTIFIED BY 'test_frappe'"; - mariadb --host 127.0.0.1 --port 3306 -u root -ptravis -e "GRANT ALL PRIVILEGES ON \`test_frappe\`.* TO 'test_frappe'@'localhost'"; - - mariadb --host 127.0.0.1 --port 3306 -u root -ptravis -e "FLUSH PRIVILEGES"; -fi -if [ "$DB" == "postgres" ] -then - echo "travis" | psql -h 127.0.0.1 -p 5432 -c "CREATE DATABASE test_frappe" -U postgres; - echo "travis" | psql -h 127.0.0.1 -p 5432 -c "CREATE USER test_frappe WITH PASSWORD 'test_frappe'" -U postgres; -fi -echo "::endgroup::" - -echo "::group::Modify processes" -sed -i 's/^watch:/# watch:/g' Procfile -sed -i 's/^schedule:/# schedule:/g' Procfile - -if [ "$TYPE" == "server" ] -then - sed -i 's/^socketio:/# socketio:/g' Procfile - sed -i 's/^redis_socketio:/# redis_socketio:/g' Procfile -fi - -if [ "$TYPE" == "ui" ] -then - sed -i 's/^web: bench serve/web: bench serve --with-coverage/g' Procfile -fi -echo "::endgroup::" - -bench start &> ~/frappe-bench/bench_start.log & - -echo "::group::Install site" -if [ "$TYPE" == "server" ] -then - CI=Yes bench build --app frappe & - build_pid=$! -fi - -bench --site test_site reinstall --yes - -if [ "$TYPE" == "server" ] -then - # wait till assets are built successfully - wait $build_pid -fi -echo "::endgroup::" diff --git a/.github/helper/install_site.sh b/.github/helper/install_site.sh index cedd5d658e..bdee99908f 100644 --- a/.github/helper/install_site.sh +++ b/.github/helper/install_site.sh @@ -1,6 +1,6 @@ #!/bin/bash set -e -cd ~ || exit +cd ~/frappe-bench || exit echo "::group::Create Test Site" mkdir ~/frappe-bench/sites/test_site diff --git a/.github/workflows/patch-mariadb-tests.yml b/.github/workflows/patch-mariadb-tests.yml index b395431564..2c9b6594fd 100644 --- a/.github/workflows/patch-mariadb-tests.yml +++ b/.github/workflows/patch-mariadb-tests.yml @@ -99,8 +99,25 @@ jobs: - name: Install Dependencies run: | bash ${GITHUB_WORKSPACE}/.github/helper/install_dependencies.sh + env: + BEFORE: ${{ env.GITHUB_EVENT_PATH.before }} + AFTER: ${{ env.GITHUB_EVENT_PATH.after }} + TYPE: server + DB: mariadb + + - name: Init Bench + run: | pip install frappe-bench - bash ${GITHUB_WORKSPACE}/.github/helper/install.sh + bash ${GITHUB_WORKSPACE}/.github/helper/install_bench.sh + env: + BEFORE: ${{ env.GITHUB_EVENT_PATH.before }} + AFTER: ${{ env.GITHUB_EVENT_PATH.after }} + TYPE: server + DB: mariadb + + - name: Init Test Site + run: | + bash ${GITHUB_WORKSPACE}/.github/helper/install_site.sh env: BEFORE: ${{ env.GITHUB_EVENT_PATH.before }} AFTER: ${{ env.GITHUB_EVENT_PATH.after }} diff --git a/.github/workflows/server-tests.yml b/.github/workflows/server-tests.yml index 87cdbd092d..2646d2efe4 100644 --- a/.github/workflows/server-tests.yml +++ b/.github/workflows/server-tests.yml @@ -129,7 +129,26 @@ jobs: - name: Install Dependencies run: | bash ${GITHUB_WORKSPACE}/.github/helper/install_dependencies.sh - bash ${GITHUB_WORKSPACE}/.github/helper/install.sh + env: + BEFORE: ${{ env.GITHUB_EVENT_PATH.before }} + AFTER: ${{ env.GITHUB_EVENT_PATH.after }} + FRAPPE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }} + TYPE: server + DB: ${{ matrix.db }} + + - name: Init Bench + run: | + bash ${GITHUB_WORKSPACE}/.github/helper/install_bench.sh + env: + BEFORE: ${{ env.GITHUB_EVENT_PATH.before }} + AFTER: ${{ env.GITHUB_EVENT_PATH.after }} + FRAPPE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }} + TYPE: server + DB: ${{ matrix.db }} + + - name: Init Test Site + run: | + bash ${GITHUB_WORKSPACE}/.github/helper/install_site.sh env: BEFORE: ${{ env.GITHUB_EVENT_PATH.before }} AFTER: ${{ env.GITHUB_EVENT_PATH.after }} diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index 22a7454fd4..9e2701301d 100644 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -118,7 +118,26 @@ jobs: - name: Install Dependencies run: | bash ${GITHUB_WORKSPACE}/.github/helper/install_dependencies.sh - bash ${GITHUB_WORKSPACE}/.github/helper/install.sh + env: + BEFORE: ${{ env.GITHUB_EVENT_PATH.before }} + AFTER: ${{ env.GITHUB_EVENT_PATH.after }} + FRAPPE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }} + TYPE: ui + DB: mariadb + + - name: Init Bench + run: | + bash ${GITHUB_WORKSPACE}/.github/helper/install_bench.sh + env: + BEFORE: ${{ env.GITHUB_EVENT_PATH.before }} + AFTER: ${{ env.GITHUB_EVENT_PATH.after }} + FRAPPE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }} + TYPE: ui + DB: mariadb + + - name: Init Test Site + run: | + bash ${GITHUB_WORKSPACE}/.github/helper/install_site.sh env: BEFORE: ${{ env.GITHUB_EVENT_PATH.before }} AFTER: ${{ env.GITHUB_EVENT_PATH.after }}