bitcoin/ci/lint/06_script.sh

44 lines
1.7 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
#
# Copyright (c) 2018-2022 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
set -ex
2024-03-15 11:00:13 -03:00
if [ -n "$CIRRUS_PR" ]; then
COMMIT_RANGE="HEAD~..HEAD"
2024-03-15 11:00:13 -03:00
if [ "$(git rev-list -1 HEAD)" != "$(git rev-list -1 --merges HEAD)" ]; then
echo "Error: The top commit must be a merge commit, usually the remote 'pull/${PR_NUMBER}/merge' branch."
false
fi
else
2024-03-15 11:00:13 -03:00
# Otherwise, assume that a merge commit exists. This merge commit is assumed
# to be the base, after which linting will be done. If the merge commit is
# HEAD, the range will be empty.
COMMIT_RANGE="$( git rev-list --max-count=1 --merges HEAD )..HEAD"
fi
export COMMIT_RANGE
2024-03-15 11:00:13 -03:00
echo
git log --no-merges --oneline "$COMMIT_RANGE"
echo
test/lint/commit-script-check.sh "$COMMIT_RANGE"
2023-02-14 13:42:12 -03:00
RUST_BACKTRACE=1 "${LINT_RUNNER_PATH}/test_runner"
2021-08-19 05:47:58 -04:00
if [ "$CIRRUS_REPO_FULL_NAME" = "bitcoin/bitcoin" ] && [ "$CIRRUS_PR" = "" ] ; then
# Sanity check only the last few commits to get notified of missing sigs,
# missing keys, or expired keys. Usually there is only one new merge commit
# per push on the master branch and a few commits on release branches, so
# sanity checking only a few (10) commits seems sufficient and cheap.
git log HEAD~10 -1 --format='%H' > ./contrib/verify-commits/trusted-sha512-root-commit
git log HEAD~10 -1 --format='%H' > ./contrib/verify-commits/trusted-git-root
2021-11-07 09:37:56 -03:00
mapfile -t KEYS < contrib/verify-commits/trusted-keys
git config user.email "ci@ci.ci"
git config user.name "ci"
2021-11-07 09:37:56 -03:00
${CI_RETRY_EXE} gpg --keyserver hkps://keys.openpgp.org --recv-keys "${KEYS[@]}" &&
2021-08-19 05:47:58 -04:00
./contrib/verify-commits/verify-commits.py;
fi