{"id":6376,"date":"2013-12-24T13:01:30","date_gmt":"2013-12-24T10:01:30","guid":{"rendered":"http:\/\/railsware.com\/blog\/?p=6376"},"modified":"2021-08-16T14:06:05","modified_gmt":"2021-08-16T11:06:05","slug":"capistrano-recipe-for-your-favourite-ci","status":"publish","type":"post","link":"https:\/\/railsware.com\/blog\/capistrano-recipe-for-your-favourite-ci\/","title":{"rendered":"Capistrano recipe for your favourite CI"},"content":{"rendered":"\n<p>The quality of features going to production is very important; and to guarantee the highest quality we use Continuous Integration in our everyday workflow. In one of his recent posts Sergii Boiko has described <a href=\"https:\/\/railsware.com\/blog\/capistrano-recipe-for-checking-travis-ci-build-status\/\" target=\"_blank\" rel=\"noreferrer noopener\">how to check Travis CI build status<\/a> before delivering new code to production. Afterwards, we&#8217;ve also decided to extract this recipe to <a href=\"\/\/github.com\/railsware\/capistrano-ci\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">capistrano-ci gem<\/a> and this article will explain how to setup this gem in your deployment process.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Supported continuous integration services:<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Travis CI: Open Source and Pro versions (<a href=\"https:\/\/travis-ci.org\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">https:\/\/travis-ci.org<\/a> or <a href=\"https:\/\/travis-ci.com\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">https:\/\/travis-ci.com<\/a>)<\/li><li>CircleCi: <a href=\"https:\/\/circleci.com\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">https:\/\/circleci.com<\/a><\/li><li>Semaphore: <a href=\"https:\/\/semaphoreapp.com\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">https:\/\/semaphoreapp.com<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Installation<\/h2>\n\n\n\n<p>Add the following line to your application&#8217;s Gemfile:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">gem 'capistrano-ci'\n<\/pre>\n\n\n\n<p>And then execute:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ bundle\n<\/pre>\n\n\n\n<p>Or install it yourself as:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ gem install capistrano-ci\n<\/pre>\n\n\n\n<p>Add to your Capfile:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">require 'capistrano\/ci\/recipes'\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Configuration<\/h2>\n\n\n\n<p>Variables list:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>:ci_client (required) &#8211; supports <code>travis<\/code>, <code>travis_pro<\/code>, <code>circle<\/code>, or <code>semaphore<\/code><\/li><li>:ci_repository (required) &#8211; organization or user name and repository name on github<\/li><li>:ci_access_token(required for <code>travis_pro<\/code>, <code>circle<\/code>, or <code>semaphore<\/code>) &#8211; access token specific to the service<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Open Source Projects<\/h3>\n\n\n\n<p>Setup ci_client and ci_repository variables in your deployment script:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">set(:ci_client){ \"travis\" }\nset(:ci_repository){ \"organisation-or-user\/repository-name\" }\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Pro Account of Travis-CI:<\/h3>\n\n\n\n<p>Additional to ci_client and ci_repository setup ci_access_token:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">set(:ci_client){ \"travis_pro\" }\nset(:ci_repository){ \"organisation-or-user\/repository-name\" }\nset(:ci_access_token){ \"your-pro-access-token\" }\n<\/pre>\n\n\n\n<p>To have more information about Travis-CI access token, you can follow <a href=\"https:\/\/blog.travis-ci.com\/2013-01-28-token-token-token\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">this blog post<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">CircleCi:<\/h3>\n\n\n\n<p>Setup ci_client, ci_repository and ci_access_token in your deployment script:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">set(:ci_client){ \"circle\" }\nset(:ci_repository){ \"organisation-or-user\/repository-name\" }\nset(:ci_access_token){ \"your-circle-access-token\" }\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Semaphore:<\/h3>\n\n\n\n<p>Setup ci_client, ci_repository and ci_access_token in your deployment script:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">set(:ci_client){ \"semaphore\" }\nset(:ci_repository){ \"organisation-or-user\/repository-name\" }\nset(:ci_access_token){ \"your-semaphore-access-token\" }\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Enable ci:verify task:<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">before 'deploy' do\n  ci.verify\nend\n\n# or in case of using capistrano-patch:\nbefore 'patch:create' do\n  ci.verify\nend\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<p>That&#8217;s it, and in case your CI system isn&#8217;t supported by our gem, ask us to add it or make pull-requests by yourself!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The quality of features going to production is very important; and to guarantee the highest quality we use Continuous Integration in our everyday workflow. In one of his recent posts Sergii Boiko has described how to check Travis CI build status before delivering new code to production. Afterwards, we&#8217;ve also decided to extract this recipe&#8230;<\/p>\n","protected":false},"author":44,"featured_media":6394,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[3],"tags":[],"coauthors":["Olexander Paladiy"],"class_list":["post-6376","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-development"],"acf":[],"aioseo_notices":[],"categories_data":[{"name":"Engineering","link":"https:\/\/railsware.com\/blog?category=development"}],"post_thumbnails":"https:\/\/railsware.com\/blog\/wp-content\/themes\/railsware\/vendors\/images\/article-thumbnail-default.jpg","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/posts\/6376","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/users\/44"}],"replies":[{"embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/comments?post=6376"}],"version-history":[{"count":27,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/posts\/6376\/revisions"}],"predecessor-version":[{"id":14123,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/posts\/6376\/revisions\/14123"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/media\/6394"}],"wp:attachment":[{"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/media?parent=6376"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/categories?post=6376"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/tags?post=6376"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/coauthors?post=6376"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}