-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automate development chore using single entry script
`workflows` script provides capabilities on managing development routine. It is a single entry point to run any developers command and is used in CI setup. In the future, if there is an action which simplifies development, it must be added to the script. Any other subscripts are stores within `.workflows` directory. This cleans root directory and keeps non-production code separated.
- Loading branch information
Showing
9 changed files
with
90 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
architect: extsoft | ||
docker: | ||
image: beeshive/elegant-git-ci:3 | ||
image: beeshive/elegant-git-ci:4 | ||
as_root: true | ||
merge: | ||
fast-forward: only | ||
rebase: true | ||
script: ./quality-pipeline.bash testing | ||
script: .workflows/ci-pipeline.bash testing | ||
release: | ||
script: |- | ||
./quality-pipeline.bash testing | ||
.workflows/ci-pipeline.bash testing | ||
echo "Release ${tag}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
sudo: required | ||
language: bash | ||
services: docker | ||
script: docker run -it --rm -v $PWD:/eg beeshive/elegant-git-ci:3 ./quality-pipeline.bash testing | ||
script: ./workflows ci | ||
notifications: | ||
email: false |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,8 @@ RUN apk update && \ | |
LABEL maintainer="Dmytro Serdiuk <[email protected]>" \ | ||
description="Run the image without arguments to get the desciption." \ | ||
version=3 | ||
COPY docs/requirements.txt entry.bash / | ||
COPY docs/requirements.txt / | ||
RUN pip install --no-cache -r requirements.txt && rm -r requirements.txt | ||
WORKDIR /eg | ||
ENV EG_ENABLE_TESTING true | ||
CMD ["./quality-pipeline.bash", "--version"] | ||
CMD [".workflows/ci-pipeline.bash", "--version"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,91 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
set -e | ||
|
||
source ./libexec/plugins/text | ||
|
||
WORKER_IMAGE="beeshive/elegant-git-ci:4" | ||
|
||
testing() { | ||
docker run -it --rm -v $PWD:/eg beeshive/elegant-git-ci:3 ./.wf/tests-execution.bash $@ | ||
docker run -it --rm -v $PWD:/eg ${WORKER_IMAGE} .workflows/bats-pipeline.bash "$@" | ||
} | ||
|
||
documentation() { | ||
.workflows/docs-generation.bash | ||
} | ||
|
||
repository() { | ||
docker run -idt --rm --name repository --workdir /tmp/elegant-git-repo -v $PWD:/eg beeshive/elegant-git-ci:3 bash | ||
info-text "Start container..." | ||
docker run -idt --rm --name repository --workdir /tmp/elegant-git-repo -v $PWD:/eg ${WORKER_IMAGE} bash | ||
info-text "Init repository..." | ||
docker exec -it repository bash -c "source /eg/tests/addons-git.bash;source /eg/tests/addons-common.bash; init-repo" | ||
info-text "Install Elegant Git..." | ||
docker exec -it repository bash -c "cd /eg; ./install.bash /usr/local src" | ||
info-text "Ready! Enjoy experiments..." | ||
docker attach repository | ||
} | ||
|
||
ci() { | ||
docker run --rm -v $PWD:/eg ${WORKER_IMAGE} .workflows/ci-pipeline.bash testing | ||
} | ||
|
||
prepare-worker() { | ||
if [[ -z ${1} ]]; then | ||
error-text "Please specify a tag for Docker image (like '2')" | ||
fi | ||
docker build --no-cache -t beeshive/elegant-git-ci:${1} . | ||
} | ||
|
||
publish-worker() { | ||
if [[ -z ${1} ]]; then | ||
error-text "Please specify a tag for Docker image (like '2')" | ||
fi | ||
docker push beeshive/elegant-git-ci:${1} | ||
} | ||
|
||
usage() { | ||
cat <<MESSAGE | ||
usage: ${BASH_SOURCE[0]} [command] [arg]... | ||
Available commands: | ||
help prints this message | ||
testing runs bats tests; accepts a optional pattern for tests | ||
filtering ("${BASH_SOURCE[0]} testing work" run all tests | ||
which have the word in the test name) | ||
repository creates a git repository and installs Elegant Git within | ||
documentation generates fresh commands documentation bases on the latest | ||
changes | ||
ci runs CI quality assessment workflow | ||
prepare-worker builds a new worker image | ||
publish-worker pushes a new worker image | ||
MESSAGE | ||
} | ||
|
||
commands=( | ||
usage | ||
testing | ||
repository | ||
documentation | ||
ci | ||
prepare-worker | ||
publish-worker | ||
) | ||
|
||
main() { | ||
local command=${1} | ||
if [[ -z "${command}" ]]; then | ||
if [[ -z ${command} ]]; then | ||
question-text "Please select a command:" | ||
echo "" | ||
select any in ${commands[@]}; do | ||
command=${any} | ||
question-text "Please give the arguments: " | ||
read args | ||
break | ||
done | ||
else | ||
shift | ||
fi | ||
${command} ${@} | ||
info-box "Run:" ${command} ${args:-${@}} | ||
${command} ${args:-${@}} | ||
} | ||
|
||
main ${@} |