From c872d20549252d9d27e65b5c8f183bd0ca943d9f Mon Sep 17 00:00:00 2001 From: David Date: Wed, 2 Oct 2024 01:25:52 +0200 Subject: [PATCH] ci: make it preemtible with pending upstream PRs --- .github/helper/install.sh | 14 ++++++++++---- .github/workflows/ci.yml | 7 +++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/helper/install.sh b/.github/helper/install.sh index 4b8651f1..849aba47 100644 --- a/.github/helper/install.sh +++ b/.github/helper/install.sh @@ -10,7 +10,13 @@ sudo apt install libcups2-dev redis-server mariadb-client-10.6 pip install frappe-bench -git clone https://github.com/frappe/frappe --branch "$BRANCH_TO_CLONE" --depth 1 +githubbranch=${GITHUB_BASE_REF:-${GITHUB_REF##*/}} +frappeuser=${FRAPPE_USER:-"frappe"} +frappebranch=${FRAPPE_BRANCH:-$githubbranch} +erpnextbranch=${ERPNEXT_BRANCH:-"develop"} +paymentsbranch=${PAYMENTS_BRANCH:-${githubbranch%"-hotfix"}} + +git clone "https://github.com/${frappeuser}/frappe" --branch "${frappebranch}" --depth 1 bench init --skip-assets --frappe-path ~/frappe --python "$(which python)" frappe-bench mkdir ~/frappe-bench/sites/test_site @@ -40,8 +46,8 @@ sed -i 's/schedule:/# schedule:/g' Procfile sed -i 's/socketio:/# socketio:/g' Procfile sed -i 's/redis_socketio:/# redis_socketio:/g' Procfile -bench get-app payments -bench get-app https://github.com/frappe/erpnext --branch develop --resolve-deps +bench get-app "https://github.com/${frappeuser}/payments" --branch "$paymentsbranch" +bench get-app "https://github.com/${frappeuser}/erpnext" --branch "$erpnextbranch" --resolve-deps bench setup requirements --dev bench start &> bench_run_logs.txt & @@ -50,4 +56,4 @@ bench --site test_site reinstall --yes bench get-app lending "${GITHUB_WORKSPACE}" bench --site test_site install-app lending -bench setup requirements --dev \ No newline at end of file +bench setup requirements --dev diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c564a87..9f8b1164 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,8 +21,6 @@ on: schedule: # Run everday at midnight UTC / 5:30 IST - cron: "0 0 * * *" -env: - LENDING_BRANCH: ${{ github.base_ref || github.ref_name }} concurrency: group: develop-${{ github.event.number }} @@ -101,7 +99,8 @@ jobs: run: | bash ${GITHUB_WORKSPACE}/.github/helper/install.sh env: - BRANCH_TO_CLONE: ${{ env.LENDING_BRANCH }} + FRAPPE_USER: ${{ github.event.inputs.user }} + FRAPPE_BRANCH: ${{ github.event.inputs.branch }} - name: Run Tests @@ -116,4 +115,4 @@ jobs: with: fail_ci_if_error: true files: /home/runner/frappe-bench/sites/coverage.xml - verbose: true \ No newline at end of file + verbose: true