Fastlane Automation For Mobile Apps | The Xamarin Show
Articles Blog

Fastlane Automation For Mobile Apps | The Xamarin Show

August 8, 2019

[MUSIC].>>Welcome back everyone
to the Xamarin Show. I’m your host James Montemagno, and I have a good friend
Mahmood Ali here, who’s going to be talking to us about some crazy awesome automation stuff, but thanks for joining me today.>>Thank you. Thanks for the invite. Mahmood Ali, I work
at Lambda3 in Brazil. I’m doing mostly
mobile development right now. But I try to do everything, and I really like
open source projects so that’s why I like
Fastlane so much.>>That’s awesome. So
Fastlane is a tool that I’ve talked about before because we use it to do some of
our auto provisioning type stuff, but I hear it does
tons of things, right?>>Yeah. So I tend to tell people that mobile development loved very easy you have to make
a lot of things. If you have multiple platforms, you’ll have multiple operational
systems with different problems, so you’re handling screenshots,
building, testing, releasing, ad-hoc
provisioning profiles, and it’s a bunch of stuff, and none of them has anything
to do with your app. So really sucks.>>We talked about one time
on pack I guess I did, it’s you spend months on an app, but then literally
the last one percent take the longest because I just
need to get I need the screenshots, I need this thing, and
I need that thing, and they’re all different.>>Yeah. So I think we should not
spend some time on those tasks. We should be develop new features, optimize our application
so that’s why I really like Fastlane because it helps
on this automation tasks, and I don’t have to worry
about it ever again. I just set it up really easily, it abstract all the complexity, and then I have tasks
that are boring task, repetitive automated for me so I can spend my time worrying about the stuff that
really matters for my app.>>The app. Only work on the app. So it’s Fastlane a free
tool, as in open source? So where does it come from?>>Fastlane is totally open source, it’s maintained by the community. It was created by Felix Krause, I don’t think I’m spelling
his name correctly, I’m sorry. But it’s completely open source
and you have the GitHub. It’s really active. You’ll see that any issues that you open are commented on really quickly. What Fastlane does is,
it is a mobile tool set so you have all the available
actions that you can use. They call any automate task action.>>Okay.>>So if you open documentation
you’ll see a lot of actions, and it really is a lot of actions, and that’s not all because it provides plugging
expansion sensibility. So even though there is not an actual available
there is probably a plug-in of that makes
the any test that you need. So I really suggest if you want to use Fastlane you open
this documentation, and you see everything that it does. It does tasks that are all, and a bunch of categories
like test, and building, screenshots, preparing your
app for distribution metadata. So it’s really helpful.>>I used Fastlane one time
I used a plug-in funny you mention that because it’s a really important thing
because you can note on this screenshot here
you see iOS, Android, Mac, but you’re talking about
the testing part is I was distributing stuffs
through tests flight, and you only get so many invites
on test flight back in the day, and now they have open invites. But the cool thing I
did with Fastlane is I plugged in a pull in error, I added a plug-in that I
could query test flight, and then I could even
scrub like, hey, give me, and scrub, and delete anyone that hasn’t installed the
app in a year, right? Because all testers and
you clear them out, and I did it all through a simple
script. It was mind-blowing.>>I don’t think this test
doesn’t take very long, but when you’re doing it constantly. So, like you said when you
finish your application, you want to just release it. So you stumbled on
a bunch of problems, and Fastlane is just
beautiful for that, you don’t have to worry you
just read documentation, set a few parameters, and you’re good to go.>>Very cool. So what
else what are we going to be showing as
part of Fastlanes I guess?>>I really like a lot of actions. There is one that I think it really shows how
Fastlane can help you. So when you finish your
application you have to take screenshots to upload it to the
app Store and to the Google Play. That is a task that it’s
really boring to do. If you find an error or
your change just a label you, I got to do it all over again.>>Then you don’t, and then your screenshots are all
old, and you’re like oh.>>Beauty of that. So
then you reframe it, you not only have
your screenshots in your app, but you shouldn’t be uploading your app raw screenshots because
that’s not very appealing. So frame it helps you with that. It will help you create a new
screenshot with device frame on it, a cool background, and you
can put a little description. So that automated it really magical, when you see it running, you just
can’t believe it’s that easy. So for example here’s
the simplest way you can create a frame screenshots
you just pass on the path, and it will take some defaults, and create everything for you. If you want to add a background you just read documentation you
the parameters available.>>Very cool.>>That’s it will create
everything for you, you just have to upload them.>>Nice.>>You can upload them
using Fastlane too, so that our other action and.>>When I put that
into your CI system.>>Yeah.>>Because you could have it on maybe Azure DevOps or send it
to the other CI service, and then just say, :Hey,
every time I build my app, go get me
fresh screenshots, all right?”. That’d be so cool.>>You just don’t have to worry
anymore it’s really amazing. Another action that’s really
popular with Fastlane is match.>>What’s that?>>So much handles all the complicate
parts on iOS development so.>>Which one because there’s
about a billion thing.>>So if you used iOS before, you probably have seen these error. It says there is no signing
identities for you to sign you app, and you just wanted to
test on your device, and you must be one the on the Android I just it in, I deployed it,.>>It works.>>Correctly.>>Yeah.>>So, why iOS does that?
Well, Apple has security. Pretty much Apple asks
for a few questions that are required to answer
like what is this app? Who is signing this
app? On what devices is that can be installed on? So certificates in profiles
tried to answer this question. The problem is if you find out that you have to create
a certificate profile, you start researching
and you’ll see that it’s a whole different problems
that you had been anticipated. Soon you are reading about
public and private keys and FIDs in a lot of complexity.>>Not fun.>>Visual Studio actually shipped this automatic provisioning feature as far as I know it uses Fastlane. But it only takes you so far because it’s perfect for
deployment on your device. But if you’re using
continuous integration pipeline, it will not work perfectly because you have to export
it to import it on your.>>Just the quick developer mode. I need it really quick
out for end of the day.>>It’s perfect for that,
but when you’re using App Center or Azure DevOps, you
have to import these files, so you can sign your application, and Fastlane helps you with that. So what Fastlane match does
is, it implements concept described on this website,
a whole sign in guide.>>There’s a whole website
just [inaudible] .>>That’s how complex it is. So handling all of these files
is really complex, the community came up
with the best solution, so this is a bunch of
best practices like. Cool.>>You seize this. This is sensitive information you should be careful where you start.>>So I should stop
taking screenshots, and then slacking it to me.>>Yeah.>>I’ll remember this, right?>>So code signing guide.
The best practices you should be storing your certificates
and profiles on different repository.
You should encrypt them. So there’s another layer of security. So you can choose whoever
has access to these files, who can sign your application. You can see why this is
a sensitive information, because someone could just release a new version of your application
and that’s really bad.>>Yeah.>>So much those are
all there for you. So you don’t have to
worry about it again. It’s so fast that when I run
it I try to explain to people, it’s so much thing happening in the council
because it’s doing its thing.>>Yeah.>>So I have to scroll back
to explain how fast it is. So I want to show that to you. So I have application here, Since I’ve never used Fastlane
on this project before, I will be running Fastlane init.>>I go and zoom it from here.>>Okay.>>So we can see it on
the code. There. [inaudible] Fastlane init. So you then install Fastlane tools.>>Yeah, I installed
it using Homebrew.>>Okay.>>On Mac iOS. So when
you say Fastlane init, it will try to find
out an Xcode project, because it doesn’t know Xamarin. But that’s not a problem.>>Yeah.>>For most of the tasks,
that it’s not a problem. So I’m going to tell him to go and create it manually
for me the set-off.>>Of course.>>So now you can see that
it is really verbose.>>Yeah.>>I should say.>>Very colorful too [inaudible]>>Yeah . But it’s helping us. So if you’ll never
use Fastlane before, it’s given a lot of
information on how to do it. What are lanes? I’m going to explain
them in a minute. So you can see how you really
can start your Fastlane setup. What it did for me was,
it created two files, app file and a Fastfile.>>Okay.>>So with app file, what it does is, I should store all my
sharing information here. So, if a lot of actions needed
my Apple id and my app id.>>Yeah.>>I can start them
here. That’s what I did. So I have end file
configuration here.>>Okay.>>Where I just provide
this information. Then I go to the Fastfile. I probably never look
at the file again.>>Because that’s like your little
configuration file basically.>>Yeah.>>Yeah, so it’s like, “Hey, I need this, almost
a key-value store.”>>Yeah.>>Yeah, cool.>>So with Fastfile, what I’m going to do is, here I can define the
what they call lanes.>>Okay.>>So that’s why Fastlane.>>Fastlane.>>So a lane is pretty much how
workflow that I can set up. So let’s say, whenever
I do a release, I want to reminisce screenshots, frame it, create a new Persian
profiles, start a profile. So it’s a bunch of
actions that I’m using.>>Okay.>>So I don’t want to do
Fastlane match, Fastlane frame it. I want to draw a lane.
Then I call match in, call frame it inside the lane.>>So it’s like if I think like
a pipeline, a CI pipeline.>>Yeah.>>It’s like here’s a task, or it’s like a bunch of little tasks, but they’re all making one lane. So it’s like when I say
build, it does all these.>>Yeah.>>Instead of having to do
them all manually. Yeah.>>Exactly.>>It’s cool.>>Since most of the actions
have parenthesis, you can send them here. So you don’t have to keep
repeating that ever again.>>Oh cool.>>So let me show what
I did adhoc lane.>>Okay.>>So adhoc is that kind
of distribution that you would do when you’re
using Abstainer like app.>>Yeah.>>I wanted some beta testers and I’m not releasing
to the store yet. So when you are doing
this kind of deploy, apple requires you
to tell what kind of devices your app is running.>>Yeah.>>So you have to do all of that. What I did here, I am using match.>>So I see match.>>Yeah.>>Then I see Git URL.>>Yeah.>>An e-mail.>>So these Git URL is the different repository that I was talking about on
called training guide.>>Okay.>>So this is where you will store all the sensitive
information, encrypts it. So it just needs my Git URL, my e-mail and it’s type of
profile that I’m generating.>>Cool.>>So I’m saying it’s adhoc. It’s really magical
because now I’m going to run “Fastlane Adhoc”.
That is my lane.>>That’s your lane not match, because the adhoc is
going to run match.>>Yeah.>>I got it.>>So it’s going to
start doing a lot of things. Now you can
see in the course. It’s always showing
what parameters was sets. So you can see if you get
an error or something like that.>>Yeah.>>You can see Fastlane run
all your parameters correctly. So match is pretty much
an action for actions. So it does a lot of things
and it is doing search first. So search will try to find
a certificate all my a repository. Since he doesn’t find the one, he’s going to the
developer Apple portal, creating a new one, downloading, installing it, commuting it, and push into my repository. So it is all of that for me. The first time I ran this,
I put on my password and it’s not able to make you change.>>Yeah.>>So they’ll have to
[inaudible] again. Then it does the same thing
for a personal profile. So it’s going on the Apple portal, create a new one installing. Now with just that command, if I go back to my Visual Studio, you can see that there is a matching certificate
in a matching profile.>>Automatically.>>Yeah. So match did
all of that for me. Since I configure my Apple
id in all of that. So I came deployed out. Well, if I open up
my Azure DevOps repository, that’s where I’m storing
my certificate profile. You can see that I’m there
go in push the new files. If you open these files, they will not be usable
because they’re encrypted.>>Yeah.>>So you have the password
to decrypt it. Another thing that I think
it’s really awesome. So profiles are immutable. So when someone tells you, “Can you add on another device
that I can test this app on?”>>Yeah.>>They thinks like more second.>>Yeah.>>But actually, you’ll have
to go on the Apple portal, create a new profile, add a device. Some of the another of those boring
tasks that I don’t want to do.>>Yeah.>>So Fastlane helps
me with that too. So there’s another action
called Register devices. It takes the devices file a text
file that Apple provides for us. So I can create a new one. Let’s call it Xamarin Show.>>Nice.>>Now, I’m going to tell match
that the next time it runs, I want to force that it will
add all the new devices.>>Of course, if you
register anywhere even in even enough from fascinating
you went and did it manually.>>Yeah.>>Next time you run
this boom, got it.>>Yeah. You will automatically
add all the devices available. If I run this now, it
should be running faster because it’ll not create
the whole certificate, you will just create a new device
and create a new profile.>>Well, cool.>>So.>>This is amazing because, you could run this
manually as a developer, but again, putting it in
your UCI server where. Yeah, like I could upload this, but like just go do
this and then give me my new cert then do my habit.>>Yeah, you don’t
have to worry about. So if someone has a new device you really don’t have to
worry about anything. You just tell them to
generate a new one. Now if I go to
the Azure DevOps again, you can see that the certificates
were created three minutes ago, but their profiles
were created just now. So it handles all of that. So we doesn’t create
a mass developer Apple portal.>>Yeah.>>Because there are
limits on the number of certificates that
you can use there. If you’re working on a company
with a bunch of teams, you don’t want people messing around and revoking
a valid certificate.>>Yeah.>>So with that, Fastlane
just did all of that for me.>>It’s awesome.>>Yeah, now I can just run
it on any most machines. So if some new labs are coming from my team they just
have to run “Fastlane adhoc”, they are ready to go to.>>Very cool.>>It’s really awesome.>>That’s amazing.
[inaudible] because I’ve done like
this match at Fastlane. I did one thing that I really
needed to do is like mind-blowing.>>Yeah.>>Awesome.>>I also like that
Fastlane is done over Ruby. So even though I’m not
a Ruby programmer, I find Ruby really easy to read. So, and since it’s open source,
I find myself opening the project, reading a method
that does not only action.>>Yeah.>>Coding all my Fastfile, it works.>>That’s cool.>>It’s really extensible and
really easy to customize.>>Very nice. Awesome. We’ll put
all the links to, what’s shown us, the Fastlane and have you
any blogs or [inaudible] presentation that will
definitely link to all that. I think I’ll even link to
the auto provisioning video do with Ole which is super cool.>>Yeah.>>Awesome. Thank you for coming on.>>Thank you.>>Yeah, it’s awesome. I love
it. It’s like mind-blowing. I love cool awesome new stuff. Well, thanks everyone for tuning in. Of course, again, I’ll put
everything in the show notes below, and of course, don’t
forget to subscribe on your favorite YouTube, or Channel 9. So you get all the
Xamarin show in your inbox. Thanks again for coming on.>>Thank you.>>Thanks everyone for tuning in. I’m James Montemagno,
and this is Ben, and that’s Xamarin show. [MUSIC]>>Hey, James here,
just wanted to check in and thank you for
watching this video. Now do all the things that you know you want to do such as, like, subscribe, and ding that notification bell
become part of the notification squad. While you’re here, check out all these awesome videos
that I’ve already recorded. Click on that thing. Click
it, watch it, do it.

Only registered users can comment.

Leave a Reply

Your email address will not be published. Required fields are marked *