Press "Enter" to skip to content

Running CircleCI on Pull Request – Continuous Integration P3 – Fun Fun Function


good money more of this series by the

way you can watch the series from the

star by clicking there we explored what

enough automated verification system is

and in the second episode we looked at

setting such an automated verification

system up for reals

using circle CI in that episode we set

up our automated verification system to

run on every commit we made to the

master branch

now that gave us the benefit of us

knowing that whenever somebody made and

commit that broke the master branch we

would get notified and we could fix it

but it would have been even better if we

had been notified about the problem even

before it got on to master that is why

in this video we are going to make our

automated verification run on every pull

request

I am your host mpj and you are watching

Fonfon function

[Music]

all right so last episode we are

configured circle CI to run our

automated verification verification

system to run every time we made a

change to master but this time we want

to make it run on every pull request

that is what we’re gonna do today

okay so let’s first make a blue let’s

make a commit that break something um

here’s the tests create stores back blue

blue blue

I’m gonna write just bark here and then

I’m going to hang on hang on how do I do

this how do I do this

open integrate terminal no create in

that create in new integrated terminal

that’s what we’re looking for and I’m

just gonna run npm tests let’s see what

happens smooth starting that yeah that’s

these this is not the speed of light no

it’s it’s not at all the speed of light

okay it’s running tests what that should

not have worked is the test even here

what is this a store create store sure

store should be initialized with

location state okay

perhaps he only needs whatever path in

order for it to work I’m gonna write bug

in there instead and then we rerun this

slow test with incredibly slow to

startup time BAM

Jesus test startup is very slow I think

it does it because it’s meant to be in

watch state crates it’s it’s very fast

when you run the watch which makes it

bearable I suppose but I still had this

been a real project I would probably

spend a little bit of time getting rid

of this insane startup time because the

test itself takes wait less than a

second but a startup time is like 10

seconds it’s just what anyway I digress

we now have a broken broken broken state

and let

so let’s make a mistake and commit this

to master so get stutters hello agate

and tests store great store hop get

commit message I broke it broke it and

it push origin think that I’m using

origin map master must master nice

master

boop-boop cool Circle CI calm go to app

by clicking here in the upper right

corner and here we are here here it’s

this thing it’s running it’s running and

it’s running and it’s suffering through

our insanely long startup time i refresh

there but you actually don’t have to do

that this live updating and it it’s

gonna go and update live when it has

successfully run but I think we can

check the progress actually what do you

do to do you can check the NPM test yeah

here it is here is insanely slow and

p.m. test and bam it breaks store should

be in nationalized with location state

it broke like we wanted it to great

except this is not great because we are

we just we were able to break master

that’s bad

so instead we want to move to a

developing process where we do pull

request and we want to run the automated

notification system on every pull

request so let’s make a commit that

fixes this issue and I edit that there

now save the file and then get I can

just do this again get a test great

store and then we I i unbroke it oh I’m

broke it and then we just instead of

pushing to origin/master we are going to

put a push our local master to some

branch that we’re gonna call mpj fix

and today’s date which is a Sunday

because I am recording these on Sundays

even seeing them Oh Liberty predict

about we do okay all right so let’s go

to github here is github and github is a

fantastic user interface so it has like

it’s suggesting here all we or recently

pushed branches and PGA fix Sunday

listen to me go and it has a handy

button here compare and pull requests

let’s let’s click that and that creates

a pull request and we could leave a

bunch of comments here but we have a

cook commit message this is not good but

this this episode is not about how to do

a good pull request it’s how we add an

automated verification system to the

pull request system so let’s for now be

okay with this incredibly shitty comment

and pull request message and have and

committed okay let’s see here why isn’t

it

Oh oh it has already ran that is pretty

nifty hang on hang on let me check that

that was that was weirdly fast actually

oh good rap what happened what happened

okay to me

oh okay so when I push the branch to our

repository it actually started running

it immediately even before I created the

pull request and when where by the time

I had created full requests after my

rant on our horrible commit message this

was already done so we actually have

this this now works like let’s actually

can I retrieve this yes so that we can

yeah here rebuild let’s see if this

yeah find it lime updates on github

that’s pretty cool so this is what you

are probably gonna see and more long

running continuous integration so some

checks haven’t completed yet one pending

check circle CI so cozy is running your

tests it’s nice and you’ll see here that

hey it’s running and it does the npm

install which is taking the bulk of the

time and the later point i think we’re

gonna do a little episode on how to how

to cache this because that speeds up the

things hey but that’s not what we’re

gonna do today we are going to sit here

and wait for this this is because that’s

that’s quality youtube entertainment

don’t tell me I don’t love you I only

give you the very best waiting for its

software development tools to complete

that is what the show is mostly about

waiting for software yes it’s complete

fantastic to be honest this is this is

like this is slightly bad for YouTube

purpose not because it was slow but

because it was slightly too easy I was

hoping that this would actually I would

actually be able to teach you something

on how to set up circle circles the I

like some kind of configuration thing or

something but this just worked it was

not intent but since circle cir the

sponsors of this episode i suppose it

