This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/.circleci/shared
2020-08-30 09:34:13 +03:00

69 lines
1.7 KiB
Bash
Executable file

#!/usr/bin/env bash
## Shared script part for CircleCI
##
## Copyright (c) 2012-2014 Sylvain Benner
## Copyright (c) 2014-2018 Sylvain Benner & Contributors
##
## Author: Eugene Yaremenko
## URL: https://github.com/syl20bnr/spacemacs
##
## This file is not part of GNU Emacs.
##
## License: GPLv3
# Vars
dev_b="develop"
mst_b="master"
prj_owner="syl20bnr"
prj_repo="spacemacs"
bot_login="emacspace"
upstream_data_URL_root="https://api.github.com/repos/"
upstream_data_URL_root+="${prj_owner}/"
upstream_data_URL_root+="${prj_repo}"
CIRCLE_PR_NUMBER="${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}"
pr_data_URL="${upstream_data_URL_root}/pulls/${CIRCLE_PR_NUMBER}"
upstream_data_URL="${upstream_data_URL_root}/branches/develop"
pr_patch_URL="https://patch-diff.githubusercontent.com/raw/"
pr_patch_URL+="${prj_owner}/"
pr_patch_URL+="${prj_repo}/pull/"
pr_patch_URL+="${CIRCLE_PR_NUMBER}.patch"
# Helpers
echo_headline () {
printf '=%.0s' {1..80}
printf "\n$1\n"
printf '=%.0s' {1..80}
echo
}
select_changed_orgs () {
changed_f_as_args=()
while read p
do
if [ -f "$p" ]; then
if [ ${p: -4} == ".org" ]; then
changed_f_as_args+=("${p}")
fi
fi
done </tmp/changed_files
}
fail_when_undefined_pr_number () {
if [[ -z "${CIRCLE_PR_NUMBER// }" ]]; then
echo "CircleCI didn't set CIRCLE_PR_NUMBER"
echo "nor CIRCLE_PULL_REQUEST."
echo "Job restart sometimes helps."
exit 1
fi
}
skip_when_branch_update () {
if [[ "${IS_BRANCH_UPDATE}" == "yes" ]]; then
echo "Skipping for branch update."
exit 0
fi
}
cleanup () {
rm -rf ~/.emacs.d/elpa ~/.emacs.d/.cache ~/.spacemacs
}