Bummer! This is just a preview. You need to be signed in with a Pro account to view the entire video.
Start a free Basic trial
to watch this video
Setting up Travis CI is a breeze!
-
0:01
Okay, so what we have now is a fairly advanced program.
-
0:07
That's gonna really test some of your skills,
-
0:09
no I'm just kidding, it's a simple calculator example here.
-
0:12
And if we just go take a look at the implementation here we look at main.
-
0:16
Look at the calculator we're gonna see it does some things that you know how to do.
-
0:22
And if we pop out here it also has tests because you should always write tests.
-
0:28
Here they are,
-
0:28
there are some tests, verifies that things are working as they should.
-
0:33
What I'm gonna do is I'm wanna fork this and
-
0:35
if you wanna follow along you can too there's a link in the teacher's notes.
-
0:39
I'm wanna fork this to my own personal account which is what you can do.
-
0:42
And I'm going to go ahead and I'm going to grab the Clone URL.
-
0:47
When I pop over to my IntelliJ and I'm gonna check out from Version Control and
-
0:51
check out from GitHub.
-
0:54
I have a two factor authentication turned on you might not need this.
-
0:57
Don't worry about it if you don't see the screen, and now I'm going to go ahead and
-
1:01
just paste in the URL that I saw you and we're gonna get that down here locally.
-
1:06
And since it's a great all.
-
1:07
Should know that's great.
-
1:12
We're gonna go ahead and click finish.
-
1:13
And the project is all here and
-
1:19
we should be able to build.
-
1:30
If we click here and we do this and we'll go ahead and
-
1:34
build everything here and if we jump in here and run our Gradle check,
-
1:38
we'll see that all of our test pass, awesome.
-
1:42
Okay, so now that it's working.
-
1:43
Let's go ahead and flip over to our Travis CI,
-
1:46
and I'm gonna go ahead and click Sync Account.
-
1:50
Again, I was up here under My Account.
-
1:53
Now we see that my Java calculator is ready, I'm gonna go ahead and click it.
-
1:57
Okay, so believe it or not we're all ready now.
-
2:01
One thing that we need to do is we need to build that .Travis yml
-
2:05
file that we had discussed.
-
2:07
And if you come down here to Documentation,
-
2:09
and you scroll down here, it talks about Language-specific Guides.
-
2:13
And this is pretty awesome you can see that it does it all for
-
2:14
all these other languages.
-
2:16
We're gonna click on the Java one here.
-
2:19
And the important thing to note here is that
-
2:21
we're gonna have this language.java and let's just go ahead.
-
2:26
Let's start that in our IntelliJ.
-
2:32
We come into here and do a new file called .travis.yml,
-
2:37
okay that's yml, you had another markup language.
-
2:42
And we wanna automatically add to get.
-
2:45
Wanna closer Gradle window here and
-
2:46
with that said that we needed to do there we'll language Java.
-
2:50
I'm wanna save that.
-
2:52
Okay, language Java is what we need.
-
2:54
It has a really nice default, like if you're running mvn,
-
2:57
it has automatic things that you would normally do.
-
3:00
We normally use Gradle here on our courses.
-
3:02
It's gonna run Gradle check which is the test.
-
3:04
It also runs Gradle assemble which we saw over there, just kind of working.
-
3:08
Also if you run ant and there's dependency management and you can test against
-
3:12
multiple jdk's, and let's go ahead and add the jdk that we specifically want.
-
3:16
We want the Oracle jdk, right?
-
3:18
We've been using jdk8.
-
3:20
Back in our yml file.
-
3:22
We'll add jdk:.
-
3:27
And then we'll tab in.
-
3:28
And this is kinda how you do arrays in this yml language.
-
3:33
Oraclejdk8.
-
3:35
Okay.
-
3:36
That looks good.
-
3:37
Now what we're gonna do.
-
3:39
We have our Travis is already set up, I'm gonna go into Version Control here.
-
3:44
And when we do this push, it should automatically, let's say Setup for
-
3:51
Travis CI and go ahead and do Commit and Push.
-
3:57
And we'll go ahead and Push that file in.
-
3:59
It's gonna go ahead and trigger a build over a Travis.
-
4:03
Let's take a look and see what's happening.
-
4:05
If we come back to our home here.
-
4:07
I have some other repositories that have been running as well and
-
4:12
I come to My Accounts and I click Java calculator.
-
4:16
Currently it says there's no build going on let's take a look.
-
4:18
Under branches here.
-
4:19
Here it's building it just wasn't showing it just yet.
-
4:22
This is kind of slick, so what happens?
-
4:24
Is you get to see what's actually happening.
-
4:26
You'll see that when it gets into the state where you can actually
-
4:28
see stuff that pops in over here over my repositories.
-
4:31
Okay, is going to walk through all of the information down here of what's going on
-
4:36
in this is again happening because we pushed that file up.
-
4:41
It's setting up the VM just like it needs.
-
4:44
This gets faster over time and
-
4:46
as this this goes up it will start collapsing things for you.
-
4:50
I'll show you here in a bit after, see it collapsed.
-
4:52
You have more information here should you need it, but
-
4:55
it's gonna show you the things that's most interesting to you.
-
4:59
Here it is, it's running the gradle assemble, it's gonna go ahead and download
-
5:02
gradle just like somebody might if they didn't have gradle on their system.
-
5:05
And remember, this is exactly like what you would be doing on your machine.
-
5:09
But this is happening on the service, you normally wouldn't be watching this.
-
5:12
Just kinda wanna show off what is happening here.
-
5:15
All right, it's got gradle installed.
-
5:17
It's gonna gradle assemble and
-
5:18
if the build passes which it should because of past locally, right?
-
5:22
Goes compiling, boom that popped out and then the check happened and
-
5:25
then when it's all said and done, let's run our test right now.
-
5:30
After it goes ahead downloads the dependencies, right?
-
5:33
Boom, build successful.
-
5:36
It has turned green and now if I look at the Current here,
-
5:39
it shows me that we have a working build at the moment.
-
5:43
That's pretty awesome, right?
-
5:46
I just got an e-mail that had I set this up to connect the slack,
-
5:50
I also would have got notified in my slack room this is happening.
-
5:53
Now, one thing that is powerful, and you've probably seen
-
5:56
these around the internet as you work on open source projects,
-
5:59
cuz you work on open source projects, right?
-
6:01
Are these badges.
-
6:02
If you click on this here you can actually build a new badge.
-
6:05
We wanna say for the branch master we wanna make sure,
-
6:08
let's do grab Markdown here.
-
6:10
Let's go ahead and copy this.
-
6:12
I'm gonna pop over to my README here.
-
6:15
I'm gonna add this because I am proud that we know that this is building and
-
6:19
now anybody can look at this and know that things are working safely.
-
6:22
It's a good way of showing off that hey things are great here.
-
6:27
Okay, now if we come back over to our Get repo and when we refresh,
-
6:30
we'll see this pretty little build passing thing here.
-
6:34
All right, great.
-
6:36
Let's go and add some new test so
-
6:38
we can take a look at what it looks like when you do a poll request.
-
6:41
Now, the other thing to notice too is that when I push that read me up.
-
6:44
Look, another log in kicked off,
-
6:49
like here and see that number two is now going, cool.
You need to sign up for Treehouse in order to download course files.
Sign up