Skip to content

troutman21/Travis-Test-Repo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Travis CI Demo

Purpose: this demo is to show the standard functionality of the Travis CI and how it can be used to automatically complete certain tasks depending on the outcome of some testing script

Steps to complete for Demo

  1. Fork this repo so you have a local copy of it in your GitHub account

  2. Disconnect Travis CI from this repo (prior to the Demo)

    • Note: Prior to the start of the demo make sure disconnect Travis CI from this repo.
      • Go to Account Settings --> Applications --> Configure (next to Travis CI) --> remove this repo form list of connected repos --> save
  3. Connect Travis CI to this repo

    • Demo how to reconnect the repo to Travis CI
      • go to repo menu in your personal Travis CI account
      • Go to "Manage repositories on GitHub"
      • click on "Only select repositories" radio button
      • select this repo
      • click on "Approve and install"
  4. Show Travis CI settings for the test repo

    • Go to your repo menu in your personal Travis CI account and search for the now connected test repo, then click on "settings"
    • Point out the Environment Variables. These will be necessary for connecting to AWS from Travis. You will use particular environment variables to set up CD.
  5. Push code to the repo and show that the Travis processes will build

    • Create a new branch and make some small change to it, then commit it and push it to that branch in GitHub. I.e. git push origin <yourBranchName>
    • Once you have done that go into your Travis CI account and show the build logs
    • Note: that by default your sum test will not pass, and because of that an "after_failure" script will run (this prints an asci cat to the Travis CI console 🥴)
    • Walk the cohort through the .travis.yml file in the this repo that specifies what to do when a test fails and passes
      • If it fails a makeCat script runs that prints a random asci cat to the console
      • If it passes a success script runs that prints a different asci message to the console 🙂 (feel free to change this message to whatever you want)
  6. Update test to pass the test, push again, and merge to show a successful build

    • Change the test case in the sum.test.js file so that it will pass the test script ran by Travis CI

      • The code should look like this to pass:
      const sum = require('./sum');
      
      test('adds 1 + 2 to equal 3', () => {
        expect(sum(1, 2)).toBe(3);
      });
    • once you merge the file into the master branch go back to your Travis CI console and show them the build output

About

This repo is used to test the Travis CI/CD process

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published