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

Continuous Integration: Catch Bugs and Improve Team Communication

Continuous Integration: Catch Bugs and Improve Team Communication

GitHub project for demo: https://github.com/jordanjoz1/andevcon-demo

A good build process makes everyone’s lives easier. Running tests and static code analysis gives developers confidence and peace of mind. Product managers and QA benefit from automatically shared builds that clearly indicate changes. In this session, we will expand on the concept of a CI process and talk about some ways to automate everyday tasks, including pull request feedback, testing, and distribution.

We will discuss several opportunities for automated improvement. First, sharing style formatting to improve readability and reduce merge conflicts. Second, showing results of automated testing and static code analysis in pull requests to improve code quality and reduce bugs. Last, how to automatically distribute builds and update tickets to improve intra-team communication. Whether you choose some of these tools or all of them, they will make your life easier. Our focus will be on a comprehensive solution using Jenkins, SonarQube, Fabric, JIRA and Github, but we will also compare alternative services.

Want to get started with these processes now? You will have details for installation instructions, plugins, and configurations. By the end of this talk, you will understand how to setup and use all these services so that they do the heavy lifting in your development process.

Jordan Jozwiak

December 01, 2016
Tweet

More Decks by Jordan Jozwiak

Other Decks in Programming

Transcript

  1. Continuous Integration:
    Catch Bugs and Improve Team Communication
    Jordan Jozwiak, eero

    View full-size slide

  2. First, let’s agree on some values

    View full-size slide

  3. It’s better to
    automate processes
    than do them manually

    View full-size slide

  4. It’s better to
    have consistent code style
    than mix multiple styles

    View full-size slide

  5. It’s better to
    catch bugs during development
    than during the QA process

    View full-size slide

  6. It’s better to
    automate routine communication
    than rely on individuals

    View full-size slide

  7. Is this really Continuous Integration?
    What can I do?
    When can I do these things?
    How can I do these things?
    Guiding Questions

    View full-size slide

  8. This isn’t really Continuous Integration

    View full-size slide

  9. This isn’t really Continuous Integration
    continuous integration (CI)
    is the practice of merging all developer working copies to a shared
    mainline several times a day.

    View full-size slide

  10. This isn’t really Continuous Integration
    continuous integration (CI)
    is the practice of merging all developer working copies to a shared
    mainline several times a day.
    build automation
    is the process of automating the creation of a software build and the
    associated processes including: compiling computer source code
    into binary code … and running automated tests.

    View full-size slide

  11. This isn’t really Continuous Integration
    I’m talking about a larger scope and a longer timeframe

    View full-size slide

  12. Is this really Continuous Integration?
    What checks can I do?
    When can I do these checks?
    How can I do these checks?

    View full-size slide

  13. Is this really Continuous Integration?
    What checks can I do? (Scope)
    When can I do these checks?
    How can I do these checks?

    View full-size slide

  14. Is this really Continuous Integration?
    What checks can I do? (Scope)
    When can I do these checks? (Timeframe)
    How can I do these checks?

    View full-size slide

  15. Checks you can do (Scope)

    View full-size slide

  16. Checks you can do (Scope)
    • Tests

    View full-size slide

  17. Checks you can do (Scope)
    • Tests
    • Unit tests

    View full-size slide

  18. Checks you can do (Scope)
    • Tests
    • Unit tests
    • Instrumentation tests

    View full-size slide

  19. Checks you can do (Scope)
    • Tests
    • Unit tests
    • Instrumentation tests
    • Test coverage

    View full-size slide

  20. Checks you can do (Scope)
    • Tests
    • Unit tests
    • Instrumentation tests
    • Test coverage
    • Style checks

    View full-size slide

  21. Checks you can do (Scope)
    • Tests
    • Unit tests
    • Instrumentation tests
    • Test coverage
    • Style checks
    • Code arrangement

    View full-size slide

  22. Checks you can do (Scope)
    • Tests
    • Unit tests
    • Instrumentation tests
    • Test coverage
    • Style checks
    • Code arrangement
    • Code formatting

    View full-size slide

  23. Checks you can do (Scope)
    • Tests
    • Unit tests
    • Instrumentation tests
    • Test coverage
    • Style checks
    • Code arrangement
    • Code formatting
    • Method count

    View full-size slide

  24. Checks you can do (Scope)
    • Tests
    • Unit tests
    • Instrumentation tests
    • Test coverage
    • Style checks
    • Code arrangement
    • Code formatting
    • Method count
    • APK size

    View full-size slide

  25. Checks you can do (Scope)
    • Tests
    • Unit tests
    • Instrumentation tests
    • Test coverage
    • Style checks
    • Code arrangement
    • Code formatting
    • Method count
    • APK size
    • Static code analysis

    View full-size slide

  26. Checks you can do (Scope)
    • Tests
    • Unit tests
    • Instrumentation tests
    • Test coverage
    • Style checks
    • Code arrangement
    • Code formatting
    • Method count
    • APK size
    • Static code analysis
    • Code duplication

    View full-size slide

  27. Checks you can do (Scope)
    • Tests
    • Unit tests
    • Instrumentation tests
    • Test coverage
    • Style checks
    • Code arrangement
    • Code formatting
    • Method count
    • APK size
    • Static code analysis
    • Code duplication
    • Code complexity

    View full-size slide

  28. Checks you can do (Scope)
    • Tests
    • Unit tests
    • Instrumentation tests
    • Test coverage
    • Style checks
    • Code arrangement
    • Code formatting
    • Method count
    • APK size
    • Static code analysis
    • Code duplication
    • Code complexity
    • Profiling

    View full-size slide

  29. Checks you can do (Scope)
    • Tests
    • Unit tests
    • Instrumentation tests
    • Test coverage
    • Style checks
    • Code arrangement
    • Code formatting
    • Method count
    • APK size
    • Static code analysis
    • Code duplication
    • Code complexity
    • Profiling
    • Memory profiling

    View full-size slide

  30. Checks you can do (Scope)
    • Tests
    • Unit tests
    • Instrumentation tests
    • Test coverage
    • Style checks
    • Code arrangement
    • Code formatting
    • Method count
    • APK size
    • Static code analysis
    • Code duplication
    • Code complexity
    • Profiling
    • Memory profiling
    • Start-up time profiling

    View full-size slide

  31. Checks you can do (Scope)
    • Tests
    • Unit tests
    • Instrumentation tests
    • Test coverage
    • Style checks
    • Code arrangement
    • Code formatting
    • Method count
    • APK size
    • Static code analysis
    • Code duplication
    • Code complexity
    • Profiling
    • Memory profiling
    • Start-up time profiling
    • Frame rate profiling

    View full-size slide

  32. Checks you can do (Scope)
    • Tests
    • Unit tests
    • Instrumentation tests
    • Test coverage
    • Style checks
    • Code arrangement
    • Code formatting
    • Method count
    • APK size
    • Static code analysis
    • Code duplication
    • Code complexity
    • Profiling
    • Memory profiling
    • Start-up time profiling
    • Frame rate profiling
    • And more…

    View full-size slide

  33. When can I do these checks?

    View full-size slide

  34. Normal timeline

    View full-size slide

  35. Normal timeline

    View full-size slide

  36. Save Code
    Normal timeline

    View full-size slide

  37. Save Code
    Normal timeline
    Commit
    Locally

    View full-size slide

  38. Save Code
    Normal timeline
    Commit
    Locally
    Open
    Pull Request

    View full-size slide

  39. Save Code
    Normal timeline
    Commit
    Locally
    Open
    Pull Request Merge code

    View full-size slide

  40. Save Code
    Normal timeline
    Commit
    Locally
    Open
    Pull Request Merge code QA

    View full-size slide

  41. Save Code
    Normal timeline
    Commit
    Locally
    Open
    Pull Request Merge code QA Release

    View full-size slide

  42. Work that you do
    Work done automatically
    Save Code
    Commit
    Locally
    Open
    Pull Request Merge code QA Release

    View full-size slide

  43. Work that you do
    Work done automatically
    Save Code
    Commit
    Locally
    Open
    Pull Request Merge code QA Release
    Local
    Development
    Code
    Review
    After
    Merge

    View full-size slide

  44. Assessing cost and value of running a check
    Quality Bar
    Time

    View full-size slide

  45. Normal timeline
    Automatically hook into events
    Editor
    hooks
    git
    hooks
    Save Code
    Commit
    Locally
    Open
    Pull Request Merge code QA Release
    GitHub PR
    hooks
    GitHub
    hooks

    View full-size slide

  46. Normal timeline
    Available time and expected quality
    little time
    low quality
    little time
    med quality
    Save Code
    Commit
    Locally
    Open
    Pull Request Merge code QA Release
    med time
    high quality
    more time
    highest quality

    View full-size slide

  47. Normal timeline
    For example… catch bugs early
    Reformat
    & rearrange
    code
    FindBugs
    PMD
    Lint
    Save Code
    Commit
    Locally
    Open
    Pull Request Merge code QA Release
    Tests &
    Static Code
    Analysis
    Automation
    Tests

    View full-size slide

  48. Normal timeline
    and improve communication!
    Save Code
    Commit
    Locally
    Open
    Pull Request Merge code QA Release
    Update
    ticket
    statuses
    Generate
    release
    notes

    View full-size slide

  49. This isn’t really Continuous Integration

    View full-size slide

  50. Build, Test, Analysis,
    and Communication Process
    spanning entire development cycle

    View full-size slide

  51. Totally Awesome Development Process™

    View full-size slide

  52. How can I do these checks?

    View full-size slide

  53. Build
    • Jenkins
    • Travis
    • Circle CI
    • TeamCity

    View full-size slide

  54. Build
    • Jenkins
    • Travis
    • Circle CI
    • TeamCity
    VCS
    • GitHub
    • BitBucket

    View full-size slide

  55. Static Code
    Analysis
    • CheckStyle
    • Findbugs
    • PMD
    • SonarQube
    Build
    • Jenkins
    • Travis
    • Circle CI
    • TeamCity
    VCS
    • GitHub
    • BitBucket

    View full-size slide

  56. Static Code
    Analysis
    • CheckStyle
    • Findbugs
    • PMD
    • SonarQube
    Unit Testing
    • JUnit
    • Robolectric
    Build
    • Jenkins
    • Travis
    • Circle CI
    • TeamCity
    VCS
    • GitHub
    • BitBucket

    View full-size slide

  57. Static Code
    Analysis
    • CheckStyle
    • Findbugs
    • PMD
    • SonarQube
    Unit Testing
    • JUnit
    • Robolectric
    Build
    • Jenkins
    • Travis
    • Circle CI
    • TeamCity
    VCS
    • GitHub
    • BitBucket
    Instrumentation
    Testing
    • Espresso
    • Spoon

    View full-size slide

  58. Static Code
    Analysis
    • CheckStyle
    • Findbugs
    • PMD
    • SonarQube
    Unit Testing
    • JUnit
    • Robolectric
    Build
    • Jenkins
    • Travis
    • Circle CI
    • TeamCity
    VCS
    • GitHub
    • BitBucket
    Instrumentation
    Testing
    • Espresso
    • Spoon
    Crash
    Reporting
    • Crashlytics
    • Firebase

    View full-size slide

  59. Static Code
    Analysis
    • CheckStyle
    • Findbugs
    • PMD
    • SonarQube
    Unit Testing
    • JUnit
    • Robolectric
    Build
    • Jenkins
    • Travis
    • Circle CI
    • TeamCity
    VCS
    • GitHub
    • BitBucket
    Instrumentation
    Testing
    • Espresso
    • Spoon
    Crash
    Reporting
    • Crashlytics
    • Firebase
    Distribution
    • Fabric

    View full-size slide

  60. Static Code
    Analysis
    • CheckStyle
    • Findbugs
    • PMD
    • SonarQube
    Unit Testing
    • JUnit
    • Robolectric
    Build
    • Jenkins
    • Travis
    • Circle CI
    • TeamCity
    VCS
    • GitHub
    • BitBucket
    Instrumentation
    Testing
    • Espresso
    • Spoon
    Crash
    Reporting
    • Crashlytics
    • Firebase
    Distribution
    • Fabric
    Multi-
    functional
    • BuddyBuild

    View full-size slide

  61. Static Code
    Analysis
    • CheckStyle
    • Findbugs
    • PMD
    • SonarQube
    Unit Testing
    • JUnit
    • Robolectric
    Build
    • Jenkins
    • Travis
    • Circle CI
    • TeamCity
    VCS
    • GitHub
    • BitBucket
    Instrumentation
    Testing
    • Espresso
    • Spoon
    Crash
    Reporting
    • Crashlytics
    • Firebase
    Distribution
    • Fabric
    Multi-
    functional
    • BuddyBuild
    and
    so
    many
    more

    View full-size slide

  62. A Totally Awesome Development Process™ is

    View full-size slide

  63. A Totally Awesome Development Process™ is
    Reliable
    24/7

    View full-size slide

  64. A Totally Awesome Development Process™ is
    Reliable Comprehensive
    24/7

    View full-size slide

  65. A Totally Awesome Development Process™ is
    Reliable Comprehensive Informative
    24/7

    View full-size slide

  66. How we do things at eero
    a mostly free option
    using popular services

    View full-size slide

  67. Services used at eero

    View full-size slide

  68. Services used at eero
    GitHub
    Industry standard
    Free public repos

    View full-size slide

  69. Services used at eero
    GitHub
    Industry standard
    Free public repos
    SonarQube
    Duplication, coverage,
    complexity, history,
    assignment, etc.

    View full-size slide

  70. Services used at eero
    GitHub
    Industry standard
    Free public repos
    Jenkins
    Free, customizable,
    large community
    SonarQube
    Duplication, coverage,
    complexity, history,
    assignment, etc.

    View full-size slide

  71. Services used at eero
    GitHub
    Industry standard
    Free public repos
    Jenkins
    Free, customizable,
    large community
    SonarQube
    Duplication, coverage,
    complexity, history,
    assignment, etc.
    Fabric
    Convenient, includes
    release notes

    View full-size slide

  72. Services used at eero
    GitHub
    Industry standard
    Free public repos
    Jenkins
    Free, customizable,
    large community
    JIRA
    Specialized for bug and task tracking
    Has API for updating ticket status
    SonarQube
    Duplication, coverage,
    complexity, history,
    assignment, etc.
    Fabric
    Convenient, includes
    release notes

    View full-size slide

  73. Let’s dive into an example!
    inspired by the eero timeline

    View full-size slide

  74. Save Code
    Commit
    Locally
    Open
    Pull Request Merge code QA Release
    Local
    Development
    Code
    Review
    After
    Merge

    View full-size slide

  75. Save Code
    Commit
    Locally
    Open
    Pull Request Merge code QA Release
    Local
    Development
    Code
    Review
    After
    Merge

    View full-size slide

  76. Save Code
    Commit
    Locally
    Local
    Development
    Services

    View full-size slide

  77. Save Code
    Commit
    Locally
    Local
    Development
    Services
    Android Studio

    View full-size slide

  78. Save Code
    Commit
    Locally
    Local
    Development
    Services
    Android Studio
    git

    View full-size slide

  79. Save Code
    Commit
    Locally
    Local
    Development
    Services
    Android Studio
    git
    SonarQube

    View full-size slide

  80. Android Studio
    • Helpful Plugins
    • SonarLint
    • FindBugs, PMD, Checkstyle
    • Share settings for formatting and arrangement
    • Shortcut for optimizing imports, formatting, and arranging

    View full-size slide

  81. git
    • git hooks

    View full-size slide

  82. SonarQube
    • Static code analysis at its best. An ultimate combination of PMD,
    FindBugs, Checkstyle, Android Lint, and more!
    • Tech debt, complexity analysis, code duplication, test coverage
    • History to track project quality
    • Caveat: the Android Lint plugin is woefully out of date. It’s still on
    22.0 when the latest is >25

    View full-size slide

  83. SonarQube
    • Helpful plugins
    • GitHub Plugin
    • Android Lint Plugin
    • XML Plugin

    View full-size slide

  84. Save Code
    Commit
    Locally
    Local
    Development
    Demo

    View full-size slide

  85. Save Code
    Commit
    Locally
    Local
    Development

    View full-size slide

  86. Save Code
    Commit
    Locally
    Open
    Pull Request
    Local
    Development
    Code
    Review

    View full-size slide

  87. Save Code
    Commit
    Locally
    Open
    Pull Request
    Local
    Development
    Code
    Review
    Services

    View full-size slide

  88. Save Code
    Commit
    Locally
    Open
    Pull Request
    Local
    Development
    Code
    Review
    GitHub
    Services

    View full-size slide

  89. Save Code
    Commit
    Locally
    Open
    Pull Request
    Local
    Development
    Code
    Review
    GitHub
    Jenkins
    Services

    View full-size slide

  90. Save Code
    Commit
    Locally
    Open
    Pull Request
    Local
    Development
    Code
    Review
    GitHub
    Jenkins
    SonarQube
    Services

    View full-size slide

  91. GitHub
    • Show the results of external tasks on a commit or pull request

    View full-size slide

  92. Jenkins
    • Helpful plugins
    • GitHub Plugin
    • GitHub Pull Request Builder
    • JUnit Plugin
    • Gradle Plugin
    • JIRA Plugin

    View full-size slide

  93. Jenkins
    • Useful jobs
    • Pull Request Builder
    • Job that builds all changes to development branch
    • Nightly builder

    View full-size slide

  94. Jenkins
    • APK size
    • Method count

    View full-size slide

  95. SonarQube
    • Run an incremental analysis on just the changes
    • Publish results to GitHub

    View full-size slide

  96. Save Code
    Commit
    Locally
    Open
    Pull Request
    Local
    Development
    Code
    Review
    Demo

    View full-size slide

  97. The case for an all-in-one solution

    View full-size slide

  98. • No setup to build pull requests
    • No setup to run tests
    • Includes crash reporting
    • Integrate SDK so users can send screenshots of issues
    • Easily distribute builds to team
    • Publish directly to the app store

    View full-size slide

  99. Save Code
    Commit
    Locally
    Local
    Development
    Open
    Pull Request
    Code
    Review

    View full-size slide

  100. Save Code
    Commit
    Locally
    Local
    Development
    Open
    Pull Request
    Code
    Review
    Merge code QA Release
    After
    Merge

    View full-size slide

  101. Merge code QA Release
    After
    Merge

    View full-size slide

  102. Merge code QA Release
    After
    Merge
    Services

    View full-size slide

  103. Merge code QA Release
    After
    Merge
    Services

    View full-size slide

  104. Merge code QA Release
    After
    Merge
    Fabric
    Services

    View full-size slide

  105. • Integrate with Jenkins to automatically update tickets statuses

    View full-size slide

  106. Fabric
    • Distribute build to team
    • Include release notes based on the changes since the last Jenkins
    build

    View full-size slide

  107. Merge code QA Release
    After
    Merge
    Demo

    View full-size slide

  108. The reality
    all this requires work and maintenance

    View full-size slide

  109. The reality
    all this requires work and maintenance
    and that can be frustrating

    View full-size slide

  110. The struggle

    View full-size slide

  111. The struggle
    • Build server breaks

    View full-size slide

  112. The struggle
    • Build server breaks
    • Wait time for tests and checks to complete

    View full-size slide

  113. The struggle
    • Build server breaks
    • Wait time for tests and checks to complete
    • Pre-commit checks are annoying

    View full-size slide

  114. The struggle
    • Build server breaks
    • Wait time for tests and checks to complete
    • Pre-commit checks are annoying
    • False-positives in checks

    View full-size slide

  115. The struggle
    • Build server breaks
    • Wait time for tests and checks to complete
    • Pre-commit checks are annoying
    • False-positives in checks
    • Rules don’t always apply (e.g. parentheses for improved readability)

    View full-size slide

  116. it’s easy to get started
    but configuring everything to your needs is harder

    View full-size slide

  117. enforcing rules improves quality
    but it requires maturity and discipline

    View full-size slide

  118. the journey is hard
    but it’s worth it when you get there

    View full-size slide

  119. I asked some other companies what they do

    View full-size slide

  120. Do what’s best for your team

    View full-size slide

  121. Do what’s best for your team
    by catching bugs early and improving communication

    View full-size slide