-
Notifications
You must be signed in to change notification settings - Fork 36
[RFC] consolidate CI code into shell scripts #114
Description
Is your feature request related to a problem? Please describe.
All of this project's CI configuration currently lives in a YAML file, https://github.com/stitchfix/hamilton/blob/main/.circleci/config.yml.
This introduces some friction to development in the following ways:
- adding a new CI job involves adding a new block of YAML that is mostly the same as the others (see, for example, e2ad136)
- running tests locally involves copying and pasting commands from that YAML file
- duplication of code across jobs makes it a bit more difficult to understand what is different between them
Describe the solution you'd like
I'd like to propose the following refactoring of this project's CI jobs:
- put CI code into one or more shell scripts in a directory like
.ci/- using environment variables to handle the fact that some jobs are slightly different from others (e.g. the
daskjobs don't require installingray)
- using environment variables to handle the fact that some jobs are slightly different from others (e.g. the
- change
.circlci/config.yamlso that it runs those shell scripts - document in
CONTRIBUTING.mdhow to run the tests in Docker locally, with commands that can just directly be copied and run by contributors, like this:-
docker run \ --rm \ -v $(pwd):/app \ --workdir /app \ --env BUILD_TYPE="dask" \ -it circleci/python:3.7 \ bash .ci/test.sh
-
Describe alternatives you've considered
Using a Makefile instead of shell scripts could also work for this purpose, but in my experience shell scripts are understood by a broader range of people and have fewer surprises around quoting, interpolation, and exit codes.
Additional context
A similar pattern to the one I'm proposing has been very very useful for us in LightGBM.
Consider, for example, how many different job configurations the CI for that project's R package uses (https://github.com/microsoft/LightGBM/blob/3ad26a499614cf0af075ce4ea93b880bcc69b6bb/.github/workflows/r_package.yml) and how little repetition there is across jobs.
If you all are interested in trying this out, I'd be happy to propose some PRs.
Thanks for considering it!