Skip to content

viv-garot/newrepoci

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Learning CI with travis

Simple hello print test

Pre-requirements

  • GitHub account

How to use this repo

As this is a Learning-by-doing repo exercice, avoid cloning the repo but rather create the required files from scratch

- Create an account on travis

  • Go to travis-ci.com and sign up with GitHub

image

  • Accept the Authorization of Travis CI. You’ll be redirected to GitHub.

image

  • Click on your profile picture in the top right of your Travis Dashboard, click Settings and then the green Activate button, and select the repositories you want to use with Travis CI.

image

  • Travis will take a few mins to sync with the GitHub repo

- Create a new repo on GitHub

image

  • Needs to be public, contains a readme file and MIT License

image

- Branch the repo

image

- Create travis file

image

.travis.yml :

language: generic
sudo: required
script:
- bash test_hello.sh

- Create hello file

hello.sh :

#!/usr/bin/env bash

echo "hello"

- Create test_hello file

test_hello.sh :

#!/usr/bin/env bash

# test that hello.sh outputs hello

OUT=$(bash ./hello.sh)

if [ ${OUT} = "hello" ] ; then
 echo "Output is hello"
 exit 0
else
 echo "Output is not hello"
 echo ${OUT}
 exit 1
fi

- Create pull request

  • Compare & pull request

image

  • Create pull request

image

- Wait for travis to complete the checks/build

image

- This how a successful build looks like on travis

image

- Checks passed on GitHub, you can now safely merge the PR

image

- Confirm the merge

image

- Delete the branch

image

- Modify hello.sh so the build fails in travis

  • Edit hello.sh (replace hello with bye)
#!/usr/bin/env bash

echo "bye"

- Commit the changes into a new branch

image

- Create the pull request

  • See how the checks are now failing in GH

image

  • And how the build failed in travis

image

- Close the pull request

image

- Delete the branch

image

image

About

description

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages