The previous refactor traded build step caching for smaller image size,
which in turn made fast caching of built images possible, and allowed us
to speed up CI builds. But almost any change in Dockerfile required full
rebuild of everything (vim & taskwarrior), so changes to the Dockerfile
became more painful.
This commit refactors the Dockerfile to use multi-stage builds, which
brings build caching back: vim & taskwarrior are built in separate
stages, which are cached step by step, and then the build artifacts are
copied into the main tests image and runtime dependencies are installed.
There's a catch, of course: --cache-from doesn't work with multi-stage
images unless the experimental BuildKit backend and its inline cache
export are enabled. This requires docker 19.03, which shouldn't be hard
to obtain but isn't installed by default on Travis CI.
* Switch from Fedora to Alpine. This makes it possible to have smaller
docker images (Alpine is smaller by itself; apk add --virtual makes it
feasible to correctly remove build dependencies) which will be useful
for caching the images somewhere instead of building them in CI again
and again. This is expected to cut the CI test time in half.
* Make versions of python, vim and vimwiki configurable via docker build
args to enable testing of additional environments. This makes the
build slower, but we will fix that by caching.
Unfortunate consequence of doing all the installs in one RUN step is
that docker build doesn't cache the intermediate steps and therefore
modifying the Dockerfile and testing those modifications locally is now
slower than it used to be. This can likely be improved by using
multi-stage builds (and using BuildKit and its inline cache export to
not break the caching we're about to add a few commits later).
This reverts commit b00e886142.
This fixes reporting of coverage by the few tests that run outside of
vim.
The commit that is being reverted doesn't explain why it was committed,
and the git history suggests it was reverted once and then reintroduced
later again. None of those commits explains the why. I can only guess
that the last time this was committed was an attempt to fix coverage
reporting to outside of docker, which it didn't, and additionally it
made coverage gathering less robust (see previous commit). So this is
yet another fix for the inaccurate coverage reporting.
Or maybe it was because `--cov` without `=taskwiki` an argument reports
coverage for tests instead of taskwiki code? Nevermind, I guess, now it
works well.