[ci] refactoring

This commit is contained in:
JAremko 2021-08-01 23:34:01 +03:00 committed by Eugene Yaremenko
parent 168e68e2d5
commit ac1087ea4e
7 changed files with 40 additions and 29 deletions

View File

@ -78,16 +78,16 @@ jobs:
command: .circleci/built_in/upd_built_in
- run:
name: Create patch file with the updates
command: .circleci/make_patch
command: .circleci/update/make_patch
- run:
name: Apply the patch file
command: .circleci/apply_patch
command: .circleci/update/apply_patch
- run:
name: Push changes to Spacemacs Bot account
command: .circleci/push
command: .circleci/update/push
- run:
name: Open PR if built in files must be updated
command: .circleci/maybe_pr
command: .circleci/update/maybe_pr
"Update documentation files":
executor: spacetools
environment:
@ -110,16 +110,16 @@ jobs:
command: .circleci/org/update_docs
- run:
name: Create patch file with the updates
command: .circleci/make_patch
command: .circleci/update/make_patch
- run:
name: Apply the patch file
command: .circleci/apply_patch
command: .circleci/update/apply_patch
- run:
name: Push changes to Spacemacs Bot account
command: .circleci/push
command: .circleci/update/push
- run:
name: Open PR if documentation needs fixes
command: .circleci/maybe_pr
command: .circleci/update/maybe_pr
"Update website documentation":
executor: spacetools
environment:
@ -158,16 +158,18 @@ jobs:
command: rsync -avh ~/.emacs.d/export/ "/tmp/${PUBLISH}_old"
- run:
name: Create patch file with the updates
command: cd "/tmp/${PUBLISH}_old" && ~/.emacs.d/.circleci/make_patch
command: |
cd "/tmp/${PUBLISH}_old" && \
~/.emacs.d/.circleci/update/make_patch
- run:
name: Apply the patch file
command: .circleci/apply_patch
command: .circleci/update/apply_patch
- run:
name: Push changes to Spacemacs Bot account
command: .circleci/push
command: .circleci/update/push
- run:
name: Open PR if web documentation needs fixes
command: .circleci/maybe_pr
command: .circleci/update/maybe_pr
workflows:
version: 2.1

View File

@ -41,7 +41,7 @@ echo_headline () {
echo
}
exit_if_no_changes () {
exit_if_no_patchfile () {
if [ ! -f "/tmp/${PUBLISH}.patch" ]; then
echo "\"/tmp/${PUBLISH}.patch\" file doesn't exists. Exiting."
exit 0

View File

@ -10,7 +10,7 @@
##
## License: GPLv3
exit_if_no_changes
exit_if_no_patchfile
echo_headline "Cloning target repository"
target_URL="https://github.com/${prj_owner}/${prj_repo}.git"
@ -29,10 +29,17 @@ if [ $? -ne 0 ]; then
exit 2
fi
echo_headline "Creating commit"
git add --all
git commit -m "[bot] \"${PUBLISH}\" $(date -u)"
if [ $? -ne 0 ]; then
echo "Faild to create commit."
exit 2
if [[ $(git diff --stat) != '' ]]; then
echo_headline "Creating commit"
git commit -m "[bot] \"${PUBLISH}\" $(date -u)"
if [ $? -ne 0 ]; then
echo "Failed to create commit."
exit 2
fi
else
echo "Nothing to commit."
rm "/tmp/${PUBLISH}.patch"
exit 0
fi

View File

@ -10,7 +10,7 @@
##
## License: GPLv3
exit_if_no_changes
exit_if_no_patchfile
cd "/tmp/${PUBLISH}"

View File

@ -10,7 +10,7 @@
##
## License: GPLv3
exit_if_no_changes
exit_if_no_patchfile
cd "/tmp/${PUBLISH}"

View File

@ -102,12 +102,13 @@ the JVM drawbacks are mitigated, for the particular use case anyway.
it doesn't always work and requires personal token to run automatically.
- =stale.yml= manages stale issues and PRs.
- [[https://github.com/syl20bnr/spacemacs/tree/develop/.circleci][.circleci]] everything specific for CircleCI. Documentation related files
stored in the =org= sub folder, =web= is where HTML export stuff hides and
=built_in= is all about updating built-in files. The rest is a bunch of
stored in the =org= sub folder, =web= is where HTML export stuff hides,
=built_in= is all about updating built-in files and =update= contains helpers
related to making patches and pushing changes. The rest is a bunch of
shared script files. The specific cases are =shared= file that loads before
each script run for every job, =config.yml= - CircleCI bootstrap script that
generates the config that CircleCI will run by populating =config_tmpl.yml=
file - actual config.
generates the config that CircleCI runs for actual jobs. It does so by
rendering =config_tmpl.yml= template file.
* Workflows (groups of CI jobs)
** Pull request jobs
@ -176,8 +177,8 @@ environment variable) uses GitHub token (stored in CircleCI project settings) to
push updated version of Spacemacs develop branch into its fork (=UPD_BOT_REPO=)
then it opens pull request to =PRJ_REPO= owned by =PRJ_OWNER= (the fork is based
on it). =PUBLISH= variable also used as a name for the fork repo branch while
=PR_BRANCH= is the branch against which PR will be opened. See [[https://github.com/syl20bnr/spacemacs/blob/develop/.circleci/push][.circleci/push]]
and [[https://github.com/syl20bnr/spacemacs/blob/develop/.circleci/maybe_pr][.circleci/maybe_pr]] files for inner-works. Most of bash variables are
=PR_BRANCH= is the branch against which PR will be opened. See [[https://github.com/syl20bnr/spacemacs/blob/develop/.circleci/update/push][.circleci/update/push]]
and [[https://github.com/syl20bnr/spacemacs/blob/develop/.circleci/update/maybe_pr][.circleci/update/maybe_pr]] files for inner-works. Most of bash variables are
configured in the [[https://github.com/syl20bnr/spacemacs/blob/develop/.circleci/shared][.circleci/shared]] file. The PRs are merged manually.
**** Built-in updates
@ -235,8 +236,9 @@ develop branch is pushed.
failures since they vastly outnumber failed ones.
- See if we actually properly clean all they side effects between running
EmacsLisp tests.
- CircleCI script files can have better names. Also =.circleci= directory gets
a bit crowded.
- CircleCI script files can have better names.
- Better error reporting in scripts. It is hard to debug CI so knowing what
exactly went wrong would help a lot.
* Side notes
** We used to have TravisCI (3 CI providers at the same time)