site/docs/continuous-integration/index.html in jekyll-docs-3.3.1 vs site/docs/continuous-integration/index.html in jekyll-docs-3.4.0

- old
+ new

@@ -2,35 +2,35 @@ <html lang="en-US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> - <meta name="generator" content="Jekyll v3.3.1"> + <meta name="generator" content="Jekyll v3.4.0"> <link type="application/atom+xml" rel="alternate" href="https://jekyllrb.com/feed.xml" title="Jekyll • Simple, blog-aware, static sites"> <link rel="alternate" type="application/atom+xml" title="Recent commits to Jekyll’s master branch" href="https://github.com/jekyll/jekyll/commits/master.atom"> <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic,900"> <link rel="stylesheet" href="/css/screen.css"> <link rel="icon" type="image/x-icon" href="/favicon.ico"> <!-- Begin Jekyll SEO tag v2.1.0 --> <title>Continuous Integration - Jekyll • Simple, blog-aware, static sites</title> <meta property="og:title" content="Continuous Integration"> -<meta name="description" content="You can easily test your website build against one or more versions of Ruby. The following guide will show you how to set up a free build environment on Travis, with GitHub integration for pull requests. Paid alternatives exist for private repositories."> -<meta property="og:description" content="You can easily test your website build against one or more versions of Ruby. The following guide will show you how to set up a free build environment on Travis, with GitHub integration for pull requests. Paid alternatives exist for private repositories."> +<meta name="description" content="Continuous Integration (CI) enables you to publish your Jekyll generated website with confidence by automating the quality assurance and deployment processes. You can quickly get started using CI with one of the providers below:"> +<meta property="og:description" content="Continuous Integration (CI) enables you to publish your Jekyll generated website with confidence by automating the quality assurance and deployment processes. You can quickly get started using CI with one of the providers below:"> <link rel="canonical" href="https://jekyllrb.com/docs/continuous-integration/"> <meta property="og:url" content="https://jekyllrb.com/docs/continuous-integration/"> <meta property="og:site_name" content="Jekyll • Simple, blog-aware, static sites"> <meta property="og:type" content="article"> -<meta property="article:published_time" content="2017-01-20T13:17:57-08:00"> +<meta property="article:published_time" content="2017-03-22T08:06:48-07:00"> <meta name="twitter:card" content="summary"> <meta name="twitter:site" content="@jekyllrb"> <meta name="google-site-verification" content="onQcXpAvtHBrUI5LlroHNE_FP0b2qvFyPq7VZw36iEY"> <script type="application/ld+json"> {"@context": "http://schema.org", "@type": "BlogPosting", "headline": "Continuous Integration", -"datePublished": "2017-01-20T13:17:57-08:00", -"description": "You can easily test your website build against one or more versions of Ruby. The following guide will show you how to set up a free build environment on Travis, with GitHub integration for pull requests. Paid alternatives exist for private repositories.", +"datePublished": "2017-03-22T08:06:48-07:00", +"description": "Continuous Integration (CI) enables you to publish your Jekyll generated website with confidence by automating the quality assurance and deployment processes. You can quickly get started using CI with one of the providers below:", "publisher": {"@type": "Organization", "logo": {"@type": "ImageObject", "url": "https://jekyllrb.com/img/logo-2x.png"}}, "url": "https://jekyllrb.com/docs/continuous-integration/"}</script> <!-- End Jekyll SEO tag --> @@ -190,10 +190,14 @@ <option value="/docs/templates/">Templates</option> + <option value="/docs/includes/">Includes</option> + + + <option value="/docs/permalinks/">Permalinks</option> <option value="/docs/pagination/">Pagination</option> @@ -281,251 +285,20 @@ <div class="unit four-fifths"> <article> <div class="improve right hide-on-mobiles"> - <a href="https://github.com/jekyll/jekyll/edit/master/docs/_docs/continuous-integration.md"><i class="fa fa-pencil"></i>  Improve this page</a> + <a href="https://github.com/jekyll/jekyll/edit/master/docs/_docs/continuous-integration/index.md"><i class="fa fa-pencil"></i>  Improve this page</a> </div> <h1>Continuous Integration</h1> - <p>You can easily test your website build against one or more versions of Ruby. -The following guide will show you how to set up a free build environment on -<a href="https://travis-ci.org/">Travis</a>, with <a href="https://github.com/">GitHub</a> integration for pull requests. Paid -alternatives exist for private repositories.</p> + <p>Continuous Integration (CI) enables you to publish your Jekyll generated website with confidence by automating the quality assurance and deployment processes. You can quickly get started using CI with one of the providers below:</p> -<h2 id="1-enabling-travis-and-github">1. Enabling Travis and GitHub</h2> +<ul> + <li><a href="travis-ci">Travis CI</a></li> + <li><a href="circleci">CircleCI</a></li> +</ul> -<p>Enabling Travis builds for your GitHub repository is pretty simple:</p> - -<ol> - <li>Go to your profile on travis-ci.org: https://travis-ci.org/profile/username</li> - <li>Find the repository for which you’re interested in enabling builds.</li> - <li>Click the slider on the right so it says “ON” and is a dark grey.</li> - <li>Optionally configure the build by clicking on the gear icon. Further -configuration happens in your <code class="highlighter-rouge">.travis.yml</code> file. More details on that -below.</li> -</ol> - -<h2 id="2-the-test-script">2. The Test Script</h2> - -<p>The simplest test script simply runs <code class="highlighter-rouge">jekyll build</code> and ensures that Jekyll -doesn’t fail to build the site. It doesn’t check the resulting site, but it -does ensure things are built properly.</p> - -<p>When testing Jekyll output, there is no better tool than <a href="https://github.com/gjtorikian/html-proofer">html-proofer</a>. -This tool checks your resulting site to ensure all links and images exist. -Utilize it either with the convenient <code class="highlighter-rouge">htmlproofer</code> command-line executable, -or write a Ruby script which utilizes the gem.</p> - -<p>Save the commands you want to run and succeed in a file: <code class="highlighter-rouge">./script/cibuild</code></p> - -<h3 id="the-html-proofer-executable">The HTML Proofer Executable</h3> - -<div class="language-sh highlighter-rouge"> -<pre class="highlight"><code><span class="c">#!/usr/bin/env bash</span> -<span class="nb">set</span> -e <span class="c"># halt script on error</span> - -bundle <span class="nb">exec </span>jekyll build -bundle <span class="nb">exec </span>htmlproofer ./_site -</code></pre> -</div> - -<p>Some options can be specified via command-line switches. Check out the -<code class="highlighter-rouge">html-proofer</code> README for more information about these switches, or run -<code class="highlighter-rouge">htmlproofer --help</code> locally.</p> - -<p>For example to avoid testing external sites, use this command:</p> - -<div class="language-sh highlighter-rouge"> -<pre class="highlight"><code><span class="gp">$ </span>bundle <span class="nb">exec </span>htmlproofer ./_site --disable-external -</code></pre> -</div> - -<h3 id="the-html-proofer-library">The HTML Proofer Library</h3> - -<p>You can also invoke <code class="highlighter-rouge">html-proofer</code> in Ruby scripts (e.g. in a Rakefile):</p> - -<div class="language-ruby highlighter-rouge"> -<pre class="highlight"><code><span class="c1">#!/usr/bin/env ruby</span> - -<span class="nb">require</span> <span class="s1">'html-proofer'</span> -<span class="no">HTMLProofer</span><span class="p">.</span><span class="nf">check_directory</span><span class="p">(</span><span class="s2">"./_site"</span><span class="p">).</span><span class="nf">run</span> -</code></pre> -</div> - -<p>Options are given as a second argument to <code class="highlighter-rouge">.new</code>, and are encoded in a -symbol-keyed Ruby Hash. For more information about the configuration options, -check out <code class="highlighter-rouge">html-proofer</code>’s README file.</p> - -<h2 id="3-configuring-your-travis-builds">3. Configuring Your Travis Builds</h2> - -<p>This file is used to configure your Travis builds. Because Jekyll is built -with Ruby and requires RubyGems to install, we use the Ruby language build -environment. Below is a sample <code class="highlighter-rouge">.travis.yml</code> file, followed by -an explanation of each line.</p> - -<p><strong>Note:</strong> You will need a Gemfile as well, <a href="https://docs.travis-ci.com/user/languages/ruby/#Dependency-Management">Travis will automatically install</a> the dependencies based on the referenced gems:</p> - -<div class="language-ruby highlighter-rouge"> -<pre class="highlight"><code><span class="n">source</span> <span class="s2">"https://rubygems.org"</span> - -<span class="n">gem</span> <span class="s2">"jekyll"</span> -<span class="n">gem</span> <span class="s2">"html-proofer"</span> -</code></pre> -</div> - -<p>Your <code class="highlighter-rouge">.travis.yml</code> file should look like this:</p> - -<div class="language-yaml highlighter-rouge"> -<pre class="highlight"><code><span class="s">language</span><span class="pi">:</span> <span class="s">ruby</span> -<span class="s">rvm</span><span class="pi">:</span> -<span class="pi">-</span> <span class="s">2.2.5</span> - -<span class="s">before_script</span><span class="pi">:</span> - <span class="pi">-</span> <span class="s">chmod +x ./script/cibuild</span> <span class="c1"># or do this locally and commit</span> - -<span class="c1"># Assume bundler is being used, therefore</span> -<span class="c1"># the `install` step will run `bundle install` by default.</span> -<span class="s">script</span><span class="pi">:</span> <span class="s">./script/cibuild</span> - -<span class="c1"># branch whitelist, only for GitHub Pages</span> -<span class="s">branches</span><span class="pi">:</span> - <span class="s">only</span><span class="pi">:</span> - <span class="pi">-</span> <span class="s">gh-pages</span> <span class="c1"># test the gh-pages branch</span> - <span class="pi">-</span> <span class="s">/pages-(.*)/</span> <span class="c1"># test every branch which starts with "pages-"</span> - -<span class="s">env</span><span class="pi">:</span> - <span class="s">global</span><span class="pi">:</span> - <span class="pi">-</span> <span class="s">NOKOGIRI_USE_SYSTEM_LIBRARIES=true</span> <span class="c1"># speeds up installation of html-proofer</span> - -<span class="s">sudo</span><span class="pi">:</span> <span class="s">false</span> <span class="c1"># route your build to the container-based infrastructure for a faster build</span> -</code></pre> -</div> - -<p>Ok, now for an explanation of each line:</p> - -<div class="language-yaml highlighter-rouge"> -<pre class="highlight"><code><span class="s">language</span><span class="pi">:</span> <span class="s">ruby</span> -</code></pre> -</div> - -<p>This line tells Travis to use a Ruby build container. It gives your script -access to Bundler, RubyGems, and a Ruby runtime.</p> - -<div class="language-yaml highlighter-rouge"> -<pre class="highlight"><code><span class="s">rvm</span><span class="pi">:</span> -<span class="pi">-</span> <span class="s">2.2.5</span> -</code></pre> -</div> - -<p>RVM is a popular Ruby Version Manager (like rbenv, chruby, etc). This -directive tells Travis the Ruby version to use when running your test -script.</p> - -<div class="language-yaml highlighter-rouge"> -<pre class="highlight"><code><span class="s">before_script</span><span class="pi">:</span> - <span class="pi">-</span> <span class="s">chmod +x ./script/cibuild</span> -</code></pre> -</div> - -<p>The build script file needs to have the <em>executable</em> attribute set or -Travis will fail with a permission denied error. You can also run this -locally and commit the permissions directly, thus rendering this step -irrelevant.</p> - -<div class="language-yaml highlighter-rouge"> -<pre class="highlight"><code><span class="s">script</span><span class="pi">:</span> <span class="s">./script/cibuild</span> -</code></pre> -</div> - -<p>Travis allows you to run any arbitrary shell script to test your site. One -convention is to put all scripts for your project in the <code class="highlighter-rouge">script</code> -directory, and to call your test script <code class="highlighter-rouge">cibuild</code>. This line is completely -customizable. If your script won’t change much, you can write your test -incantation here directly:</p> - -<div class="language-yaml highlighter-rouge"> -<pre class="highlight"><code><span class="s">install</span><span class="pi">:</span> <span class="s">gem install jekyll html-proofer</span> -<span class="s">script</span><span class="pi">:</span> <span class="s">jekyll build &amp;&amp; htmlproofer ./_site</span> -</code></pre> -</div> - -<p>The <code class="highlighter-rouge">script</code> directive can be absolutely any valid shell command.</p> - -<div class="language-yaml highlighter-rouge"> -<pre class="highlight"><code><span class="c1"># branch whitelist, only for GitHub Pages</span> -<span class="s">branches</span><span class="pi">:</span> - <span class="s">only</span><span class="pi">:</span> - <span class="pi">-</span> <span class="s">gh-pages</span> <span class="c1"># test the gh-pages branch</span> - <span class="pi">-</span> <span class="s">/pages-(.*)/</span> <span class="c1"># test every branch which starts with "pages-"</span> -</code></pre> -</div> - -<p>You want to ensure the Travis builds for your site are being run only on -the branch or branches which contain your site. One means of ensuring this -isolation is including a branch whitelist in your Travis configuration -file. By specifying the <code class="highlighter-rouge">gh-pages</code> branch, you will ensure the associated -test script (discussed above) is only executed on site branches. If you use -a pull request flow for proposing changes, you may wish to enforce a -convention for your builds such that all branches containing edits are -prefixed, exemplified above with the <code class="highlighter-rouge">/pages-(.*)/</code> regular expression.</p> - -<p>The <code class="highlighter-rouge">branches</code> directive is completely optional. Travis will build from every -push to any branch of your repo if leave it out.</p> - -<div class="language-yaml highlighter-rouge"> -<pre class="highlight"><code><span class="s">env</span><span class="pi">:</span> - <span class="s">global</span><span class="pi">:</span> - <span class="pi">-</span> <span class="s">NOKOGIRI_USE_SYSTEM_LIBRARIES=true</span> <span class="c1"># speeds up installation of html-proofer</span> -</code></pre> -</div> - -<p>Using <code class="highlighter-rouge">html-proofer</code>? You’ll want this environment variable. Nokogiri, used -to parse HTML files in your compiled site, comes bundled with libraries -which it must compile each time it is installed. Luckily, you can -dramatically decrease the install time of Nokogiri by setting the -environment variable <code class="highlighter-rouge">NOKOGIRI_USE_SYSTEM_LIBRARIES</code> to <code class="highlighter-rouge">true</code>.</p> - -<div class="note warning"> - <h5>Be sure to exclude <code>vendor</code> from your - <code>_config.yml</code> -</h5> - <p>Travis bundles all gems in the <code>vendor</code> directory on its build - servers, which Jekyll will mistakenly read and explode on.</p> -</div> - -<div class="language-yaml highlighter-rouge"> -<pre class="highlight"><code><span class="s">exclude</span><span class="pi">:</span> <span class="pi">[</span><span class="nv">vendor</span><span class="pi">]</span> -</code></pre> -</div> - -<p>By default you should supply the <code class="highlighter-rouge">sudo: false</code> command to Travis. This command -explicitly tells Travis to run your build on Travis’s <a href="https://docs.travis-ci.com/user/workers/container-based-infrastructure/#Routing-your-build-to-container-based-infrastructure">container-based - infrastructure</a>. Running on the container-based infrastructure can often times -speed up your build. If you have any trouble with your build, or if your build -does need <code class="highlighter-rouge">sudo</code> access, modify the line to <code class="highlighter-rouge">sudo: required</code>.</p> - -<div class="language-yaml highlighter-rouge"> -<pre class="highlight"><code><span class="s">sudo</span><span class="pi">:</span> <span class="s">false</span> -</code></pre> -</div> - -<h3 id="troubleshooting">Troubleshooting</h3> - -<p><strong>Travis error:</strong> <em>“You are trying to install in deployment mode after changing -your Gemfile. Run bundle install elsewhere and add the updated Gemfile.lock -to version control.”</em></p> - -<p><strong>Workaround:</strong> Either run <code class="highlighter-rouge">bundle install</code> locally and commit your changes to -<code class="highlighter-rouge">Gemfile.lock</code>, or remove the <code class="highlighter-rouge">Gemfile.lock</code> file from your repository and add -an entry in the <code class="highlighter-rouge">.gitignore</code> file to avoid it from being checked in again.</p> - -<h3 id="questions">Questions?</h3> - -<p>This entire guide is open-source. Go ahead and <a href="https://github.com/jekyll/jekyll/edit/master/docs/_docs/continuous-integration.md">edit it</a> if you have a -fix or <a href="https://jekyllrb.com/help/">ask for help</a> if you run into trouble and need some help.</p> - - @@ -602,10 +375,13 @@ + + + <div class="section-nav"> <div class="left align-right"> @@ -711,10 +487,14 @@ <li class=""><a href="/docs/templates/">Templates</a></li> + <li class=""><a href="/docs/includes/">Includes</a></li> + + + <li class=""><a href="/docs/permalinks/">Permalinks</a></li> <li class=""><a href="/docs/pagination/">Pagination</a></li> @@ -859,11 +639,11 @@ } }; </script> - <!-- Gauges (http://gaug.es/) --> + <!-- Gauges (http://get.gaug.es/) --> <script> var _gauges = _gauges || []; (function() { var t = document.createElement('script'); t.type = 'text/javascript'; @@ -876,10 +656,10 @@ })(); </script> - <!-- Google Analytics (http://google.com/analytics) --> + <!-- Google Analytics (https://www.google.com/analytics) --> <script> !function(j,e,k,y,l,L){j.GoogleAnalyticsObject=y,j[y]||(j[y]=function(){ (j[y].q=j[y].q||[]).push(arguments)}),j[y].l=+new Date,l=e.createElement(k), L=e.getElementsByTagName(k)[0],l.src='//www.google-analytics.com/analytics.js', L.parentNode.insertBefore(l,L)}(window,document,'script','ga');