Skip to content

Commit

Permalink
Check documentation in the scope of quality pipeline
Browse files Browse the repository at this point in the history
The new Ci image is pushed (version 3) which contains Python and
MkDocs installation. This allows adding a check for documentation
building to the testing procedure. This procedure tries to build the
HTML docs. If they build successfully, we assume that documentation
is good enough.

#140
  • Loading branch information
extsoft committed Jul 15, 2019
1 parent adc1340 commit ca0632f
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 27 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea/
tmp/
site/
6 changes: 3 additions & 3 deletions .rultor.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
architect: extsoft
docker:
image: beeshive/elegant-git-ci:2
image: beeshive/elegant-git-ci:3
as_root: true
merge:
fast-forward: only
rebase: true
script: ./run-tests
script: ./quality-pipeline.bash testing
release:
script: |-
./quality-pipeline.bash testing
echo "Release ${tag}"
bats --tap src/test
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
sudo: required
language: bash
services: docker
script: docker run -t --rm -v $PWD:/eg beeshive/elegant-git-ci:2 ./run-tests
script: docker run -it --rm -v $PWD:/eg beeshive/elegant-git-ci:3 ./quality-pipeline.bash testing
notifications:
email: false
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
FROM ruby:2.4.1-alpine3.6
RUN apk update && \
apk upgrade && \
apk add --no-cache bats=0.4.0-r2 build-base libffi-dev ncurses git && \
apk add --no-cache bats=0.4.0-r2 build-base libffi-dev ncurses git python3 && \
ln -sf $(which python3) /usr/bin/python && \
ln -sf $(which pip3) /usr/bin/pip && pip install --upgrade pip && \
gem install pdd
LABEL maintainer="Dmytro Serdiuk <[email protected]>" \
description="ruby:2.4.1 git:2.13.5 0pdd:0.20.3" \
version=2
description="Run the image without arguments to get the desciption." \
version=3
COPY docs/requirements.txt entry.bash /
RUN pip install --no-cache -r requirements.txt && rm -r requirements.txt
WORKDIR /eg
ENV EG_ENABLE_TESTING true
CMD ["./quality-pipeline.bash", "--version"]
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ Run `unset GED` to switch debug off.
A testing procedure consists of 3 steps:
1. unit testing using [bats](https://github.com/sstephenson/bats)
2. installation testing
3. validation of todo' correctness (for [0pdd](http://www.0pdd.com/p?name=bees-hive/elegant-git))
3. validation of documentation correctness
4. validation of todo' correctness (for [0pdd](http://www.0pdd.com/p?name=bees-hive/elegant-git))

All these steps can be executed by
`docker run -it --rm -v $PWD:/eg beeshive/elegant-git-ci:2 ./run-tests`.
`docker run -it --rm -v $PWD:/eg beeshive/elegant-git-ci:3 ./quality-pipeline.bash testing`.

`beeshive/elegant-git-ci` Docker image is also used on CI. If the image requires modifications,
it has to be updated manually by the following instructions:
Expand Down
50 changes: 50 additions & 0 deletions quality-pipeline.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
# This script is destructive! That's why it will work only if a specific variable is set.
# It's recommended to run it within a docker container only.
# Usage:
# ./quality-pipeline.bash runs quality pipeline
# ./quality-pipeline.bash --version prints tooling version
set -e

fail() {
echo $@
exit 1
}

pipeline() {
bats --tap tests || fail "Unit tests are failed."
./install.bash /usr/local src && git elegant help || fail "Installation test is failed."
mkdocs build --clean --strict || fail "Unable to build the documentation."
pdd --exclude=.idea/**/* \
--exclude=site/**/* \
--verbose --file=/dev/null || fail "Unreadable todo is identified."
}

say-version() {
echo "<<< $@ >>>"
echo "$($@)"
echo ""
}

main() {
case $1 in
--version)
say-version "bats --version"
say-version "ruby --version"
say-version "pdd --version"
say-version "python --version"
say-version "pip freeze"
;;
testing)
if [[ -z $EG_ENABLE_TESTING ]]; then
echo "Testing is disabled!"
exit 1
fi
pipeline
;;
*)
echo "Available commands: --version or testing"; exit 1
esac
}

main $@
18 changes: 0 additions & 18 deletions run-tests

This file was deleted.

0 comments on commit ca0632f

Please sign in to comment.