{"id":8327,"date":"2020-06-30T18:12:34","date_gmt":"2020-06-30T18:12:34","guid":{"rendered":"http:\/\/putridparrot.com\/blog\/?p=8327"},"modified":"2020-06-30T18:12:34","modified_gmt":"2020-06-30T18:12:34","slug":"getting-started-with-travis-ci-and-github","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/getting-started-with-travis-ci-and-github\/","title":{"rendered":"Getting started with Travis CI and GitHub"},"content":{"rendered":"<p>As I&#8217;m seemingly trying out each free tier CI\/CD online service I can, let&#8217;s look into <a href=\"https:\/\/travis-ci.org\/\" rel=\"noopener noreferrer\" target=\"_blank\">Travis CI<\/a>.<\/p>\n<ul>\n<li>Create an account, with you preferred authentication provider (from the one&#8217;s they have available)<\/li>\n<li>Sign-in, if not done so already<\/li>\n<li>We need to click on <em>Activate All Repositories using GitHub Apps<\/em><\/li>\n<li>Then click <em>Approve &#038; Install<\/em>. You can select specific repos. if you wish before click on this button<\/li>\n<li>You&#8217;ll be asked to sign in again this will take you to GitHub where you click <em>Authorise travis-pro<\/em> if you wish to continue<\/li>\n<li>You&#8217;ll then be redirected to Travis CI<\/li>\n<\/ul>\n<p><strong>Let\u2019s get started<\/strong><\/p>\n<p>In your project\u2019s repository add the file .travis.yml an example is shown below<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nlanguage: csharp\r\n\r\nbranches:\r\n  only:\r\n  - master\r\n<\/pre>\n<p>If you&#8217;ve read the previous posts, you won&#8217;t be surprised to see another .yml file with the Travis CI DSL. If we take a look at <a href=\"https:\/\/docs.travis-ci.com\/user\/languages\/csharp\/\" rel=\"noopener noreferrer\" target=\"_blank\">Building a C#, F#, or Visual Basic Project<\/a> we can see that the <em>language<\/em> for the .travis.yml is <em>csharp<\/em> for .NET languages C#, F# and VB.NET. <\/p>\n<p>Here&#8217;s my .travis.yml for an F# .NET core project<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nlanguage: csharp\r\nmono: none\r\ndotnet: 3.1\r\nsolution: FSharp.Health.sln\r\n\r\nscript:\r\n  - dotnet build\r\n  - dotnet test\r\n<\/pre>\n<p>Pretty straight forward, we use the <em>script<\/em> section for the steps to run the <em>dotnet<\/em> commands to build and test our code.<\/p>\n<p>Ofcourse we&#8217;ll want to add a build badge to the README.md, so from the build within Travis CI simply click on the build badge next to your project name, then select FORMAT Markdown. Here&#8217;s an example for my FSharp.Health project<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n&#x5B;!&#x5B;Build Status](https:\/\/travis-ci.com\/putridparrot\/FSharp.Health.svg?branch=master)](https:\/\/travis-ci.com\/putridparrot\/FSharp.Health)\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>As I&#8217;m seemingly trying out each free tier CI\/CD online service I can, let&#8217;s look into Travis CI. Create an account, with you preferred authentication provider (from the one&#8217;s they have available) Sign-in, if not done so already We need to click on Activate All Repositories using GitHub Apps Then click Approve &#038; Install. You [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[301,297,303],"tags":[],"class_list":["post-8327","post","type-post","status-publish","format-standard","hentry","category-ci-cd","category-github","category-travis-ci"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/8327","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=8327"}],"version-history":[{"count":2,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/8327\/revisions"}],"predecessor-version":[{"id":8329,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/8327\/revisions\/8329"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=8327"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=8327"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=8327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}