From 93504da3a932f33126545ebc9383f695a6efe51e Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Fri, 18 Dec 2020 12:17:25 +0200 Subject: [PATCH 1/4] ci: Fix COMMIT_RANGE variable value for PRs --- ci/lint/05_before_script.sh | 9 --------- ci/lint/06_script.sh | 6 ++---- ci/lint_run_all.sh | 1 - 3 files changed, 2 insertions(+), 14 deletions(-) delete mode 100755 ci/lint/05_before_script.sh diff --git a/ci/lint/05_before_script.sh b/ci/lint/05_before_script.sh deleted file mode 100755 index 8e5a177b01..0000000000 --- a/ci/lint/05_before_script.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright (c) 2018-2019 The Bitcoin Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -export LC_ALL=C - -git fetch diff --git a/ci/lint/06_script.sh b/ci/lint/06_script.sh index ba582e7bf6..8aa775c28a 100755 --- a/ci/lint/06_script.sh +++ b/ci/lint/06_script.sh @@ -7,12 +7,10 @@ export LC_ALL=C if [ -n "$CIRRUS_PR" ]; then - # CIRRUS_PR will be present in a Cirrus environment. For builds triggered - # by a pull request this is the name of the branch targeted by the pull request. - # https://cirrus-ci.org/guide/writing-tasks/#environment-variables - COMMIT_RANGE="$CIRRUS_BRANCH..HEAD" + COMMIT_RANGE="$CIRRUS_BASE_SHA..HEAD" test/lint/commit-script-check.sh $COMMIT_RANGE fi +export COMMIT_RANGE # This only checks that the trees are pure subtrees, it is not doing a full # check with -r to not have to fetch all the remotes. diff --git a/ci/lint_run_all.sh b/ci/lint_run_all.sh index 2623f46828..e383ffd9d6 100755 --- a/ci/lint_run_all.sh +++ b/ci/lint_run_all.sh @@ -8,5 +8,4 @@ export LC_ALL=C.UTF-8 set -o errexit; source ./ci/test/00_setup_env.sh set -o errexit; source ./ci/lint/04_install.sh -set -o errexit; source ./ci/lint/05_before_script.sh set -o errexit; source ./ci/lint/06_script.sh From 10af252d97532843b26505d215f6e975f4b21672 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Fri, 18 Dec 2020 14:03:38 +0200 Subject: [PATCH 2/4] ci: Drop Travis-specific way to set COMMIT_RANGE variable --- test/lint/lint-git-commit-check.sh | 7 ------- test/lint/lint-whitespace.sh | 7 ------- 2 files changed, 14 deletions(-) diff --git a/test/lint/lint-git-commit-check.sh b/test/lint/lint-git-commit-check.sh index ecaad215c4..2b3a9b87c2 100755 --- a/test/lint/lint-git-commit-check.sh +++ b/test/lint/lint-git-commit-check.sh @@ -23,13 +23,6 @@ while getopts "?" opt; do esac done -# TRAVIS_BRANCH will be present in a Travis environment. For builds triggered -# by a pull request this is the name of the branch targeted by the pull request. -# https://docs.travis-ci.com/user/environment-variables/ -if [ -n "${TRAVIS_BRANCH}" ]; then - COMMIT_RANGE="$TRAVIS_BRANCH..HEAD" -fi - if [ -z "${COMMIT_RANGE}" ]; then if [ -n "$1" ]; then COMMIT_RANGE="HEAD~$1...HEAD" diff --git a/test/lint/lint-whitespace.sh b/test/lint/lint-whitespace.sh index 80af0a439d..2c42846e67 100755 --- a/test/lint/lint-whitespace.sh +++ b/test/lint/lint-whitespace.sh @@ -22,13 +22,6 @@ while getopts "?" opt; do esac done -# TRAVIS_BRANCH will be present in a Travis environment. For builds triggered -# by a pull request this is the name of the branch targeted by the pull request. -# https://docs.travis-ci.com/user/environment-variables/ -if [ -n "${TRAVIS_BRANCH}" ]; then - COMMIT_RANGE="$TRAVIS_BRANCH..HEAD" -fi - if [ -z "${COMMIT_RANGE}" ]; then if [ -n "$1" ]; then COMMIT_RANGE="HEAD~$1...HEAD" From c123892c2e47e3706f06820aba2454d494a39564 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Fri, 18 Dec 2020 14:15:55 +0200 Subject: [PATCH 3/4] ci: Drop Travis-specific workaround for shellcheck --- test/lint/lint-shell.sh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/test/lint/lint-shell.sh b/test/lint/lint-shell.sh index 351b65dea6..4dbf5ed28e 100755 --- a/test/lint/lint-shell.sh +++ b/test/lint/lint-shell.sh @@ -8,14 +8,6 @@ export LC_ALL=C -# The shellcheck binary segfault/coredumps in Travis with LC_ALL=C -# It does not do so in Ubuntu 14.04, 16.04, 18.04 in versions 0.3.3, 0.3.7, 0.4.6 -# respectively. So export LC_ALL=C is set as required by lint-shell-locale.sh -# but unset here in case of running in Travis. -if [ "$TRAVIS" = "true" ]; then - unset LC_ALL -fi - # Disabled warnings: disabled=( SC2046 # Quote this to prevent word splitting. From 3c2478c38522c176e81befd4d991a259b09be063 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Sun, 20 Dec 2020 13:47:20 +0200 Subject: [PATCH 4/4] ci: Print COMMIT_RANGE to the log as it was in Travis CI --- ci/lint/06_script.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ci/lint/06_script.sh b/ci/lint/06_script.sh index 8aa775c28a..ed65095556 100755 --- a/ci/lint/06_script.sh +++ b/ci/lint/06_script.sh @@ -6,8 +6,9 @@ export LC_ALL=C +GIT_HEAD=$(git rev-parse HEAD) if [ -n "$CIRRUS_PR" ]; then - COMMIT_RANGE="$CIRRUS_BASE_SHA..HEAD" + COMMIT_RANGE="$CIRRUS_BASE_SHA..$GIT_HEAD" test/lint/commit-script-check.sh $COMMIT_RANGE fi export COMMIT_RANGE @@ -28,3 +29,6 @@ if [ "$CIRRUS_REPO_FULL_NAME" = "bitcoin/bitcoin" ] && [ -n "$CIRRUS_CRON" ]; th ${CI_RETRY_EXE} gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys $(