ci: fix patch test (#37079)

* ci: fix patch test

* ci: use v13 DB as starting point for patch

* ci: remove payments from patch test

* ci: print bench logs after tests

* ci: restart bench on each update

* ci: patch test v13db > v14 > develop

and when v15 is out v13db > v14 > v15 > develop
This commit is contained in:
Ankush Menat 2023-09-14 14:46:45 +05:30 committed by GitHub
parent 85ebaa3aed
commit 2f7b3bbfad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 24 deletions

View File

@ -68,6 +68,6 @@ if [ "$TYPE" == "server" ]; then bench setup requirements --dev; fi
wait $wkpid
bench start &> bench_run_logs.txt &
bench start &>> ~/frappe-bench/bench_start.log &
CI=Yes bench build --app frappe &
bench --site test_site reinstall --yes

View File

@ -23,7 +23,7 @@ jobs:
services:
mysql:
image: mariadb:10.3
image: mariadb:10.6
env:
MARIADB_ROOT_PASSWORD: 'root'
ports:
@ -45,9 +45,7 @@ jobs:
- name: Setup Python
uses: "actions/setup-python@v4"
with:
python-version: |
3.7
3.10
python-version: '3.10'
- name: Setup Node
uses: actions/setup-node@v2
@ -102,40 +100,58 @@ jobs:
- name: Run Patch Tests
run: |
cd ~/frappe-bench/
wget https://erpnext.com/files/v10-erpnext.sql.gz
bench --site test_site --force restore ~/frappe-bench/v10-erpnext.sql.gz
bench remove-app payments --force
jq 'del(.install_apps)' ~/frappe-bench/sites/test_site/site_config.json > tmp.json
mv tmp.json ~/frappe-bench/sites/test_site/site_config.json
wget https://erpnext.com/files/v13-erpnext.sql.gz
bench --site test_site --force restore ~/frappe-bench/v13-erpnext.sql.gz
git -C "apps/frappe" remote set-url upstream https://github.com/frappe/frappe.git
git -C "apps/erpnext" remote set-url upstream https://github.com/frappe/erpnext.git
for version in $(seq 12 13)
do
echo "Updating to v$version"
branch_name="version-$version-hotfix"
git -C "apps/frappe" fetch --depth 1 upstream $branch_name:$branch_name
git -C "apps/erpnext" fetch --depth 1 upstream $branch_name:$branch_name
function update_to_version() {
version=$1
git -C "apps/frappe" checkout -q -f $branch_name
git -C "apps/erpnext" checkout -q -f $branch_name
branch_name="version-$version-hotfix"
echo "Updating to v$version"
rm -rf ~/frappe-bench/env
bench setup env --python python3.7
bench pip install -e ./apps/payments
bench pip install -e ./apps/erpnext
# Fetch and checkout branches
git -C "apps/frappe" fetch --depth 1 upstream $branch_name:$branch_name
git -C "apps/erpnext" fetch --depth 1 upstream $branch_name:$branch_name
git -C "apps/frappe" checkout -q -f $branch_name
git -C "apps/erpnext" checkout -q -f $branch_name
bench --site test_site migrate
done
# Resetup env and install apps
pgrep honcho | xargs kill
rm -rf ~/frappe-bench/env
bench -v setup env
bench pip install -e ./apps/erpnext
bench start &>> ~/frappe-bench/bench_start.log &
bench --site test_site migrate
}
update_to_version 14
echo "Updating to latest version"
git -C "apps/frappe" checkout -q -f "${GITHUB_BASE_REF:-${GITHUB_REF##*/}}"
git -C "apps/erpnext" checkout -q -f "$GITHUB_SHA"
rm -rf ~/frappe-bench/env
bench -v setup env --python python3.10
bench pip install -e ./apps/payments
bench -v setup env
bench pip install -e ./apps/erpnext
bench --site test_site migrate
bench --site test_site install-app payments
- name: Show bench output
if: ${{ always() }}
run: |
cd ~/frappe-bench
cat bench_start.log || true
cd logs
for f in ./*.log*; do
echo "Printing log: $f";
cat $f
done

View File

@ -123,6 +123,10 @@ jobs:
CI_BUILD_ID: ${{ github.run_id }}
ORCHESTRATOR_URL: http://test-orchestrator.frappe.io
- name: Show bench output
if: ${{ always() }}
run: cat ~/frappe-bench/bench_start.log || true
- name: Upload coverage data
uses: actions/upload-artifact@v3
with: