# Automate your work -- ## What is automation ? -- ![](/slide/automate-your-work/automation-definition.png) Note: - Automation is the way by which we make a machine do our work with minimal human assistance. - At the moment, machine time is cheap while human time is expensive - Human time is better spent on valuable tasks rather than mindless procedures -- > Automation is the technology by which a process or procedure is performed with minimal human assistance. Groover, Mikell. -- ## About Me * Independant scala developer * Currently work for ingenico Group * 7 developer * ~60 microservices * ~300K lines of scala code Note: - I currently work in a team of seven backend engineer managing two application representing rougthly sixteen microservices. - We cannot really afford to allocate one of us (~15%) of our workforce to automation for a long amount of time - Yet we still need to automate - So the question is what can we do with what we already have (sbt) -- ![](/slide/automate-your-work/confession.jpg) -- ## Demo #### Let's pray to the demo god https://gitlab.com/Tomahna/automate-your-work -- ## What can we automate ? ### Or what does "our work" means ? Note: - Before we try to automate anything, we should have a clear idea on what is the process we are automating - What is our job as software developper ? What does a typical software developper day looks like ? -- ![](/slide/automate-your-work/story-time.jpg) -- ## A (not so) long time ago, ### in a company (not so) far, far away -- ![](/slide/automate-your-work/story-intro-1.png) Note: - Bob is a software develop at coolapp.com. - Every days bob comes to the office very early in the morning (so around 11) - He then sits at his decks, find the next tasks he has to do, and starts hacking on it - Then bob process to finish his tasks, submit it to the review process and then go take a break -- ![](/slide/automate-your-work/story-test-1.png) Note: - After a while his colleague alice comes at his desk - In coolapp.com everything is done through human process and alice has been reviewing his ticket - However tests do not works on alices pc -- ![](/slide/automate-your-work/story-test-2.png) -- ![](/slide/automate-your-work/story-test-3.png) Note: - Bob answers, well works on my machine -- ## Testing - sbt - sbt-docker-compose - docker-it-scala -- ![](/slide/automate-your-work/story-intro-1.png) Note: - After having dealt with Alice's problem, Bob starts to review a ticket himself -- ![](/slide/automate-your-work/story-format-1.png) Note: - When he looked at what has changed everything get highlighted -- ## Code Formatting #### Scalafmt Note: - Formatting is often a controversial topic. - My two cents on the matter is that it is an investment that makes code more readable in the long term. - If some code needs to be very specifically formatted to be understandable, the problem is often not the formatting. - I personally dislike git-hooked based solution, they are often clunky. I don't care how people do formatting, as long as it is formatted before getting in any shared branch. -- #### Meanwhile in production ![](/slide/automate-your-work/story-linting-1.2.png) -- ![](/slide/automate-your-work/story-linting-1.png) Note: - After reviewing the PR, Bob takes a break - When he comes back, the whole ops squad is waiting nervously at his desk because production is on fire ! -- ![](/slide/automate-your-work/story-linting-2.png) Note: - Fault is option.get -- ## Linting (lots of options) - The scala compiler itself - sbt-tpolecat - scapegoat - wartremover -- ![](/slide/automate-your-work/story-packaging-1.png) Note: - Now that the source of the bug has been fixed, bob has to package the binaries, put them on an usb key and give them to the ops team, so that they can go manually update every running server - But then Bob wonders, can we do better ? -- ### Packaging: SBT Native Packager - Universal (zip, tgz, ...) - Debian - Rpm - Docker - Windows (pour les plus téméraires) -- ## Publishing - Sonatype (via sbt-sonatype) - Nexus - S3 (via fm-sbt-s3-resolver) -- ![](/slide/automate-your-work/story-release-1.png) Note: The ops teams comes back to Bob's desk, it so happens that he has applied a fix on commit a9d6dc7b instead of 2d1c0c3c. -- ![](/slide/automate-your-work/story-release-2.png) Note: The ops teams comes back to Bob's desk, it so happens that he has applied a fix on commit a9d6dc7b instead of 2d1c0c3c. -- #### Meanwhile in production ![](/slide/automate-your-work/story-linting-1.2.png) -- ## Release - sbt-dynver Note: - A release is mostly an arbitrary point in the development process we have marked as should go in production. - We want a release to be unique and easy to find - Tags can fill this role, as long as your CI system can build on a tag push -- ## Housekeeping #### scala-steward -- ## Did the demo worked ? ![](/slide/automate-your-work/demo-work.jpg) -- ## Faster CI - Parallelize tasks - Use bloop in your CI system -- ## Conclusion - Take the time to actually gain time - Automate everything you can in any way you can -- ## Thank you #### Do you have any questions ? ##### Kevin Rauscher (@tomahna) https://blog.tomahna.fr/slide/automate-your-work https://gitlab.com/Tomahna/automate-your-work/