[ci] refactoring
This commit is contained in:
parent
168e68e2d5
commit
ac1087ea4e
|
@ -78,16 +78,16 @@ jobs:
|
||||||
command: .circleci/built_in/upd_built_in
|
command: .circleci/built_in/upd_built_in
|
||||||
- run:
|
- run:
|
||||||
name: Create patch file with the updates
|
name: Create patch file with the updates
|
||||||
command: .circleci/make_patch
|
command: .circleci/update/make_patch
|
||||||
- run:
|
- run:
|
||||||
name: Apply the patch file
|
name: Apply the patch file
|
||||||
command: .circleci/apply_patch
|
command: .circleci/update/apply_patch
|
||||||
- run:
|
- run:
|
||||||
name: Push changes to Spacemacs Bot account
|
name: Push changes to Spacemacs Bot account
|
||||||
command: .circleci/push
|
command: .circleci/update/push
|
||||||
- run:
|
- run:
|
||||||
name: Open PR if built in files must be updated
|
name: Open PR if built in files must be updated
|
||||||
command: .circleci/maybe_pr
|
command: .circleci/update/maybe_pr
|
||||||
"Update documentation files":
|
"Update documentation files":
|
||||||
executor: spacetools
|
executor: spacetools
|
||||||
environment:
|
environment:
|
||||||
|
@ -110,16 +110,16 @@ jobs:
|
||||||
command: .circleci/org/update_docs
|
command: .circleci/org/update_docs
|
||||||
- run:
|
- run:
|
||||||
name: Create patch file with the updates
|
name: Create patch file with the updates
|
||||||
command: .circleci/make_patch
|
command: .circleci/update/make_patch
|
||||||
- run:
|
- run:
|
||||||
name: Apply the patch file
|
name: Apply the patch file
|
||||||
command: .circleci/apply_patch
|
command: .circleci/update/apply_patch
|
||||||
- run:
|
- run:
|
||||||
name: Push changes to Spacemacs Bot account
|
name: Push changes to Spacemacs Bot account
|
||||||
command: .circleci/push
|
command: .circleci/update/push
|
||||||
- run:
|
- run:
|
||||||
name: Open PR if documentation needs fixes
|
name: Open PR if documentation needs fixes
|
||||||
command: .circleci/maybe_pr
|
command: .circleci/update/maybe_pr
|
||||||
"Update website documentation":
|
"Update website documentation":
|
||||||
executor: spacetools
|
executor: spacetools
|
||||||
environment:
|
environment:
|
||||||
|
@ -158,16 +158,18 @@ jobs:
|
||||||
command: rsync -avh ~/.emacs.d/export/ "/tmp/${PUBLISH}_old"
|
command: rsync -avh ~/.emacs.d/export/ "/tmp/${PUBLISH}_old"
|
||||||
- run:
|
- run:
|
||||||
name: Create patch file with the updates
|
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:
|
- run:
|
||||||
name: Apply the patch file
|
name: Apply the patch file
|
||||||
command: .circleci/apply_patch
|
command: .circleci/update/apply_patch
|
||||||
- run:
|
- run:
|
||||||
name: Push changes to Spacemacs Bot account
|
name: Push changes to Spacemacs Bot account
|
||||||
command: .circleci/push
|
command: .circleci/update/push
|
||||||
- run:
|
- run:
|
||||||
name: Open PR if web documentation needs fixes
|
name: Open PR if web documentation needs fixes
|
||||||
command: .circleci/maybe_pr
|
command: .circleci/update/maybe_pr
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2.1
|
version: 2.1
|
||||||
|
|
|
@ -41,7 +41,7 @@ echo_headline () {
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
exit_if_no_changes () {
|
exit_if_no_patchfile () {
|
||||||
if [ ! -f "/tmp/${PUBLISH}.patch" ]; then
|
if [ ! -f "/tmp/${PUBLISH}.patch" ]; then
|
||||||
echo "\"/tmp/${PUBLISH}.patch\" file doesn't exists. Exiting."
|
echo "\"/tmp/${PUBLISH}.patch\" file doesn't exists. Exiting."
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
##
|
##
|
||||||
## License: GPLv3
|
## License: GPLv3
|
||||||
|
|
||||||
exit_if_no_changes
|
exit_if_no_patchfile
|
||||||
|
|
||||||
echo_headline "Cloning target repository"
|
echo_headline "Cloning target repository"
|
||||||
target_URL="https://github.com/${prj_owner}/${prj_repo}.git"
|
target_URL="https://github.com/${prj_owner}/${prj_repo}.git"
|
||||||
|
@ -29,10 +29,17 @@ if [ $? -ne 0 ]; then
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo_headline "Creating commit"
|
|
||||||
git add --all
|
git add --all
|
||||||
git commit -m "[bot] \"${PUBLISH}\" $(date -u)"
|
|
||||||
if [ $? -ne 0 ]; then
|
if [[ $(git diff --stat) != '' ]]; then
|
||||||
echo "Faild to create commit."
|
echo_headline "Creating commit"
|
||||||
exit 2
|
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
|
fi
|
|
@ -10,7 +10,7 @@
|
||||||
##
|
##
|
||||||
## License: GPLv3
|
## License: GPLv3
|
||||||
|
|
||||||
exit_if_no_changes
|
exit_if_no_patchfile
|
||||||
|
|
||||||
cd "/tmp/${PUBLISH}"
|
cd "/tmp/${PUBLISH}"
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
##
|
##
|
||||||
## License: GPLv3
|
## License: GPLv3
|
||||||
|
|
||||||
exit_if_no_changes
|
exit_if_no_patchfile
|
||||||
|
|
||||||
cd "/tmp/${PUBLISH}"
|
cd "/tmp/${PUBLISH}"
|
||||||
|
|
|
@ -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.
|
it doesn't always work and requires personal token to run automatically.
|
||||||
- =stale.yml= manages stale issues and PRs.
|
- =stale.yml= manages stale issues and PRs.
|
||||||
- [[https://github.com/syl20bnr/spacemacs/tree/develop/.circleci][.circleci]] everything specific for CircleCI. Documentation related files
|
- [[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
|
stored in the =org= sub folder, =web= is where HTML export stuff hides,
|
||||||
=built_in= is all about updating built-in files. The rest is a bunch of
|
=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
|
shared script files. The specific cases are =shared= file that loads before
|
||||||
each script run for every job, =config.yml= - CircleCI bootstrap script that
|
each script run for every job, =config.yml= - CircleCI bootstrap script that
|
||||||
generates the config that CircleCI will run by populating =config_tmpl.yml=
|
generates the config that CircleCI runs for actual jobs. It does so by
|
||||||
file - actual config.
|
rendering =config_tmpl.yml= template file.
|
||||||
|
|
||||||
* Workflows (groups of CI jobs)
|
* Workflows (groups of CI jobs)
|
||||||
** Pull request 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=)
|
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
|
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
|
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]]
|
=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/maybe_pr][.circleci/maybe_pr]] files for inner-works. Most of bash variables are
|
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.
|
configured in the [[https://github.com/syl20bnr/spacemacs/blob/develop/.circleci/shared][.circleci/shared]] file. The PRs are merged manually.
|
||||||
|
|
||||||
**** Built-in updates
|
**** Built-in updates
|
||||||
|
@ -235,8 +236,9 @@ develop branch is pushed.
|
||||||
failures since they vastly outnumber failed ones.
|
failures since they vastly outnumber failed ones.
|
||||||
- See if we actually properly clean all they side effects between running
|
- See if we actually properly clean all they side effects between running
|
||||||
EmacsLisp tests.
|
EmacsLisp tests.
|
||||||
- CircleCI script files can have better names. Also =.circleci= directory gets
|
- CircleCI script files can have better names.
|
||||||
a bit crowded.
|
- Better error reporting in scripts. It is hard to debug CI so knowing what
|
||||||
|
exactly went wrong would help a lot.
|
||||||
|
|
||||||
* Side notes
|
* Side notes
|
||||||
** We used to have TravisCI (3 CI providers at the same time)
|
** We used to have TravisCI (3 CI providers at the same time)
|
||||||
|
|
Loading…
Reference in New Issue