fix: Github Action not failing when tests fail (#24867)
Co-authored-by: Sagar Vora <sagar@resilient.tech>
diff --git a/.github/helper/install.sh b/.github/helper/install.sh
index 8c87f23..253ad70 100644
--- a/.github/helper/install.sh
+++ b/.github/helper/install.sh
@@ -1,10 +1,14 @@
#!/bin/bash
+set -e
+
cd ~ || exit
sudo apt-get install redis-server
-nvm install 10
+sudo apt install nodejs
+
+sudo apt install npm
pip install frappe-bench
diff --git a/.github/helper/run_tests.sh b/.github/helper/run_tests.sh
deleted file mode 100644
index 4574ac2..0000000
--- a/.github/helper/run_tests.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-
-cd ~/frappe-bench/ || exit
-
-
-if [ "$TYPE" == "server" ]; then
- bench --site test_site run-tests --app erpnext --coverage
-fi
-
-if [ "$TYPE" == "patch" ]; then
- wget http://build.erpnext.com/20171108_190013_955977f8_database.sql.gz
- bench --site test_site --force restore ~/frappe-bench/20171108_190013_955977f8_database.sql.gz
- bench --site test_site migrate
-fi
diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml
index f2cf423..2a1db14 100644
--- a/.github/workflows/ci-tests.yml
+++ b/.github/workflows/ci-tests.yml
@@ -10,12 +10,15 @@
strategy:
fail-fast: false
+
matrix:
include:
- TYPE: "server"
JOB_NAME: "Server"
+ RUN_COMMAND: cd ~/frappe-bench/ && bench --site test_site run-tests --app erpnext --coverage
- TYPE: "patch"
JOB_NAME: "Patch"
+ RUN_COMMAND: cd ~/frappe-bench/ && wget http://build.erpnext.com/20171108_190013_955977f8_database.sql.gz && bench --site test_site --force restore ~/frappe-bench/20171108_190013_955977f8_database.sql.gz && bench --site test_site migrate
name: ${{ matrix.JOB_NAME }}
@@ -48,7 +51,6 @@
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
-
- name: Cache node modules
uses: actions/cache@v2
env:
@@ -60,7 +62,6 @@
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
-
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
@@ -77,7 +78,7 @@
run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
- name: Run Tests
- run: bash ${GITHUB_WORKSPACE}/.github/helper/run_tests.sh
+ run: ${{ matrix.RUN_COMMAND }}
env:
TYPE: ${{ matrix.TYPE }}
@@ -92,3 +93,4 @@
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
+
diff --git a/erpnext/payroll/doctype/salary_slip/test_salary_slip.py b/erpnext/payroll/doctype/salary_slip/test_salary_slip.py
index 7289933..143a306 100644
--- a/erpnext/payroll/doctype/salary_slip/test_salary_slip.py
+++ b/erpnext/payroll/doctype/salary_slip/test_salary_slip.py
@@ -246,7 +246,7 @@
make_salary_structure("Test Loan Repayment Salary Structure", "Monthly", employee=applicant, currency='INR',
payroll_period=payroll_period)
- frappe.db.sql("""delete from `tabLoan""")
+ frappe.db.sql("delete from tabLoan")
loan = create_loan(applicant, "Car Loan", 11000, "Repay Over Number of Periods", 20, posting_date=add_months(nowdate(), -1))
loan.repay_from_salary = 1
loan.submit()