CSC/ECE 517 Spring 2015/ch1a 6 TZ: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 232: Line 232:
Snap CI supports defferent banches and different commits of same branch to build their own pipeline and test separately.
Snap CI supports defferent banches and different commits of same branch to build their own pipeline and test separately.
   
   
<blockquote>When [http://docs.snap-ci.com/working-with-branches/automatic-branch-tracking/ Automatic Branch Tracking] and [http://docs.snap-ci.com/working-with-branches/integration-pipelines/ Integration Pipelines] is enabled, Snap will not only execute the pipeline on the branch but will also attempt to do a local merge of the branch with the main tree and execute the pipeline against the merged code. Like so:
<blockquote>When [http://docs.snap-ci.com/working-with-branches/automatic-branch-tracking/ Automatic Branch Tracking] and [http://docs.snap-ci.com/working-with-branches/integration-pipelines/ Integration Pipelines] is enabled, Snap will not only execute the pipeline on the branch but will also attempt to do a local merge of the branch with the main tree and execute the pipeline against the merged code.<ref>http://blog.snap-ci.com/blog/2014/07/22/why-snapci-and-travisci-are-not-the-same-thing/</ref> Like so:


[[File:Snap_ci_auto_branch_tracking.jpg |frame|center|Different Branches‎]]<ref>http://blog.snap-ci.com/blog/2014/07/22/why-snapci-and-travisci-are-not-the-same-thing/</ref></blockquote>
[[File:Snap_ci_auto_branch_tracking.jpg |frame|center|Different Branches‎]]</blockquote>


By the end of the pipelines you not only know that your changes pass through the pipeline but also it also will pass if you perform a merge with the main development tree. You are always aware if your changes are diverging from the main tree and in a position to take corrective action if required. Also, the whole team has visibility into the health of each branch.
By the end of the pipelines you not only know that your changes pass through the pipeline but also it also will pass if you perform a merge with the main development tree. You are always aware if your changes are diverging from the main tree and in a position to take corrective action if required. Also, the whole team has visibility into the health of each branch.

Revision as of 19:23, 7 February 2015

Snap CI

Snap CI is a hosted continuous integration and continuous delivery service.

Background

Continuous integration (CI) is the practice of merging all developer working copies with a shared mainline several times a day. It was adopted as part of extreme programming (XP). The main aim of CI is to prevent integration problems, referred to as "integration hell" in early descriptions of XP.

CI was originally intended to be used in combination with automated unit tests written through the practices of test-driven development (TDD). Initially this was conceived of as running all unit tests in the developer's local environment and verifying they all passed before committing to the mainline. This helps avoid one developer's work in progress breaking another developer's copy.<ref>http://en.wikipedia.org/wiki/Continuous_integration</ref>

You may heard TDD before, and also BDD. BDD is short for behavior-driven development. And the different between TDD and BDD is subtle. Exactly, there is almost no difference between BDD and TDD. The only one is that TDD has absolutely nothing to do with testing, in contrast, BDD focus for writing a unit test. Basically BDD is a feature driven approach to TDD.

CI servers can automatically run tests periodically or after every commit and report the results to the developers via email or other methods. Also, CI quality control has to be different from the traditional quality control processes of unit, system and system integration testing.

In addition to running the unit and integration tests, CI servers will run additional static and dynamic tests, measure and profile performance, extract and format documentation from the source code and facilitate manual QA processes. This continuous application of quality control aims to improve the quality of software, and to reduce the time taken to deliver it, by replacing the traditional practice of applying quality control after completing all development. This is very similar to the original idea of integrating more frequently to make integration easier, only applied to QA processes.<ref>http://en.wikipedia.org/wiki/Continuous_integration</ref>

Example

Getting started on Snap CI.

Sign in

To sign up with Snap, visit Snap CI and click in the Sign in with Github link at the top. When you sign in, GitHub will ask if you want to give a set of permissions to Snap.

Snap CI website


Add your repository

Once you are signed in, Snap will present a list of all the public repositories you have access to. If you are an administrator on any of those repositories, you can build that repository on Snap.

Your repository list


Config your build

When you select a repository to build on Snap, you can choose languages, databases, artifacts, secure files and dependency managers and other conventions that may indicate how your build could be set up. You can even type in some commands you want to be executed in this stage. In this guide we'll use a ruby repository, but we do support lots of other languages.

Configure your build


As most of the ruby repositories, this one uses a dependency manager tool call bundler and the rspec testing framework.

Because of that, Snap automatically added the default command for each of them: bundle install --path ${SNAP_CACHE_DIR}/.bundle and rake spec respectively.

Most of the times that would be everything needed to run your tests. However, there may be some tasks that are pre-requisites to it. In this specific build, we need to execute the command bundle exec foreman start &. It can be done simply by adding it before bundle exec rake spec.<ref>https://docs.snap-ci.com/getting-started/</ref>

Build

All that's left to do is click Build now and let Snap run our build.

Build passed


Compare Different Continuous Intergration Tools

Common Continguous Intergration Tools

There are more than 30 continuous intergration tools designed to adapt to different platforms. I select several tools which can connect Github and relate to Ruby to compare.

Comparison of Continuous Integration Tools<ref>http://en.wikipedia.org/wiki/Comparison_of_continuous_integration_software</ref>
Name Platform License Windows builders Java builders Other builders Notification IDE Integration Other Integration
CircleCI Hosted proprietary unknown unknown Ruby, Python, Node.js, PHP, Java E-mail, Campfire, HipChat, CCtray unknown Heroku, GitHub
node.ci Hosted proprietary unknown unknown Node.js E-mail unknown Amazon Web Services(AWS), GitHub, Bitbucket
Codeship Hosted proprietary no Maven Go , Java , Node.js, PHP, Python , Ruby E-mail, Flowdock, Grove, HipChat, Web no CloudControl, Engine Yard, GitHub, Heroku
Continua CI Windows proprietary Ant, Nant, FinalBuilder, MSBuild, Rake, Visual Studio, Powershell Ant Execute Program(command line) E-mail, XMPP no GitHub, Bitbucket, Codeplex, Kiln, Team Foundation Server(TFS), FogBugz, Jira, NCover, Opencover, NUnit, DUnitX, jUnit, xUnit, NuGet, 7Zip
Drone.io Hosted Apache 2.0 unknown Ant, Apache Maven|Maven 2, Gradle C, C++, Dart, Go, Node.js, Python, PHP, Ruby, Java, Groovy, Scala, Erlang E-mail unknown Heroku, Dotcloud, GitHub, Bitbucket
Koality Cross Platform, Private Cloud proprietary unknown unknown Command-Line Email, HipChat, GitHub unknown Amazon Web Services, GitHub
Semaphore Hosted proprietary unknown Apache Maven 3 Ruby , Java , Node.js, PHP, Clojure, Rake, Command Line E-mail, Campfire, HipChat, Slack, Flowdock, Webhooks, Remote API unknown GitHub, Bitbucket, Heroku, Code Climate, Cloud 66
Shippable Hosted proprietary MSBuild, NAnt Apache Ant, Apache Maven, Gradle Ruby, Python, Node.js, Java, Scala, C Sharp, PHP, Go E-mail, Campfire no GitHub, Bitbucket Heroku
Snap CI Hosted proprietary no Apache Ant, Apache Maven, Gradle, Android C, C++, Clojure, Erlang, Go, Groovy, Haskell, Java, Node.js, Perl, PHP, Python, Ruby, Scala E-Mail, Campfire, HipChat, Webhook no AWS
Solano CI Private Cloud proprietary no Apache Ant, Apache Maven, Gradle C, C++, Clojure, Go, Java, Javascript, Node.js, PHP, Python, R, Ruby, Scala, Command Line E-Mail, Campfire, HipChat, Flowdock, Slack, Webhook, CCMenu no GitHub, GitHub Enterprise, Bitbucket, Heroku, Amazon Web Services(AWS), Git, Mercurial
Strider Node.js freeBSD no no C, C++, Clojure, Erlang, Go, Groovy, Haskell, Java, Node.js, Perl, PHP, Python, Ruby, Scala E-Mail no GitHub, Bitbucket, Heroku, GitHub Enterprise, Git
Travis CI Hosted MIT no Apache Ant, Apache Maven, Gradle C, C++, Clojure, Erlang, Go, Groovy, Haskell, Java, Node.js, Perl, PHP, Python, Ruby, Scala E-Mail, Campfire, HipChat, IRC, Slack no GitHub, Heroku


Snap CI vs. Other Tools

There are so many Continuous Intergration tools. Snap CI has its own distinctive advantages.


1. Different Endpoints
Many Continuous Integration(CI) tools has this feature, that is, building and running tests when a change happens. However, Snap augments this with the idea of Deployment Pipeline and Continuous Delivery. What this means is Snap CI will do more steps than other tools.

 Continuous Integration - The automated build and test of your software when a change is made by anyone on the team, with all work happening on a shared branch.
 Continuous Delivery - The ability to keep your software easily packaged at any time. Have a rigorous set of automated tests and robust deployment scripts and tools.


2. Stages Deployment Options
Stages in Snap are a set of logically related commands. They can tell you different test information (pass or fail, the specific fail position) about your repository. What is more, you can even assign deployment of the software to testing environments and the execution of either automatic or manual tests against these deployed testing environments.

At the end of a series of stages you can deploy your software to production. However most development teams do not jump to production after all automated tests pass. Instead, they use an environment similar to production for further testing and verification; usually called Staging or UAT (short for user-acceptance-testing).An important aspect here is to control what, where and when things get released.<ref>http://blog.snap-ci.com/blog/2014/07/22/why-snapci-and-travisci-are-not-the-same-thing/</ref>

One more thing, the final “publish”stage will not be executes unless someone manually triggers it. It means any changes made into the project will not put into the production version automatically, which reduce the risks. And you can assign any stages to become manually triggered, which increase the flexbility of Snap CI.


3. Artifacts
After executing each stage, you can ask Snap CI to save some files and directories in your build as an artifact directory, such as packages, binaries. Snap CI will then save and restore the contents of this directory for each stage, which will apparantly shrink test time.


4. Different Branches and Pipelines
Snap CI supports defferent banches and different commits of same branch to build their own pipeline and test separately.

When Automatic Branch Tracking and Integration Pipelines is enabled, Snap will not only execute the pipeline on the branch but will also attempt to do a local merge of the branch with the main tree and execute the pipeline against the merged code.<ref>http://blog.snap-ci.com/blog/2014/07/22/why-snapci-and-travisci-are-not-the-same-thing/</ref> Like so:

Different Branches‎

By the end of the pipelines you not only know that your changes pass through the pipeline but also it also will pass if you perform a merge with the main development tree. You are always aware if your changes are diverging from the main tree and in a position to take corrective action if required. Also, the whole team has visibility into the health of each branch.

Narration

GitHub Integration

Snap CI integrates closely with GitHub. It in fact does not support any other version control system. GitHub is of course very popular for both open-source and closed-source software projects in many programming languages. So, Snap CI focusing its efforts on GitHub makes sense for anyone using GitHub.

Snap CI by default triggers a build whenever a push is made to the user's GitHub repository, including any Git branch. When a commit is made to a branch, it can also attempt to merge the branch with the master branch, and report the results.

Snap CI also tracks pull requests. It runs a build to show what the result would be if the pull is merged.

An email is sent to developers whenever a build fails.


Programming Language Support

Snap CI supports many programming languages and automated build systems for them. For Java, for instance, it supports Java 6, 7, and 8, and, for build tools, Maven and Ant. For Ruby, it supports bundler and rake.

It can automatically detect which build tools are used in the project, for certain build tools. For instance, if a pom.xml file is present in a Java project, Snap CI can automatically configure itself for Maven. (Apparently, the POM must be present in the top-level directory in the Git repository for Snap CI to detect it automatically. If the Java project is in a lower-level directory, it is still possible to configure Snap CI manually to support Maven.)


Pipelines

Snap CI allows a series of customized steps whenever it evaluates a build. Each step in the pipeline is at the core a series of command-line commands on the Snap CI server. There is an option to set custom environment variables. The console output is shown for each step. If a step fails, the pipeline will halt; the later steps will not execute.

Both automatic and manual steps are allowed. One would normally want to run most of the tests automatically with each commit. However, a step can also perform a release of the software, which normally one would only want to run manually, not with each Git commit. For instance, a step may deploy a web application to Heroku or Amazon Web Services. It may also upload a software release file in its final form to a web site for distribution, such as to SourceForge or the project's GitHub releases page.


Limitations

The only output from tests that Snap CI provides are output to the console or to files. There is no way to see the test results in the Snap CI GUI. Some other continuous integration tools provide web pages for viewing specific forms of tests. For instance, in Jenkins CI, one can see whether individual JUnit tests pass, or view results from static analysis tools like CheckStyle or PMD, for which Jenkins has specialized plugins.

Snap CI certainly does allow deploying a web page from a command-line command. So, it is not necessarily a great limitation that it does not have a specialized GUI for tests if one has means of generating web pages with test results. Some build tools, such as Maven, can produce web pages with test output without much effort (such as by adding a few lines in the XML configuration file).


Conclusion

References

<references/>