Tools to Help Automate Your Workflows
Depending on how often you are doing something, even seconds saved each time can add up quickly.
Why do the same thing over and over, if you can get some help from a robot-assistant instead? This is an overview of useful tools you might not know yet, which can help you to automate parts of your development workflows.
I hope this will help you to focus on writing code and getting things done instead of thinking through each step a toil-y shell-incantation.
It doesn’t get easier that that. Make is my first tool of choice when it comes to automating local workflows. Instead of looking up the exact command to run your local development server, just create a Makefile, with a “run” alias. This way, you’ll be able to type “make run” - an easy to remember shortcut to get going instead of looking at the README.
Pre-commit hooks are a good way to run workflows before every commit - linters or test suite runners are a good example. They are easy to forget, and then you will probably have to context-switch once more than necessary.
Setting up pre-commit hooks can be tricky. If you want to run a well-known tool, chances are that pre-commit has a ready-made plugin you can add, and which will work for every project on every developer machine with a simple command from then on.
For slightly more complicated workflows, especially if you’re using Python, you can take a look at doit to execute any kind of task. This is my choice of tool when the workflow is slightly more advanced - mostly because I like Python and my Makefile skills are on the humble side.
A tool which checks the current (and parent) directory for a “.envrc” file, and loads environment variables from it, given that you have allowed it to do so. Direnv can help if you’re working on multiple projects. A nice alternative to handling .env files or to stuff your .profile, .bashrc (or pip post-activate files) with possibly conflicting exports.
Sick of SSH-ing into your machines, but not quite ready to reach for Ansible or go the immutable-infrastructure way? Fabric2 is a great tool to help you automate workflows on remote machines, but you can also use it for local workflows by writing Python code. Check out this article or the docs to get started.
This tool is beyond nifty. React to file modifications, by running one-off “prep” commands or restarting/sending signals to a “daemon” process. There’s so much you can do for your development workflows with this tool! Restart your development server, rebuild assets, perform dev migrations, even interact with your Docker containers. And you can limit the tasks performed only to files which were actually changed, or to directories containing those files. Check out the README in the GitHub repository for examples. Docker-compose
If you need to configure your Docker containers, or bring up more than one cooperating containers - docker-compose is the tool you should use. The Docker CLI is great for learning, and for debugging tasks, but for everything else there’s no reason to look up or type in 100-character CLI commands.
Alternatively, if you’re looking for a daemonless and rootless way to run OCI Containers, check out podman and podman-compose.
I hope this list will help you to choose a well-suited tool to automate some elaborate and tedious parts of your workflows.
The list is biased towards the Python ecosystem, as that’s my language of choice. Probably, there are alternatives in your favourite language, but I hope it will inspire you to look for them.
If it helps you to eliminate a bothersome boilerplate task, I’m always happy to hear about success stories - drop me a message either via mail or over on Twitter!