Skip to content

Commit 6f67027

Browse files
committed
Run tests on multiple Bash and Git versions
Now Elegant Git is tested on 2 Git and 3 Bash versions (6 environments in total). All testing happens within Docker containers that work in parallel. The overall workflow is the following: 1. `workflows` runs a given command 2. the command starts a needed number of containers in parallel, waits until they are exited, and reports the status Such a running scheme allows to run more tests and total duration is equal to the duration of the longest test execution. From the technical side, the worker containers don't package the appropriate workflows scripts, they just configure them by default. This allows making script changes without rebuilding the images. Also, as usual, all workers bind the source files in the container's volume and use them for the execution.
1 parent 1a01665 commit 6f67027

File tree

6 files changed

+221
-109
lines changed

6 files changed

+221
-109
lines changed

.workflows/bats/Dockerfile

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,60 @@
11
ARG bashversion=3.2.57
2+
FROM alpine:3.12.0 as git
3+
RUN apk add --no-cache \
4+
zlib-dev \
5+
openssl-dev \
6+
curl-dev \
7+
curl \
8+
expat-dev \
9+
perl-dev \
10+
python3-dev \
11+
pcre2-dev \
12+
asciidoc \
13+
xmlto \
14+
perl-error \
15+
tcl \
16+
tk \
17+
make \
18+
gcc \
19+
g++
20+
WORKDIR /src
21+
ARG gitversion=2.26.2
22+
RUN curl --output git-${gitversion}.tar.gz \
23+
https://mirrors.edge.kernel.org/pub/software/scm/git/git-${gitversion}.tar.gz && \
24+
tar -xvzf git-${gitversion}.tar.gz
25+
RUN export TO=/git && \
26+
mkdir -p ${TO} && \
27+
cd git-${gitversion} && \
28+
make prefix=/usr DESTDIR=${TO} NO_GETTEXT=YesPlease NO_REGEX=YesPlease ICONV_OMITS_BOM=Yes && \
29+
make prefix=/usr DESTDIR=${TO} NO_GETTEXT=YesPlease NO_REGEX=YesPlease ICONV_OMITS_BOM=Yes strip && \
30+
make prefix=/usr DESTDIR=${TO} NO_GETTEXT=YesPlease NO_REGEX=YesPlease ICONV_OMITS_BOM=Yes install && \
31+
# remove files that aren't part of standard package
32+
rm /git/usr/libexec/git-core/git-cvs* && \
33+
rm /git/usr/libexec/git-core/git-daemon && \
34+
rm /git/usr/libexec/git-core/git-fast-import && \
35+
rm /git/usr/libexec/git-core/git-http-backend && \
36+
rm /git/usr/libexec/git-core/git-instaweb && \
37+
rm /git/usr/libexec/git-core/git-remote-testsvn && \
38+
rm /git/usr/libexec/git-core/git-shell && \
39+
rm /git/usr/libexec/git-core/git-svn && \
40+
rm /git/usr/libexec/git-core/*p4* && \
41+
rm /git/usr/libexec/git-core/mergetools/*p4* && \
42+
rm /git/usr/libexec/git-core/*email* && \
43+
rm /git/usr/libexec/git-core/*imap*
44+
245
FROM bash:${bashversion}
46+
ARG batsversion=v1.2.0
347
LABEL maintainer="Dmytro Serdiuk <[email protected]>" \
4-
description="The image serves the environment for the testing of Elegant Git."
5-
VOLUME /elegant-git
48+
description="The image serves the environment for the testing of Elegant Git." \
49+
bashversion=${bashversion} \
50+
gitversion=${gitversion} \
51+
batsversion=${batsversion}
652
WORKDIR /elegant-git
53+
VOLUME /elegant-git
754
ENV EG_ENABLE_TESTING true
8-
ARG gitversion=2.26.2
9-
RUN apk add --no-cache git~=${gitversion}
10-
ARG batsversion=v1.2.0
11-
RUN git clone --branch ${batsversion} --single-branch --depth 1 https://github.com/bats-core/bats-core.git; \
55+
COPY --from=git /git/usr/ /usr/
56+
RUN apk add --no-cache curl-dev && \
57+
git clone --branch ${batsversion} --single-branch --depth 1 https://github.com/bats-core/bats-core.git && \
1258
cd bats-core && ./install.sh /usr/local && cd - && rm -r bats-core
13-
COPY bats-workflows.bash /bats-workflows.bash
14-
ENTRYPOINT [ "/bats-workflows.bash" ]
59+
ENTRYPOINT [ ".workflows/bats/bats-workflows.bash" ]
1560
CMD ["help"]

.workflows/bats/bats-workflows.bash

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ MESSAGE
2525

2626
main() {
2727
case ${1} in
28-
all_tests) all_tests ;;
2928
some_tests) shift; some_tests "${@}" ;;
3029
help) usage ;;
3130
*) "${@}" ;;

.workflows/docs/Dockerfile

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
ARG pythonversion=3.8.3
2-
FROM python:${pythonversion}-alpine
1+
FROM python:3.8.3-alpine
32
LABEL maintainer="Dmytro Serdiuk <[email protected]>" \
43
description="The image serves the environment for docs development of Elegant Git."
4+
ARG bashversion=5.0.17
5+
ARG gitversion=2.26.2
6+
RUN apk add --no-cache bash=~${bashversion} git=~${gitversion}
57
VOLUME /elegant-git
68
WORKDIR /elegant-git
79
ENV EG_ENABLE_TESTING true
810
EXPOSE 80
9-
ENTRYPOINT [ "/docs-workflows.bash" ]
11+
ENTRYPOINT [ ".workflows/docs/docs-workflows.bash" ]
1012
CMD ["help"]
1113
COPY docs/requirements.txt .
12-
RUN python -m pip install --upgrade pip && \
13-
python -m pip install -r requirements.txt
14-
ARG bashversion=5.0.17
15-
RUN apk add --no-cache bash~=${bashversion}
16-
COPY .workflows/docs/docs-workflows.bash /
14+
RUN python -m pip install --no-cache-dir --upgrade pip && \
15+
python -m pip install --no-cache-dir -r requirements.txt

.workflows/docs/docs-workflows.bash

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,28 @@
22
set -e
33

44
generate() {
5-
exec python .workflows/docs/docs.py
5+
python .workflows/docs/docs.py
66
}
77

88
build() {
99
local site_directory=/tmp/elegnat-git-docs
1010
if test -z "${EG_ENABLE_TESTING}"; then
1111
site_directory=$(pwd)/elegnat-git-docs
1212
fi
13-
exec python -m mkdocs build --clean --strict --site-dir ${site_directory}
13+
python -m mkdocs build --clean --strict --site-dir ${site_directory}
1414
}
1515

1616
preview() {
1717
exec python -m mkdocs serve --dev-addr 0.0.0.0:80
1818
}
1919

20-
help() {
20+
check() {
21+
echo "Checking if there are uncommitted docs files ..."
22+
git update-index --really-refresh
23+
git diff-index --quiet HEAD docs
24+
}
25+
26+
usage() {
2127
cat <<MESSAGE
2228
usage: ${BASH_SOURCE[0]} <command>
2329
@@ -26,8 +32,17 @@ Available commands:
2632
generate generates fresh commands documentation
2733
build builds the static documentation site
2834
preview previews the documentation site
35+
check shows whether 'docs' directory is committed or not
2936
3037
MESSAGE
3138
}
3239

33-
${1}
40+
main() {
41+
case ${1} in
42+
help) usage ;;
43+
ci) generate && check ;;
44+
*) "${@}" ;;
45+
esac
46+
}
47+
48+
main "${@}"

docs/index.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ picture-in-picture" allowfullscreen></iframe></center>
2121
> _Looks interesting? Go to [getting started](getting-started.md) guide or take a look for
2222
available [commands](commands.md)._
2323

24+
Elegant Git has a rich test suit that executes on several Git and Bash versions. Please refer to
25+
the table below to see the coverage matrix.
26+
27+
`bash --version`|`git --version`|`git elegant --version`
28+
---|---|---
29+
5.0.17|2.26.2|up to the latest
30+
4.4.23|2.26.2|up to the latest
31+
3.2.57|2.26.2|up to the latest
32+
5.0.17|2.13.7|up to the latest
33+
4.4.23|2.13.7|up to the latest
34+
3.2.57|2.13.7|up to the latest
35+
2436
# Workflows
2537
While developing something, it may be required to format code prior to committing modifications or
2638
to open several URLs to report release notes after a new release. All these and similar actions,

0 commit comments

Comments
 (0)