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. Is this really Continuous Integration? What can I do? When

    can I do these things? How can I do these things? Guiding Questions
  2. 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.
  3. 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.
  4. Is this really Continuous Integration? What checks can I do?

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

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

    (Scope) When can I do these checks? (Timeframe) How can I do these checks?
  7. Checks you can do (Scope) • Tests • Unit tests

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

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

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

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

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

    • Instrumentation tests • Test coverage • Style checks • Code arrangement • Code formatting • Method count • APK size
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  19. 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
  20. 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…
  21. Work that you do Work done automatically Save Code Commit

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

    Locally Open Pull Request Merge code QA Release Local Development Code Review After Merge
  23. 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
  24. 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
  25. 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
  26. Normal timeline and improve communication! Save Code Commit Locally Open

    Pull Request Merge code QA Release Update ticket statuses Generate release notes
  27. Static Code Analysis • CheckStyle • Findbugs • PMD •

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

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

    SonarQube Unit Testing • JUnit • Robolectric Build • Jenkins • Travis • Circle CI • TeamCity VCS • GitHub • BitBucket Instrumentation Testing • Espresso • Spoon
  30. 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
  31. 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
  32. 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
  33. 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
  34. Services used at eero GitHub Industry standard Free public repos

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

    Jenkins Free, customizable, large community SonarQube Duplication, coverage, complexity, history, assignment, etc.
  36. 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
  37. 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
  38. Save Code Commit Locally Open Pull Request Merge code QA

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

    Release Local Development Code Review After Merge
  40. Android Studio • Helpful Plugins • SonarLint • FindBugs, PMD,

    Checkstyle • Share settings for formatting and arrangement • Shortcut for optimizing imports, formatting, and arranging
  41. 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
  42. Jenkins • Helpful plugins • GitHub Plugin • GitHub Pull

    Request Builder • JUnit Plugin • Gradle Plugin • JIRA Plugin
  43. Jenkins • Useful jobs • Pull Request Builder • Job

    that builds all changes to development branch • Nightly builder
  44. • 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
  45. Fabric • Distribute build to team • Include release notes

    based on the changes since the last Jenkins build
  46. The struggle • Build server breaks • Wait time for

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

    tests and checks to complete • Pre-commit checks are annoying • False-positives in checks
  48. 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)