Changeset View
Changeset View
Standalone View
Standalone View
contrib/source-control-tools/automated-commits.sh
Show First 20 Lines • Show All 195 Lines • ▼ Show 20 Lines | update-timings) | ||||
;; | ;; | ||||
*) | *) | ||||
echo "Error: Invalid commit name '${COMMIT_TYPE}'" | echo "Error: Invalid commit name '${COMMIT_TYPE}'" | ||||
exit 10 | exit 10 | ||||
;; | ;; | ||||
esac | esac | ||||
echo "Sanity checks..." | |||||
LINT_OUTPUT=$(arc lint --never-apply-patches) | |||||
LINT_EXIT_CODE=$? | |||||
# If there is more than one line of output, then lint advice lines are likely present. | |||||
# We treat these as errors because code generators should always produce lint-free code. | |||||
LINT_NUM_LINES=$(echo ${LINT_OUTPUT} | wc -l) | |||||
if [ "${LINT_EXIT_CODE}" -ne 0 ] || [ "${LINT_NUM_LINES}" -gt 1 ]; then | |||||
echo "Error: The linter found issues with the automated commit. Correct the issue in the code generator and try again." | |||||
exit 20 | |||||
fi | |||||
# Smoke tests to give some confidence that master won't be put into a bad state | # Smoke tests to give some confidence that master won't be put into a bad state | ||||
pushd "${BUILD_DIR}" | "${DEVTOOLS_DIR}"/smoke-tests.sh | ||||
"${DEVTOOLS_DIR}"/build_cmake.sh | |||||
ninja check-bitcoin check-functional | |||||
popd | |||||
echo "Pushing automated commit '${COMMIT_TYPE}'..." | echo "Pushing automated commit '${COMMIT_TYPE}'..." | ||||
# Make sure master is up-to-date. If there is a merge conflict, this script | # Make sure master is up-to-date. If there is a merge conflict, this script | ||||
# will not attempt to resolve it and simply fail. | # will not attempt to resolve it and simply fail. | ||||
git fetch origin master | git fetch origin master | ||||
git rebase "${PARENT_COMMIT}" | git rebase "${PARENT_COMMIT}" | ||||
git push "${GIT_PUSH_OPTIONS[@]}" origin master | git push "${GIT_PUSH_OPTIONS[@]}" origin master |