CI cleanup

This commit is contained in:
JAremko 2020-06-21 16:07:13 +03:00 committed by Eugene Yaremenko
parent 80f17249e9
commit 28ebdf2908
7 changed files with 50 additions and 65 deletions

View File

@ -14,18 +14,13 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "${DIR}/shared"
if [[ -z "${CIRCLE_PR_NUMBER// }" ]]; then
echo "Skipping PR check for branch update."
exit 0
fi
skip_for_branch_update
pr_base=$(curl -s "${pr_data_URL}" | jq '.base.ref')
if [[ "${pr_base}" == "\"develop\"" ]]; then
if [[ "${pr_base}" == "\"${dev_b}\"" ]]; then
echo "You are PRing to the develop branch. This is good."
exit 0
elif [[ "${pr_base}" == "\"master\"" ]]; then
elif [[ "${pr_base}" == "\"${mst_b}\"" ]]; then
printf '=%.0s' {1..80}
printf "\n し(*・∀・) Thanks for the contribution! (・∀・*)\n"
printf '=%.0s' {1..80}

View File

@ -14,13 +14,9 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "${DIR}/shared"
## This seems to bug out when someone has a CircleCI setup at the source fork.
# if [[ -z "${CIRCLE_PR_NUMBER// }" ]]; then
# echo "Skipping changelogs check for branch update."
# exit 0
# fi
skip_for_branch_update
if [[ "$CIRCLE_PR_USERNAME" == "emacspace" ]]; then
if [[ "$CIRCLE_PR_USERNAME" == "${bot_login}" ]]; then
echo "Fun fact. Bots can't climb stairs or update CHANGELOG.develop"
exit 0
fi
@ -28,7 +24,8 @@ fi
if grep -q CHANGELOG.develop /tmp/changed_files; then
echo "CHANGELOG.develop was updated as required"
else
echo "Please mention your contribution in CHANGELOG.develop"
echo "Please describe your contribution in CHANGELOG.develop"
echo "if you want it to be mentioned in the release file."
echo "See CONTRIBUTING.org for the details."
exit 1
fi

View File

@ -14,13 +14,9 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "${DIR}/shared"
if [[ -z "${CIRCLE_PR_NUMBER// }" ]]; then
echo "Skipping PR rebase check for branch update."
exit 0
fi
skip_for_branch_update
upstream_head_sha=$(curl -s "${upstream_data_URL}" | jq '.commit.sha')
pr_base_sha=$(curl -s "${pr_data_URL}" | jq '.base.sha')
if [[ "${upstream_head_sha}" == "${pr_base_sha}" ]]; then
@ -35,8 +31,8 @@ else
echo_headline "How to rebase PR(first timer guide):"
printf "git remote add upstream "
printf "https://github.com/"
printf "${CIRCLE_PROJECT_USERNAME}/"
printf "${CIRCLE_PROJECT_REPONAME}.git\n"
printf "${prj_owner}/"
printf "${prj_repo}.git\n"
printf "git fetch upstream\n"
printf "git rebase upstream/develop\n"
printf "git push --force\n"

View File

@ -14,15 +14,7 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "${DIR}/shared"
if [[ -z "${CIRCLE_PR_NUMBER// }" ]]; then
echo "Skipping documentation validation for branch update."
exit 0
fi
pr_patch_URL="https://patch-diff.githubusercontent.com/raw/"
pr_patch_URL+="${CIRCLE_PROJECT_USERNAME}/"
pr_patch_URL+="${CIRCLE_PROJECT_REPONAME}/pull/"
pr_patch_URL+="${CIRCLE_PR_NUMBER}.patch"
skip_for_branch_update
echo "PATCH_URL: \"${pr_patch_URL}\""

View File

@ -11,6 +11,24 @@
##
## 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"
@ -18,13 +36,24 @@ echo_headline () {
echo
}
upstream_data_URL_root="https://api.github.com/repos/"
upstream_data_URL_root+="${CIRCLE_PROJECT_USERNAME}/"
upstream_data_URL_root+="${CIRCLE_PROJECT_REPONAME}"
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
}
pr_data_URL="${upstream_data_URL_root}/pulls/${CIRCLE_PR_NUMBER}"
upstream_data_URL="${upstream_data_URL_root}/branches/develop"
skip_for_branch_update () {
if [[ -z "${CIRCLE_PR_NUMBER// }" ]]; then
echo "Skipping for branch update."
exit 0
fi
}
cleanup () {
rm -rf ~/.emacs.d/elpa ~/.emacs.d/.cache -f ~/.spacemacs

View File

@ -14,21 +14,9 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "${DIR}/../shared"
if [[ -z "${CIRCLE_PR_NUMBER// }" ]]; then
echo "Skipping documentation validation for branch update."
exit 0
fi
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
skip_for_branch_update
select_changed_orgs
if [ ${#changed_f_as_args[@]} -ne 0 ]; then
emacs -batch -l /opt/spacetools/spacedoc/sdnize/sdnize.el -no-site-file \
-q /root/.emacs.d/ /tmp/exported/ \

View File

@ -14,21 +14,9 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "${DIR}/../shared"
if [[ -z "${CIRCLE_PR_NUMBER// }" ]]; then
echo "Skipping documentation validation for branch update."
exit 0
fi
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
skip_for_branch_update
select_changed_orgs
if [ ${#changed_f_as_args[@]} -ne 0 ]; then
spacedoc validate -c"./.ci/spacedoc-cfg.edn" /tmp/exported/
if [ $? -ne 0 ]; then