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
-
Fork this repo so you have a local copy of it in your GitHub account
-
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
- Note: Prior to the start of the demo make sure disconnect Travis CI from this repo.
-
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"
- Demo how to reconnect the repo to Travis CI
-
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.
-
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
- Create a new branch and make some small change to it, then commit it and push it to that branch in GitHub. I.e.
-
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
-