exercism / haskell-test-runner

GNU Affero General Public License v3.0
1 stars 13 forks source link

Optimize the CI workflow by pre-building and caching the docker image #58

Closed ErikSchierboom closed 2 years ago

ErikSchierboom commented 2 years ago

Before the tests are run in docker, we pre-build the docker image using buildx and the build-push action. As the build-push action supports caching, when the docker images is built again as part of the bin/run-tests-in-docker.sh script, the cached layers are used.

This is especially useful for this test runner, as it takes quite a while to build.

ErikSchierboom commented 2 years ago

Pinging @exercism/github-actions for a review

ErikSchierboom commented 2 years ago

As a demonstration of the effectiveness of this change, the last test run (which had no dockerfile changes) was able to cache all docker layers from a previous run and thus run in slightly over a minute: https://github.com/exercism/haskell-test-runner/actions/runs/3478838208/jobs/5816670931 Previously, test runs would take over 8 minutes: https://github.com/exercism/haskell-test-runner/pull/55/checks