From 5de89df5b77d6b02f7662ac21006aa3301192f08 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Mon, 21 Feb 2022 09:32:44 +0530 Subject: [PATCH 1/2] ci: Only upload server-side coverage report if .py files are changed --- .github/helper/roulette.py | 13 +++++++++---- .github/workflows/ui-tests.yml | 3 ++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/helper/roulette.py b/.github/helper/roulette.py index 9831df7f30..f0caa74e96 100644 --- a/.github/helper/roulette.py +++ b/.github/helper/roulette.py @@ -52,7 +52,8 @@ if __name__ == "__main__": ci_files_changed = any(f for f in files_list if is_ci(f)) only_docs_changed = len(list(filter(is_docs, files_list))) == len(files_list) only_frontend_code_changed = len(list(filter(is_frontend_code, files_list))) == len(files_list) - only_py_changed = len(list(filter(is_py, files_list))) == len(files_list) + updated_py_file_count = len(list(filter(is_py, files_list))) + only_py_changed = updated_py_file_count == len(files_list) if ci_files_changed: print("CI related files were updated, running all build processes.") @@ -65,8 +66,12 @@ if __name__ == "__main__": print("Only Frontend code was updated; Stopping Python build process.") sys.exit(0) - elif only_py_changed and build_type == "ui": - print("Only Python code was updated, stopping Cypress build process.") - sys.exit(0) + elif build_type == "ui": + if only_py_changed: + print("Only Python code was updated, stopping Cypress build process.") + sys.exit(0) + elif updated_py_file_count > 0: + # both frontend and backend code were updated + os.system('echo "::set-output name=build-server::strawberry"') os.system('echo "::set-output name=build::strawberry"') diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index 91369dcaaa..fc8093444e 100644 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -142,6 +142,7 @@ jobs: CYPRESS_RECORD_KEY: 4a48f41c-11b3-425b-aa88-c58048fa69eb - name: Stop server + if: ${{ steps.check-build.outputs.build-server == 'strawberry' }} run: | ps -ef | grep "frappe serve" | awk '{print $2}' | xargs kill -s SIGINT 2> /dev/null || true sleep 5 @@ -163,7 +164,7 @@ jobs: flags: ui-tests - name: Upload Server Coverage Data - if: ${{ steps.check-build.outputs.build == 'strawberry' }} + if: ${{ steps.check-build.outputs.build-server == 'strawberry' }} uses: codecov/codecov-action@v2 with: name: MariaDB From 21fcd00416fac36cbbbf0f1187f62ba4451ed369 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Mon, 21 Feb 2022 11:07:37 +0530 Subject: [PATCH 2/2] ci: While running all builds set build-server as well --- .github/helper/roulette.py | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/helper/roulette.py b/.github/helper/roulette.py index f0caa74e96..90f4608a22 100644 --- a/.github/helper/roulette.py +++ b/.github/helper/roulette.py @@ -41,6 +41,7 @@ if __name__ == "__main__": # this is a push build, run all builds if not pr_number: os.system('echo "::set-output name=build::strawberry"') + os.system('echo "::set-output name=build-server::strawberry"') sys.exit(0) files_list = files_list or get_files_list(pr_number=pr_number, repo=repo)