Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Automate workflow with Ruby

Automate workflow with Ruby

a talk at Jakarta.rb
lightning talk at Geekcamp.id 2017

Didik Wicaksono

December 02, 2016
Tweet

More Decks by Didik Wicaksono

Other Decks in Programming

Transcript

  1. Automate Workflow
    with Ruby .
    Didik Wicaksono

    View Slide

  2. •github: @firewalker06
    •twitter: @did1k

    View Slide

  3. I work at

    View Slide

  4. View Slide

  5. View Slide

  6. View Slide

  7. We inspire people through Cooking

    View Slide

  8. I’m with
    ID-Ruby Community
    •We will have our first Ruby
    Conference in Indonesia on Oct
    6th-7th (ruby.id/cfp)
    •Please support our association:
    PERKODI (ruby.id/perkumpulan)

    View Slide

  9. !" > 50 engineers, serving 66
    countries with 17 languages

    View Slide

  10. ⛏ Workflow in a glance
    •Starts with a Hypothesis
    •Organize Task
    •Development & Code Review
    •Deploy & Announce Release

    View Slide

  11. https://sourcediving.com/hypothesis-driven-
    development-6b3c7a4a53fc

    View Slide

  12. I’m sure you already
    familiar with these services

    View Slide

  13. Workflow breakdown
    •discuss hypothesis
    •create a card
    •assign card
    •create a branch
    •do magic
    •push a branch
    •create a pull request
    •code review
    •merge pull request
    •deploy code
    •announce release in
    Slack
    •mark card /
    checklist as
    completed

    View Slide

  14. Looks repetitive
    •On Slack
    •discuss hypothesis
    •On Trello
    •create a card
    •assign card
    •On local
    •create a branch
    •do magic
    •push a branch
    •On Github
    • create a pull request
    • code review
    • merge pull request
    • Back to local again
    • deploy code
    • Back to Slack again
    • announce release in
    Slack
    • Finally on Trello
    • mark card / checklist as
    completed

    View Slide

  15. If its repetitive, we
    can automate!

    View Slide

  16. Looks good?
    •On Slack
    •discuss hypothesis
    •On local
    •create a card
    •assign card
    •create a branch
    •do magic
    •push a branch
    •create a pull request
    •code review
    •merge pull request
    •mark card / checklist
    as completed
    •On Slack
    • deploy code
    •announce release in
    Slack

    View Slide

  17. Lets begin!

    View Slide

  18. trello-flow

    View Slide

  19. trello-flow
    We uses a lot of Trello boards

    View Slide

  20. trello-flow
    •github.com/balvig/trello_flow
    •available commands:
    ‣ git open 

    # Open relevant card/all users card in browser
    ‣ git start

    git start 

    # choose card, assigns self & creates branch
    ‣ git finish 

    # checks off task, opens PR
    ‣ git cleanup 

    # cleans up merged card branches

    View Slide

  21. Demo

    View Slide

  22. Some element of code
    reviews can be
    automated

    View Slide

  23. •github.com/bbatsov/rubocop
    •Ruby static code analyzer
    •enforce styleguide
    •run in development

    View Slide

  24. View Slide

  25. •houndci.com
    •uses rubocop to review Ruby
    •supports various languages
    including js, coffeescript and
    scss
    •integrated with Github

    View Slide

  26. View Slide

  27. CP-8 Cookpad Bot

    View Slide

  28. CP-8 Cookpad Bot
    • github.com/balvig/cp-8
    • This little fella helps simplify
    your frequent labelling in Github
    • Deployable to Heroku

    View Slide

  29. CP-8 Cookpad Bot
    Opening a PR with "[WIP]" in the title adds WIP label

    View Slide

  30. CP-8 Cookpad Bot
    Approving changes adds Reviewed label

    View Slide

  31. CP-8 Cookpad Bot
    Tells you when a PR has no updates

    View Slide

  32. CP-8 Cookpad Bot
    Attach and moves Trello cards around

    View Slide

  33. capistrano-fiesta

    View Slide

  34. capistrano-fiesta
    •github.com/balvig/capistrano-
    fiesta
    •integrates Github pull requests
    and Slack
    •compiles list of github PR since
    last release

    View Slide

  35. capistrano-fiesta
    reads “Release note” in PR description

    View Slide

  36. capistrano-fiesta
    Sends slack
    announcement

    View Slide

  37. capistrano-fiesta
    compiles list of PR in github.com/[repo]/releases

    View Slide

  38. Ruby + Bot = Ruboty

    View Slide

  39. ruboty
    •github.com/r7kamura/ruboty
    •its a bot, built in Ruby
    •deployable to Heroku
    •supports various chat services
    and some DBs

    View Slide

  40. ruboty

    View Slide

  41. Everyday on Cookpad
    •Trello-flow
    •Rubocop and Hound
    •CP-8 Bot
    •Capistrano-fiesta
    •Ruboty

    View Slide

  42. Everyday on Cookpad
    •Trello-flow
    •Rubocop and Hound
    •CP-8 Bot
    •Capistrano-fiesta
    •Ruboty

    View Slide