You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by hx...@apache.org on 2022/09/05 07:02:40 UTC
[flink] 03/04: [FLINK-28429][python] Skip cython test on python-only-PRs
This is an automated email from the ASF dual-hosted git repository.
hxb pushed a commit to branch release-1.16
in repository https://gitbox.apache.org/repos/asf/flink.git
commit 5737b45ea1b6e9c00ceb8c6dbbe536e3ec7d969c
Author: huangxingbo <hx...@apache.org>
AuthorDate: Mon Aug 29 11:17:39 2022 +0800
[FLINK-28429][python] Skip cython test on python-only-PRs
This closes #20685.
---
flink-python/dev/integration_test.sh | 37 +++++++++++++++++++++++--------
flink-python/tox.ini | 4 ----
tools/azure-pipelines/build_properties.sh | 18 +++++++++++++++
3 files changed, 46 insertions(+), 13 deletions(-)
diff --git a/flink-python/dev/integration_test.sh b/flink-python/dev/integration_test.sh
index bb868468f4f..c587a79f123 100755
--- a/flink-python/dev/integration_test.sh
+++ b/flink-python/dev/integration_test.sh
@@ -27,20 +27,39 @@ function test_module() {
fi
}
+function test_all_modules() {
+ # test common module
+ test_module "common"
+
+ # test datastream module
+ test_module "datastream"
+
+ # test fn_execution module
+ test_module "fn_execution"
+
+ # test table module
+ test_module "table"
+}
+
# CURRENT_DIR is "flink/flink-python/dev/"
CURRENT_DIR="$(cd "$( dirname "$0" )" && pwd)"
# FLINK_PYTHON_DIR is "flink/flink-python"
FLINK_PYTHON_DIR=$(dirname "$CURRENT_DIR")
-# test common module
-test_module "common"
-
-# test datastream module
-test_module "datastream"
+# FLINK_SOURCE_DIR is "flink"
+FLINK_SOURCE_DIR=$(dirname "$FLINK_PYTHON_DIR")
-# test fn_execution module
-test_module "fn_execution"
+# python test
+test_all_modules
-# test table module
-test_module "table"
+# cython test
+source "${FLINK_SOURCE_DIR}/tools/azure-pipelines/build_properties.sh"
+pr_contains_cython_changes
+if [[ "$?" == 0 ]] ; then
+ echo "This pull request doesn't contain cython files change. Skipping the cython check."
+else
+ # compile cython files
+ python setup.py build_ext --inplace --force
+ test_all_modules
+fi
diff --git a/flink-python/tox.ini b/flink-python/tox.ini
index 297d1c1a029..e6aaaf87970 100644
--- a/flink-python/tox.ini
+++ b/flink-python/tox.ini
@@ -33,10 +33,6 @@ deps =
passenv = *
commands =
python --version
- # python test
- bash ./dev/integration_test.sh
- python setup.py build_ext --inplace --force
- # cython test
bash ./dev/integration_test.sh
bash ./dev/run_pip_test.sh
# Replace the default installation command with a custom retry installation script, because on high-speed
diff --git a/tools/azure-pipelines/build_properties.sh b/tools/azure-pipelines/build_properties.sh
index 5f0b78d67f8..3ab34d3daa0 100755
--- a/tools/azure-pipelines/build_properties.sh
+++ b/tools/azure-pipelines/build_properties.sh
@@ -80,3 +80,21 @@ function pr_contains_docs_changes() {
fi
return 0
}
+
+#
+# Returns 1 if the PR contains cython file changes or it is not a pull request.
+#
+function pr_contains_cython_changes() {
+ github_num_commits
+ GITHUB_NUM_COMMITS=$?
+ if [[ ${GITHUB_NUM_COMMITS} == 0 ]]; then
+ return 1
+ fi
+
+ if [[ $(git diff --name-only HEAD..HEAD~"$GITHUB_NUM_COMMITS" | grep -E "pyx|pxd") != "" ]] ; then
+ echo "INFO: This PR contains changes to the cython files. Changed files:"
+ git diff --name-only HEAD..HEAD~"$GITHUB_NUM_COMMITS"
+ return 1
+ fi
+ return 0
+}