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