Code Monkey home page Code Monkey logo

golang-training-cicd's Introduction

Build status

CI/CD with Travis CI and Heroku

What is Travis CI

Travis CI is a hosted, distributed continuous integration service used to build and test software projects hosted at GitHub.

In this course we will use it to build our projects follow CI/CD pattern

What is Heroku

Heroku is a cloud platform as a service supporting several programming languages. Heroku, one of the first cloud platforms, has been in development since June 2007, when it supported only the Ruby programming language, but now supports Java, Node.js, Scala, Clojure, Python, PHP, and Go

In this course, we will use it to deploy our projects follow CI/CD pattern.

Installation

Install Travis CI

Visit Travis CI's documents for more detail.

Firstly, you need to understand how to build a public project hosted on Github using Travis CI.

For go project

  1. Let create a .travis.yml
language: go
go: 
 - 1.12.3

script:
 - go test -v ./...
  1. Follow the official guide to build the code

Install Heroku

Visit DevCenter of Heroku for more detail

Firstly, easy way to install Heroku CLI tool is using Nodejs on developer mode.

npm install -g heroku

Running Locally

$ git clone https://github.com/tpphu/golang-training-cicd.git
$ cd golang-training-cicd
$ go build -o bin/golang-training-cicd -v .
$ heroku local

Your app should now be running on localhost:5000.

Using Travis to deploy to Heroku

Use heroku auth:token for shot-term key, or heroku authorizations:create for long-term key.

language: go
go: 
 - 1.12.3

script:
 - go test -v ./...
deploy:
  provider: heroku
  app: tranquil-gorge-15185
  api_key:
    secure: "b63df6f4-cfdd-436e-8b42-213d1b59559b"

Demo

All source code is available here

How to understand demo code

  • .travis.yml is the file used by Travis CI to build and deploy
  • heroku.yml is the file used by Heroku to describle the project
  • Procfile is the file used by Heroku to start the project
  • Dockerfile is the file used by Heroku to build golang project on the Heroku server

golang-training-cicd's People

Contributors

tpphu avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.