puts them in a good light I honestly

kind of expect to have to fight a little

bit with software development tools

before they go I get them working

but in this showcases why Circle CI is

the very first sponsor that I have been

comfortable enough where to bring on the

show I use circusy on myself for

personal projects for pretty much

exactly this reason this is this is the

experience you tend to have with circle

CI attends teeth just work but even if

this worked out of the box we still have

some work to do because I look right now

all checks of past and I have Murshid

but let’s say that I my fix actually

didn’t fix it let’s say that I bought

bug bug bug bug bug and I committed I

unbroke it again sorry there I broke it

again no ok actually need to add the

file there add the file then I broke it

again and then I’m gonna push it to my

MCG a fix on the branch and it’s gonna

push there it’s going to yes ok call

let’s can we have this update please

update come on I know you want to live

update github I know you can do it

perhaps you can’t come on don’t make me

refresh ok i’m gonna refresh alright so

you see now that some checks haven’t

completed yet oh it’s time for waiting

again there’s no coffee in the mug can’t

believe we’re doing all this waiting yes

so that i can demonstrate a little tiny

thing the next episode is really really

going to be about how to make the CI

process fast what it has actually

completed its just oh it isn’t deep

github did not update for me i’ve waited

in vain anyway this is what i wanted to

demonstrate look here i am able to merge

this pull request even though all checks

have failed not acceptable

let’s go into settings and fix that

settings

bla bla bla integrations and services

perhaps no yes

what branches collaborators no I don’t

want to enter passwords ok

hmm the fourth branch hmm here it is

protected branches we are going to

choose a branch to protect me you’re

going to prick master and here is the

pruning for take this branch

click it Kiki all right so this disables

force pushes to this branch or prevents

it from being deleted okay that’s not

very useful we want this one require

status checks to pass before merging

okay cool

ah yes cool like okay require branches

to be up to date before merging yeah

that’s fine but this is what we’re

interested in

status check found in the last week for

this repository cool circle CI is now

required

I’m gonna save changes ah needs a

password let’s do one password and we’re

gonna fill in password for github

hashtag not sponsored but let’s one

password is amazing okay let’s see let’s

go back to our pull request and see what

happens can I fail as an administrator

you may still merge this request okay so

far I I am an administrator so I am able

to Kimber

can I disable that like include in our

and force all configured restrictions

for administrators say ok let’s go back

no ok let’s go to the pull up okay I am

Robert okay let’s write division oh yes

I can’t

yeah branch protected I’m feeling very

you know corny today like I’m gonna get

a lot of you know comments today that

includes the word cringe I have actually

added the word cringed my blocked list

of words on on YouTube so life hack you

need to write cringe with a K in order

to write mean things to me now that this

is working I would like to go do one

more step let’s go to settings here and

branches and go to the protected branch

master and I’m gonna check this one as

well require pull request reviews before

merging which means that somebody

actually has to review with the review

the pull requests and also when enabled

all commits must be made to a non

protected branch and support submitted

via pull request at least one approved

review and no changes request bla bla

bla bla bla so this means that you

to do changes to the repository through

poor requests it takes a little bit of

time getting used to if you are

I got cowboy coder and you just paw like

to push things to master but once you

get used to this it’s a fantastic way of

working because it makes you it the

magic of it is that every change has

been touched by at least two people you

never you are never alone in breaking

the system you’re never alone in taking

down the server or making a mistake

you’re always two people and that gives

a lot of security it makes you much

calmer as a developer as an individual

developer and it also makes your team a

lot more likely to feel ownership around

the system as a whole

I’ll be I’m a big fan of pull requests

really it’s because it is the place in

software development time and place

where all change happens to your piece

of software it’s the place where we can

do code review where we can discuss the

the change where we inform each other

about the change and unless we did in

this case here it’s where we can add our

automated verification system I am so

good at saying this now automated

verification system it’s like this 20

dwarves took turns doing handstands on

the carpet kind of exercise in Swedish

there is one sex laksa in Lux ask now

every time there is a poll request

happening Circle CI goes in and runs our

automated verification system on it and

checks checks the pull requests and

rejects it or accept set depending on

what the automated irrigation system

says when we have things set up like

this it’s kind of like circles ein

automated voted and the automated

verification system ship acts like an

extra member of our team that knots code

review for us and that is it if you want

to try out circle CI on one of your own

project aggregate routes Merkle CI slash

fund CI to try it out that link doesn’t

give me

more money or anything it’s just a way

for you to tell them that you came from

funfun function suka CI has a a pretty

decent free tea or even for private

projects so it’s not a trial it’s

permanently free if you have a like a

private small project the free plan will

most likely serve you perfectly well

so please do try circle CI so closely I

dot com slash fun CI you have just

watched an episode of fun fun function I

release these every Monday morning

oh wait hundred GMT you can watch

another episode of this show by clicking

here or if you are a patron of fun fun

function you have access to the fun fun

forum they can check out this dedicate a

discussion topic on the front for forum

for this specific episode I am mpj until next Monday morning stay curious

Please follow and like us: