Skip to content

Muddasir-Shakil/mini-ci-example2

Repository files navigation

Exercise 2.1: Setup Continuous Integration

In this exercise, you will set up a Continuous Integration (CI) workflow using GitHub as a version control system, Travis CI as a build tool, and DockerHub as artifact repository manager. This workflow will execute the unit tests of the source code and build the code. To trigger it, a change of the codebase must be performed.

Setup

GitHub, Travis CI, DockerHub

Requirements

Instructions

  1. Create a GitHub repository called: mini-ci-example

  2. Add and commit main.go, main_test.go, fib.go, fib_test.go, and go.mod to your repository via drag-and-drop.

  3. Active Travis CI for your GitHub repository.

  4. Create file .travis.yml in your repository and copy-paste content from the provided .travis.yml file.

    os: linux
    
    language: go
    
    go:
    - 1.13.x
    
    script:   
    # Test the code
    - go test -v ./...
    # Build the code 
    - CGO_ENABLED=0 GOARCH=amd64 go build -o demo
  5. Trigger a Travis CI build by a code change, e.g., change "Hello" to "Hi there" in the file ./main.go

  6. Watch Travis executing your tests and building the artifact.

    🔍 What is your observation?

  • Optional: To add Travis CI status to the README.md, follow instructions on: https://docs.travis-ci.com/user/status-images/

    Travis CI Status

    [![Build Status](https://travis-ci.com/YOUR-GITHUB-ACCOUNT/mini-ci-example.svg?branch=main)](https://travis-ci.com/YOUR-GITHUB-ACCOUNT/mini-ci-example)
    

Build Status

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published