theread.me/site/travis-ci-pr-push/index.html

133 lines
4.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Difference between Travis CI tests: PR and Push</title>
<meta name="description" content="I just want to leave this here as I often tend to look it up myself and the first time it was not as easy to figure out.When using Travis CI along with GitHu...">
<link href="https://fonts.googleapis.com/css?family=Secular+One|Nunito|Mononoki" rel="stylesheet">
<link rel="stylesheet" href="/css/main.css">
<link rel="canonical" href="http://localhost:4000/travis-ci-pr-push/">
<link rel="alternate" type="application/rss+xml" title="mahdi" href="http://localhost:4000/feed.xml" />
<!--<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>-->
<script>
var channel = new BroadcastChannel('egg');
channel.addEventListener('message', message => {
alert('Got a message from the other tab:\n' + message.data);
});
</script>
</head>
<body>
<header class="site-header">
<h1>
<a class='site-title' href='/'>
mahdi
</a>
</h1>
<nav>
<p>
<a href="/snippets">snippets</a>
<a href="/art">pictures</a>
</p>
<!--<p class='categories'>-->
<!---->
<!---->
<!--<a href="">art</a>-->
<!---->
<!---->
<!---->
<!---->
<!--</p>-->
<p>
<a href='mailto:mdibaiee@pm.me'>email</a>
<a href='https://git.mahdi.blog/mahdi'>git</a>
<a href='https://www.librarything.com/profile/mdibaiee'>librarything</a>
<a href="http://localhost:4000/feed.xml">feed</a>
</p>
</nav>
</header>
<div class="page-content">
<div class="wrapper">
<h1 class="page-heading"></h1>
<div class='post lang-en'>
<div class="post-header">
<h1 class="post-title"><p>Difference between Travis CI tests: PR and Push</p>
</h1>
<p class="post-meta">
<span>Sep 9, 2017</span>
<span>Reading time: 1 minute</span>
</p>
</div>
<article class="post-content">
<p>I just want to leave this here as I often tend to look it up myself and the first time it was not as easy to figure out.</p>
<p>When using Travis CI along with GitHub (or other git integrations), Travis runs two tests: <code>pr</code> and <code>push</code>.</p>
<p><img src="/img/travis-ci-pr-push-github.jpg" alt="travis-pr-push-github" /></p>
<p>Most of the time you see both tests passing and you do not have to even wonder how they are different, but it has
happened to me that one of the tests fails while the other passes and I started to wonder why.</p>
<h3 id="pr">pr</h3>
<p>The <code>pr</code> test is a test run on the result of a merge between the pull-request branch and the main branch.
As an example, lets say your pull-requests branch is called <code>fix-user-auth</code> and your main branch is <code>master</code>,
in this case, <code>pr</code> merges <code>fix-user-auth</code> into <code>master</code> and then runs the tests on the result of the merge.</p>
<h3 id="push">push</h3>
<p>On the other hand, <code>push</code> is run on the pull-request branch itself, without merging. So in our example above, Travis would checkout to <code>fix-user-auth</code> and run the tests.</p>
<h3 id="a-case-of-difference">A case of difference</h3>
<p>A case in which this difference might be more apparent is when your pull-request is based on a branch other than <code>master</code>, and some changes that your pull-request depends on are missing from <code>master</code>, in this case the <code>push</code> test may pass, but the <code>pr</code> test will fail.</p>
</article>
<div class="share-page">
Share in
<a href="https://twitter.com/intent/tweet?text=Difference between Travis CI tests: PR and Push&url=http://localhost:4000/travis-ci-pr-push/&via=&related=" rel="nofollow" target="_blank" title="Share on Twitter">Twitter</a>
<a href="https://facebook.com/sharer.php?u=http://localhost:4000/travis-ci-pr-push/" rel="nofollow" target="_blank" title="Share on Facebook">Facebook</a>
<a href="https://plus.google.com/share?url=http://localhost:4000/travis-ci-pr-push/" rel="nofollow" target="_blank" title="Share on Google+">Google+</a>
</div>
<div id="commento"></div>
<script defer
src="//commento.mahdi.blog/js/commento.js">
</script>
<script src="/js/heading-links.js"></script>
</div>
</div>
</div>
</body>
</html>