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 Slide

  2. @n8ebel
    Why Automate?
    2

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  6. @n8ebel
    What to Automate?
    6

    View Slide

  7. @n8ebel 7
    All The Things!

    View Slide

  8. @n8ebel 8
    QUALITY REVIEW DEPLOY
    BUILD

    View Slide

  9. @n8ebel
    Automated Build
    9

    View Slide

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

    View Slide

  11. @n8ebel 11
    CONFIG
    BUILD
    ASSEMBLE
    TEST
    ETC

    View Slide

  12. @n8ebel 12
    CircleCI Bitrise GCB Codemagic

    View Slide

  13. @n8ebel 13
    CircleCI

    View Slide

  14. @n8ebel 14
    CircleCI

    View Slide

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

    View Slide

  16. @n8ebel 16
    CircleCI

    View Slide

  17. @n8ebel 17
    CircleCI

    View Slide

  18. @n8ebel 18
    CircleCI

    View Slide

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

    View Slide

  20. @n8ebel 20
    CircleCI

    View Slide

  21. @n8ebel 21
    We Now Have An
    Automated Build

    View Slide

  22. @n8ebel
    Code Quality
    22

    View Slide

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

    View Slide

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

    View Slide

  25. @n8ebel 25
    BUILD
    CODE
    FORMATTING

    View Slide

  26. @n8ebel 26
    BUILD
    CODE
    FORMATTING

    View Slide

  27. @n8ebel 27
    BUILD
    CODE
    FORMATTING

    View Slide

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

    View Slide

  29. @n8ebel
    Locally Enforce Code
    Quality
    29

    View Slide

  30. @n8ebel 30
    CODE FORMATTING

    View 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 Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  36. @n8ebel 36
    CODE FORMATTING

    View Slide

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

    View Slide

  38. @n8ebel
    Code Review
    38

    View Slide

  39. @n8ebel 39
    Validate Changes Discuss Approaches Learn

    View Slide

  40. @n8ebel
    PR Templates
    40

    View Slide

  41. @n8ebel
    Want To Avoid
    41

    View Slide

  42. @n8ebel
    Favor More Detail
    42

    View Slide

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

    View Slide

  44. @n8ebel
    PR sections pre-populated
    44

    View Slide

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

    View Slide

  46. @n8ebel
    Superpowered PRs With
    Danger
    46

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  50. @n8ebel 50

    View Slide

  51. @n8ebel 51

    View Slide

  52. @n8ebel 52

    View Slide

  53. @n8ebel 53

    View Slide

  54. @n8ebel 54

    View Slide

  55. @n8ebel 55

    View Slide

  56. @n8ebel 56

    View Slide

  57. @n8ebel 57
    Bonus Tip

    View Slide

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

    View Slide

  59. @n8ebel
    Deployment
    59

    View Slide

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

    View Slide

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

    View Slide

  62. @n8ebel 62
    ● Beta by Crashlytics

    View Slide

  63. @n8ebel 63

    View Slide

  64. @n8ebel 64
    ● Gradle Play Publisher

    View Slide

  65. @n8ebel 65

    View Slide

  66. @n8ebel 66
    QUALITY REVIEW DEPLOY
    BUILD

    View Slide

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

    View Slide

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

    View Slide

  69. @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 Slide

  70. @n8ebel
    Thank You
    70

    View Slide

  71. @n8ebel
    @n8ebel
    71

    View Slide