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

Automate the Small Things - Chicago Roboto '19

Automate the Small Things - Chicago Roboto '19

Mobile moves fast, and so do you. To meet your deadlines, you want to build the right thing, at the right time; every time.

Your continuous integration pipeline allows you to do this, but can it do more?

- How can you enforce coding formatting, styling conventions, and best practices?
- Do you build everything on every commit? Do you have a daily build or customize your build per branch?
- What do you record and analyze? Are your tests passing? Is your apk getting too large?
- How do you distribute your apk for testing and release?

In this talk, you'll what tools are available at every step of the continuous integration pipeline; allowing you to automate as much as possible and dedicate your time to what matters most.

Nate Ebel

April 26, 2019
Tweet

More Decks by Nate Ebel

Other Decks in Programming

Transcript

  1. @n8ebel
    Automate the Small Things
    1

    View full-size slide

  2. @n8ebel
    Why Automate?
    2

    View full-size slide

  3. @n8ebel 3
    Consistently build the right thing
    at the right time
    Why Automate?

    View full-size slide

  4. @n8ebel 4
    Save time and energy for the real
    challenges
    Why Automate?

    View full-size slide

  5. @n8ebel 5
    Make projects more
    approachable
    Why Automate?

    View full-size slide

  6. @n8ebel
    What to Automate?
    6

    View full-size slide

  7. @n8ebel 7
    All The Things!

    View full-size slide

  8. @n8ebel 8
    QUALITY REVIEW DEPLOY
    BUILD

    View full-size slide

  9. @n8ebel
    Automated Build
    9

    View full-size slide

  10. @n8ebel 10
    BUILD
    BUILD
    Assemble
    Test
    Quality
    Deploy
    Educate

    View full-size slide

  11. @n8ebel 11
    CONFIG
    BUILD
    ASSEMBLE
    TEST
    ETC

    View full-size slide

  12. @n8ebel 12
    CircleCI Bitrise GCB Codemagic

    View full-size slide

  13. @n8ebel 13
    CircleCI

    View full-size slide

  14. @n8ebel 14
    CircleCI

    View full-size slide

  15. @n8ebel 15
    CircleCI
    Add build config: .circleci/config.yml

    View full-size slide

  16. @n8ebel 16
    CircleCI

    View full-size slide

  17. @n8ebel 17
    CircleCI

    View full-size slide

  18. @n8ebel 18
    CircleCI

    View full-size slide

  19. @n8ebel 19
    CircleCI
    GitHub -> Settings -> Branches -> Branch Protection Rules -> AddRule

    View full-size slide

  20. @n8ebel 20
    CircleCI

    View full-size slide

  21. @n8ebel 21
    We Now Have An
    Automated Build

    View full-size slide

  22. @n8ebel
    Code Quality
    22

    View full-size slide

  23. @n8ebel 23
    ANDROID LINT
    CODE FORMATTING
    CODE SMELLS
    TESTS

    View full-size slide

  24. @n8ebel
    Enforcing Code Quality
    With Your Automated
    Build
    24

    View full-size slide

  25. @n8ebel 25
    BUILD
    CODE
    FORMATTING

    View full-size slide

  26. @n8ebel 26
    BUILD
    CODE
    FORMATTING

    View full-size slide

  27. @n8ebel 27
    BUILD
    CODE
    FORMATTING

    View full-size slide

  28. @n8ebel
    What’s The Problem
    Here?
    28

    View full-size slide

  29. @n8ebel
    Locally Enforce Code
    Quality
    29

    View full-size slide

  30. @n8ebel 30
    CODE FORMATTING

    View full-size slide

  31. @n8ebel 31
    “Git hooks are scripts that Git executes before or
    after events such as: commit, push, and receive.”
    CODE FORMATTING
    https://githooks.com/

    View full-size slide

  32. @n8ebel 32
    CODE FORMATTING
    https://githooks.com/
    PRE-PUSH CHECK FORMATTING

    View full-size slide

  33. @n8ebel 33
    CODE FORMATTING
    https://proandroiddev.com/ooga-chaka-git-hooks-to-enforce-code-quali
    ty-11ce8d0d23cb

    View full-size slide

  34. @n8ebel 34
    CODE FORMATTING
    .git/hooks/pre-push

    View full-size slide

  35. @n8ebel 35
    CODE FORMATTING
    /scripts/git-hooks/pre-push.sh

    View full-size slide

  36. @n8ebel 36
    CODE FORMATTING

    View full-size slide

  37. @n8ebel 37
    Now We Can Prevent Pushes That Will
    Fail, And Share With The Team
    CODE FORMATTING

    View full-size slide

  38. @n8ebel
    Code Review
    38

    View full-size slide

  39. @n8ebel 39
    Validate Changes Discuss Approaches Learn

    View full-size slide

  40. @n8ebel
    PR Templates
    40

    View full-size slide

  41. @n8ebel
    Want To Avoid
    41

    View full-size slide

  42. @n8ebel
    Favor More Detail
    42

    View full-size slide

  43. @n8ebel
    .github/pull_request_template.md
    43
    ● Link to issue
    ● Describe changes
    ● Additional context
    ● Checklists
    ● Screenshots

    View full-size slide

  44. @n8ebel
    PR sections pre-populated
    44

    View full-size slide

  45. @n8ebel
    Bonus Tip
    45
    Close issues via keyword
    ● ‘Closes’
    ● ‘Fixes’
    ● ‘Resolves’
    ● etc...

    View full-size slide

  46. @n8ebel
    Superpowered PRs With
    Danger
    46

    View full-size slide

  47. @n8ebel
    “Danger runs during your CI process, and gives
    teams the chance to automate common code
    review chores.”
    47

    View full-size slide

  48. @n8ebel 48
    DANGER
    CHECK APK
    SIZE
    DEPENDENCY
    UPDATES
    INLINE LINT
    COMMENTS
    INFORMATIONAL
    MESSAGES
    ETC...

    View full-size slide

  49. @n8ebel
    ● Need a Gemfile
    ● Add `gem ‘danger’`
    ● `bundle install`
    ● `bundle exec danger init`
    49

    View full-size slide

  50. @n8ebel 57
    Bonus Tip

    View full-size slide

  51. @n8ebel
    And more…
    ● Android Lint
    ● String translations
    ● Change in APK size
    ● Test coverage
    ● etc...
    58

    View full-size slide

  52. @n8ebel
    Deployment
    59

    View full-size slide

  53. @n8ebel
    ● Daily build
    ● Scheduled build
    ● Triggered build
    ● As needed
    60

    View full-size slide

  54. @n8ebel 61
    Merge to Develop
    Distribute
    Test Build
    Merge to
    Master
    Upload to
    Google Play

    View full-size slide

  55. @n8ebel 62
    ● Beta by Crashlytics

    View full-size slide

  56. @n8ebel 64
    ● Gradle Play Publisher

    View full-size slide

  57. @n8ebel 66
    QUALITY REVIEW DEPLOY
    BUILD

    View full-size slide

  58. @n8ebel 67
    Losing time, energy, or joy
    because of some task? … try
    automating it

    View full-size slide

  59. @n8ebel
    https://github.com/n8ebel/ChicagoRoboto19
    68

    View full-size slide

  60. @n8ebel
    ● https://proandroiddev.com/ooga-chaka-git-hooks-to-enforce-code-quality-11ce8d0d23cb
    ● https://githooks.com/
    ● https://circleci.com/
    ● https://help.github.com/en/articles/creating-a-pull-request-template-for-your-repository
    ● https://help.github.com/en/articles/closing-issues-using-keywords
    ● https://danger.systems/ruby/
    ● https://danger.systems/guides/getting_started.html#including-danger
    ● https://blog.bitrise.io/automating-code-review-tasks-for-multi-module-android-projects
    ● https://github.com/Triple-T/gradle-play-publisher
    ● https://try.crashlytics.com/beta/
    ● https://github.com/noboru-i/danger-checkstyle_format
    69

    View full-size slide

  61. @n8ebel
    Thank You
    70

    View full-size slide

  62. @n8ebel
    @n8ebel
    71

    View full-size slide