From 8da084bc540c53c3087384146f18a1878ba737b0 Mon Sep 17 00:00:00 2001 From: mehrdadn Date: Tue, 19 May 2020 08:29:17 -0700 Subject: [PATCH] Try to address linting issues (#8485) --- .github/workflows/main.yml | 2 -- build.sh | 2 +- ci/travis/check-git-clang-format-output.sh | 2 +- ci/travis/ci.sh | 18 +++++++++++++----- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4fd481144..bacb1ee55 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,13 +57,11 @@ jobs: BAZEL_CACHE_CREDENTIAL_B64: ${{ secrets.BAZEL_CACHE_CREDENTIAL_B64 }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} #LINUX_WHEELS: 1 - LINT: 1 #MAC_WHEELS: 1 RAY_DEFAULT_BUILD: 1 WINDOWS_WHEELS: 1 run: | . ./ci/travis/ci.sh init - . ./ci/travis/ci.sh lint . ./ci/travis/ci.sh build . ./ci/travis/ci.sh upload_wheels || true . ./ci/travis/ci.sh test_python diff --git a/build.sh b/build.sh index cd2657a2a..37f5ad8db 100755 --- a/build.sh +++ b/build.sh @@ -143,7 +143,7 @@ if [ "$RAY_BUILD_PYTHON" == "YES" ]; then # Install pickle5-backport. TEMP_DIR="$(mktemp -d)" pushd "$TEMP_DIR" - wget --quiet -O pickle5-backport.zip https://github.com/suquark/pickle5-backport/archive/8ffe41ceba9d5e2ce8a98190f6b3d2f3325e5a72.zip + curl -f -s -L -R -o "pickle5-backport.zip" "https://github.com/suquark/pickle5-backport/archive/8ffe41ceba9d5e2ce8a98190f6b3d2f3325e5a72.zip" unzip pickle5-backport.zip pushd pickle5-backport-8ffe41ceba9d5e2ce8a98190f6b3d2f3325e5a72 CC=gcc "$PYTHON_EXECUTABLE" setup.py --quiet bdist_wheel diff --git a/ci/travis/check-git-clang-format-output.sh b/ci/travis/check-git-clang-format-output.sh index 6dc0b51ca..91c583bca 100755 --- a/ci/travis/check-git-clang-format-output.sh +++ b/ci/travis/check-git-clang-format-output.sh @@ -5,7 +5,7 @@ if [ -z "${TRAVIS_PULL_REQUEST-}" ] || [ "${TRAVIS_PULL_REQUEST}" = "false" ]; t base_commit="HEAD^" echo "Running clang-format against parent commit $(git rev-parse "$base_commit")" else - base_commit="$TRAVIS_BRANCH" + base_commit="$(git merge-base "${TRAVIS_BRANCH}" HEAD)" echo "Running clang-format against branch $base_commit, with hash $(git rev-parse "$base_commit")" fi exclude_regex="(.*thirdparty/|.*redismodule.h|.*.java|.*.jsx?|.*.tsx?)" diff --git a/ci/travis/ci.sh b/ci/travis/ci.sh index 8c901135c..8581fe31d 100755 --- a/ci/travis/ci.sh +++ b/ci/travis/ci.sh @@ -262,10 +262,14 @@ build_wheels() { } lint_readme() { - ( - cd "${WORKSPACE_DIR}"/python - python setup.py check --restructuredtext --strict --metadata - ) + if python -s -c "import docutils" >/dev/null 2>/dev/null; then + ( + cd "${WORKSPACE_DIR}"/python + python setup.py check --restructuredtext --strict --metadata + ) + else + echo "Skipping README lint because the docutils package is not installed" 1>&2 + fi } lint_python() { @@ -310,7 +314,11 @@ _lint() { linux*) platform=linux;; esac - "${ROOT_DIR}"/check-git-clang-format-output.sh + if command -v clang-format > /dev/null; then + "${ROOT_DIR}"/check-git-clang-format-output.sh + else + { echo "WARNING: Skipping linting C/C++ as clang-format is not installed."; } 2> /dev/null + fi # Run Python linting lint_python