{"id":238315,"date":"2022-06-17T04:42:00","date_gmt":"2022-06-17T08:42:00","guid":{"rendered":"https:\/\/wordpress-756359-3782526.cloudwaysapps.com\/?p=238315"},"modified":"2024-09-30T07:53:17","modified_gmt":"2024-09-30T07:53:17","slug":"22-06-17-ballerina","status":"publish","type":"post","link":"https:\/\/www.travis-ci.com\/blog\/22-06-17-ballerina\/","title":{"rendered":"Using Ballerina with Travis"},"content":{"rendered":"\n<p>Ballerina makes it easier to use, combine, and create network services, let\u2019s see how we can just quickly setup Ballerina in Travis, lets put on our dancing shoes and setup Ballerina with Travis.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"getting-started\">Getting started<\/h2>\n\n\n\n<p>Let\u2019s make a file called&nbsp;<code>Ballerina.toml<\/code>&nbsp;in our root directory, this is how mine looks:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ballerina]\ndependencies-toml-version = \"2\"\n\n&#91;&#91;package]]\norg = \"ballerina\"\nname = \"io\"\nversion = \"1.1.0\"\ndependencies = &#91;\n\t{org = \"ballerina\", name = \"jballerina.java\"},\n\t{org = \"ballerina\", name = \"lang.value\"}\n]\nmodules = &#91;\n\t{org = \"ballerina\", packageName = \"io\", moduleName = \"io\"}\n]\n\n&#91;&#91;package]]\norg = \"ballerina\"\nname = \"jballerina.java\"\nversion = \"0.0.0\"\n\n&#91;&#91;package]]\norg = \"ballerina\"\nname = \"lang.value\"\nversion = \"0.0.0\"\ndependencies = &#91;\n\t{org = \"ballerina\", name = \"jballerina.java\"}\n]\n\n&#91;&#91;package]]\norg = \"ballerina\"\nname = \"observe\"\nversion = \"1.0.1\"\ndependencies = &#91;\n\t{org = \"ballerina\", name = \"jballerina.java\"}\n]\n\n&#91;&#91;package]]\norg = \"ballerinai\"\nname = \"observe\"\nversion = \"0.0.0\"\ndependencies = &#91;\n\t{org = \"ballerina\", name = \"jballerina.java\"},\n\t{org = \"ballerina\", name = \"observe\"}\n]\nmodules = &#91;\n\t{org = \"ballerinai\", packageName = \"observe\", moduleName = \"observe\"}\n]\n\n&#91;&#91;package]]\norg = \"manu\"\nname = \"semtype_test\"\nversion = \"0.1.0\"\ndependencies = &#91;\n\t{org = \"ballerina\", name = \"io\"},\n\t{org = \"ballerinai\", name = \"observe\"}\n]\nmodules = &#91;\n\t{org = \"manu\", packageName = \"semtype_test\", moduleName = \"semtype_test\"}\n]<\/code><\/pre>\n\n\n\n<p>Now let\u2019s make a sample Ballerina file that just is a \u201cHello World\u201d file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import ballerina\/io;\n\npublic function main() {\n    io:println(\"Hello, World!\");\n}<\/code><\/pre>\n\n\n\n<p>Now let\u2019s get to our&nbsp;<code>.travis.yml<\/code>&nbsp;file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"travis-configuration\">Travis configuration<\/h2>\n\n\n\n<p>This is my&nbsp;<code>.travis.yml<\/code>&nbsp;file, as you can see we&nbsp;<code>wget<\/code>&nbsp;Ballerina, and run some cursory Ballerina commands, just to make sure Ballerina is working:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dist: xenial\nlanguage: generic\ngroup: edge\nservices:\n  - docker\nbefore_install:\n  - wget https:\/\/dist.ballerina.io\/downloads\/2201.0.2\/ballerina-2201.0.2-swan-lake-linux-x64.deb\n  - sudo dpkg -i ballerina*.deb\n  - bal version\n  - sudo bal dist update\nscript:\n  - bal pull ballerinax\/twitter\n  - bal run main.bal\n  - bal search apache\n  - bal grpc --input helloworld.proto --mode service --output service\n  - bal grpc --input helloworld.proto --mode client --output client\n  - bal grpc --input helloworld.proto --output stubs<\/code><\/pre>\n\n\n\n<p>We\u2019ve searched their Hub for a package called&nbsp;<code>twitter<\/code>, we find it, and then we run our Ballerina file called&nbsp;<code>main.bal<\/code>, and we see that it runs!<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"665\" src=\"https:\/\/www.travis-ci.com\/wp-content\/uploads\/2022\/06\/174350690-7bf6eb13-8473-4cb1-8062-edc3ded1a562-1024x665-1.png\" alt=\"\" class=\"wp-image-242769\" srcset=\"https:\/\/www.travis-ci.com\/wp-content\/uploads\/2022\/06\/174350690-7bf6eb13-8473-4cb1-8062-edc3ded1a562-1024x665-1.png 1024w, https:\/\/www.travis-ci.com\/wp-content\/uploads\/2022\/06\/174350690-7bf6eb13-8473-4cb1-8062-edc3ded1a562-1024x665-1-300x195.png 300w, https:\/\/www.travis-ci.com\/wp-content\/uploads\/2022\/06\/174350690-7bf6eb13-8473-4cb1-8062-edc3ded1a562-1024x665-1-768x499.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n\n\n\n<p>There you go, you\u2019ve now just used Ballerina with Travis. So go ahead and dance around and see what you can accomplish with Travis CI and Ballerina.<\/p>\n\n\n\n<p>As always if you have any questions, any questions at all, please email me at&nbsp;<a href=\"mailto:montana@travis-ci.org\">montana@travis-ci.org<\/a>.<\/p>\n\n\n\n<p>Happy building!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ballerina makes it easier to use, combine, and create network services, let\u2019s see how we can just quickly setup Ballerina in Travis, lets put on our dancing shoes and setup Ballerina with Travis. Getting started Let\u2019s make a file called&nbsp;Ballerina.toml&nbsp;in our root directory, this is how mine looks: Now let\u2019s make a sample Ballerina file [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_breakdance_hide_in_design_set":false,"_breakdance_tags":"","footnotes":""},"categories":[16],"tags":[7,19,20,5],"class_list":["post-238315","post","type-post","status-publish","format-standard","hentry","category-news","tag-community","tag-feature","tag-infrastructure","tag-news"],"_links":{"self":[{"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/posts\/238315","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/comments?post=238315"}],"version-history":[{"count":2,"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/posts\/238315\/revisions"}],"predecessor-version":[{"id":242770,"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/posts\/238315\/revisions\/242770"}],"wp:attachment":[{"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/media?parent=238315"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/categories?post=238315"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/tags?post=238315"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}