We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

GitHub Actions (in|for) Raku

00:00

Formale Metadaten

Titel
GitHub Actions (in|for) Raku
Untertitel
Containerizing Raku for testing and other automation tasks
Serientitel
Anzahl der Teile
287
Autor
Lizenz
CC-Namensnennung 2.0 Belgien:
Sie dürfen das Werk bzw. den Inhalt zu jedem legalen Zweck nutzen, verändern und in unveränderter oder veränderter Form vervielfältigen, verbreiten und öffentlich zugänglich machen, sofern Sie den Namen des Autors/Rechteinhabers in der von ihm festgelegten Weise nennen.
Identifikatoren
Herausgeber
Erscheinungsjahr
Sprache

Inhaltliche Metadaten

Fachgebiet
Genre
Abstract
GitHub has a nice environment for carrying out repository-event triggered workflows; these use a variety of runner platforms, including containers. This talk is about how to create a Raku container that can successfully act as a runner for workflows, and how to Rakuize the workflow API so that Raku scripts can interact meaningfully with this environment. There are two parts on this talk; first, how to create a chain of increasingly complex Raku containers that can be used mainly for testing, and second, how to run some Raku scripts within those containers, with cool things that can be done inside those workflow using Raku.
ProgrammierumgebungInverser LimesSoftwaretestGruppenoperationBimodulUmwandlungsenthalpieCodeDokumentenserverInstantiierungArithmetisches MittelHash-AlgorithmusEreignishorizontKomplex <Algebra>Elektronische PublikationData MiningVorzeichen <Mathematik>TypentheorieKonfigurationsdatenbankCachingBildschirmfensterVersionsverwaltungDifferenteRepository <Informatik>Rechter WinkelInterpretiererNabel <Mathematik>CASE <Informatik>DefaultProzess <Informatik>BitEndliche ModelltheorieOrdnung <Mathematik>Stochastische AbhängigkeitMetadatenFunktion <Mathematik>MereologieOpen SourceFolge <Mathematik>XMLUML
DokumentenserverFrequenzDefaultDivergente ReiheSoftwaretestInstantiierungLeistung <Physik>Güte der AnpassungStabCachingRechter WinkelVariableSampler <Musikinstrument>RechenwerkMathematikProgrammierumgebungZweiMultiplikationsoperatorUmwandlungsenthalpieBitGruppenoperationt-TestTropfenMeta-TagFlächentheorieLastProzess <Informatik>BildschirmfensterHook <Programmierung>Schnittmenge
GammafunktionVollständiger VerbandDokumentenserverRepository <Informatik>AnalysisBimodulHochdruckFehlermeldungInstantiierungProgrammierumgebungSkriptspracheNabel <Mathematik>System FGruppenoperationKlasse <Mathematik>Ordnung <Mathematik>ZweiDynamisches SystemCachingElektronische PublikationAusnahmebehandlungProgrammbibliothekSchnittmengeVariablePi <Zahl>Installation <Informatik>Schreiben <Datenverarbeitung>Funktion <Mathematik>Gleitendes MittelMAPDatensatzDistributionenraumDefaultGesetz <Physik>UmwandlungsenthalpieGamecontrollerZeichenketteOverhead <Kommunikationstechnik>Rechter WinkelFunktionalXMLUML
UnendlichkeitWurm <Informatik>ProgrammierumgebungDifferenteOrdnung <Mathematik>BildschirmfensterBildgebendes VerfahrenBimodulGruppenoperationElektronischer FingerabdruckMultiplikationsoperatorCASE <Informatik>CodeFunktionalBasis <Mathematik>Rechter WinkelHidden-Markov-ModellSoftwaretestGüte der AnpassungIntegralMultiplikationUMLComputeranimationBesprechung/Interview
KonfigurationsdatenbankGüte der AnpassungDämpfungDokumentenserverZweiKlasse <Mathematik>BitPolygonOverhead <Kommunikationstechnik>GruppenoperationSystemaufrufCachingMultiplikationsoperatort-TestSoftware EngineeringOpen SourceVideokonferenzDatenverwaltungDatenflussSpielkonsoleREST <Informatik>RückkopplungDatensatzBesprechung/Interview
Besprechung/InterviewComputeranimation
Transkript: Englisch(automatisch erzeugt)
Hello, my name is Guillermo. I'm very grateful to Andrew Shito for organizing this
It's my pleasure to be here again. I'm going to talk about GitHub Actions in and for Req. Basically This is a small introduction to what GitHub Actions are. They are relatively new and probably most of you already know But it's good to know how they are, what they are and how they are organized
Well, they are flexible workflow Execution environment triggered by repo event repository events. So it's an environment where in principle you can run anything at all And it's also free for open source Repo, so you don't have to pay for it. You can have it for your modules or whatever You don't need to pay anything. There's probably a limit. I haven't
bumped into that limit yet But of course if you start to run some Some Bitcoin mining or whatever You'll probably have some trouble. Anyway The thing is that we call every one of the files is called a workflow The workflows have jobs
Which are independent Execution environment so the every job Runs in its own environment. They are isolated from each other and every job runs sequential steps, so every job
Will run this and then that and then right so we can use that for testing a RACO module and we just Need to do something like this first we decide The kind of triggers that are going to To start creating that workflow, right?
Like in this case is push or pull request push is Essentially you push into the repository pull request is somebody else is opening a pull request or whatever then You give it a name in this case. We just call it test
Then we say where it's running there are there are three roughly three kinds of environments, but four but essentially three Wnt or Windows or Mac In this case, we are using the latest version of Wnt which very recently was switched to 2004 And then that's it we run a step and there's a single step what looks like a single step
Which is a github action that's called RACO test action and then this up sign indicates What kind of Essentially Where in the repository you're going to run that so main means that whatever is in main you're going to run that
You can also use v1 for instance for for a tag or you can use a specific comic hash Or whatever or nothing by default it will talk it with the test I mean it will get whatever is in the repository in main. I mean, that's got its implication
Let's not get into that for the timing, right? So you see that in principle we're doing is I mean You don't really have to configure or anything as any complexity or anything that that's specific for RACO Should be in there. So let's say and see what's in there, right?
You see that You can put some name on this so You can also have some some kind of you know IDs or whatever. This is it There's not there's not much more to it, right? Every one of those steps is properly called an action. So we have actions is everything, you know all the environment
But every every one of those steps is an action And there are and we can see this in action, right? So this is Not something like that one. So this is this is the the That kind of workflow running in
that output which is one of the of the RACO community models that I have been working on lately and You see that it's got different different steps in it. So it's running check out you see that there is a little bit of complexity there, but But well, it's assuming that we will expect to do in any repository
No, first run this then run that and that's it, right? so Simply works But how does it work well As you have seen we're kind of hiding the complexity of testing. I Mean, it's not terribly complex, but but I still it's got some steps, right?
I'm going to try and explain how we do that and Basically what we have done is we have packed everything we we need into an action and there are four types of actions One of them is called container Right. So essentially you say okay, whatever we're going to run. Here's the container just run this
shell which might could be shell or any other of the of the Pro any other of the Interpreters that are in there for instance Python, Ruby and also of course Perl JavaScript so that there is a JavaScript kind of the special language for for
It have action so it's got some some specific kind of environment to run that and what we call composite, right? We're running a composite one So this is actually a composite action and this is the actual code for the action Again, not terribly complicated, but that it's hidden. It's hiding some complexity inside
So this is how this we describe this kind of metadata for that for the action. So The composite action is It's what we need in order to run several steps Why do we need several steps? Well, mainly because of the cache Because the cache is something that that's another value of this this thing
So we say well, that's the first part of the of this jam file We have action under within in jam file. You probably know this already by now, but anyway We say it's running a composite action and then we describe the steps that this composite action is going to
To write so it's got three steps Not a big deal You see that It's describing the steps right here And it it's going to check out then it's setting up a cache and then eventually it's Running the steps right because the steps can be we see two kinds two different kinds of steps here
We see two of them are external GitHub actions, and then we see another type which is a external Docker container, which is in the in the GitHub container registry we also have some other kinds like
For instance scripts, we're not using them right now. We will see them later on, right? So let's let's watch our steps Watch what we are doing first. We are running a check out because You have actual general workflows in general workflows
You don't know if you are going to handle that the repository or not You might be doing something which is totally different. So we need to tell it. No way We're interested in having the source here. So check it out. And also it's called actions slash Checkout whatever is is in the actions namespace miss that they are kind of official so they That's that's essentially the name of a repository so you have has
Set up a series of repositories which are power actions slash whatever like for instance the second one, right? which cache caches cache installed distributions, so it's called action cache and and
it's also Relatively simple to set up as soon as you know where the where the thing things to be cached is So it's got to part first. You need to tell it what's going to change these changes you need to to To set up whatever is in the cache again, so it will be a cache miss if this doesn't changes
Well, we don't need we don't need to set it up again So what we are doing is we are hashing the meta J meta 6 of JSON We said this changes just throw away what we have in the cache and set it up over again and and the all the comp units And everything all the pre comps and everything is going to be in the dot rack
Directory, so we tell it. Okay, so if this changes Create a package with all this over again That's good. I mean that that's something that that that can be done and We will I mean We can get something out of that because it's going to make our staff faster and then I mean
The final thing where the actual test install is Also, it's tested through self install period we will see that later on It's in the last step so that will install but then the the the action slash cache
Sets up a hook that who is going to be run after this step. Don't worry about that. But essentially if This is going to work with whatever is installed whatever is installed is going to be It's going to install in this step or it's going to be brought from from you know, the previous step, right?
So this is what it does. So it What I did in that github action that you saw at the beginning is essentially to pack to package Those three steps in a single one Is there some proven what so happen there is so surface is reasonably fast
But that's still even if you have some simple some simple dependency like for instance test meta or some simple one It's going to take a while, you know, don't load everything. Don't know Don't load all the all the upstream dependencies Test them and install them. So you go from three minutes three minutes 41 seconds
Almost four minutes to one minute. It's 25% of the time. You might not get so much so much You know improvement if you if you have any other on your kind of thing also of dependencies or you might get much more but but I still
is preventing your your CI workflow to to Waste time in something that that's done over and over again, right? But let's look a bit to the to the Racco container so that Racco container was designed specifically It's not it's not a general Racco container. We have other Racco containers that are there
this one was designed specifically for for github actions because There are several things so that needs to be done so it's not really a General Racco container why because the environment that we have is a little bit special, right? So
We need to We can have what is saying, okay It says it have a saying let me take care of this, but I want to do I want to make all these things in a specific way in a specific environment with specific privileges What are those privileges where?
We need to have first the the default user ID is going to be 1 0 1 by default is 1,000, but we need to set it up. Sorry so that it is 1,001 then git and tar need to be available in principle If you got a Racco container, you don't need git and tar because well, it's Racco
But but git have says no we are going to use this, right? Also because the default tar that's installing in in Alpine is not POSIX compliant not we don't really need to worry about that that just put this inside the container, right and finally
this probably the more the most difficult thing is that we need to deal with the fact that the The home environment variables is set to home git have for no reason whatsoever So just says no, no, you need to set it set it up set this up this way and this is kind of complicated because when we are installing
Racco it's trying to think that the home is in a different place Slash comma slash Racco, right? So it's going to try and look for all the precomps all the comp units right here. We don't want that. So we need to take care of that not really
Sorry about that. Not really complicated but We need to tell it that it needs to look for the comp units where it's usually doing that, right? And we need to do so in a way that doesn't disrupt the rest of the workflows. So our
little Racco container has all that kind of thing but Once we have that we say, okay, so we can we can run our workflows in Racco container and that's a nice thing so That's another way of running and workflows. I told that there were
essentially three ways of running it So so we had Windows and Mac OS and Ubuntu and then in this case, we have Ubuntu but then also Whatever is going to be run in a specific job is going to be run inside the container so GitHub action is going to set up the whole thing
So every time we run some some command here it's going to say it's going to to kind of drop those commands inside the That container is going to run them inside, right? This is the container that that's wrong And you probably don't remember it's exactly the same that we have used in the GitHub action And then we pretty much do the same. So we check out we set up the cache
Essentially the same thing except that we are now much more flexible. We can run some things inside For instance, we're going to install some external Library or dynamic library, whatever for doing some
some native Native library we can do it there, right? Other than that we are doing exactly the same Check out set up the cache and then run self install Except that as you see These steps are run inside the container, right?
So that we we don't need to tell you no go inside the container and then run self and then this and that No, no, we know that that self is going to be available because because we haven't started in the container And that's cool It opens, you know, like a whole new world of possibilities Because you've got much more control, right?
You can you can use you can run anything that's that's in in a pie you can run shell script And you can also run stuffy in Raku, right? So you can work for the end of the day are general Scripts that are triggered by some action
So if you decide to for instance to write a workflow that does some analysis on the repository And then write a comment or whatever you can do it. So you can you can And you as you can see everything is cached so you might decide to install some other some other Modules and a sub to run something there anything you can do with Raku you can do it right here in this this repository, right?
Well, of course, it's a very limited environment. It's not only two cores, but still, you know You can even do more because if it have workflows have have More things they have like
They have one thing that they're not going to get into because there is a whole we have API that you can work on So you can you can access, you know comments or whatever. You can take comments. I mean everything that's in in the API, right? But there is a common convention with that that says if a step has a
Has a exit status. That's that's not zero that would fail, but you can also Interact with it with the environment in some other ways, right? It's a very minimal text based API Essentially it consists of printing some strings in a specific way
Let's use to communicate with user tell them errors warnings or whatever What can you use for that? Well this thing called GitHub actions It have colon colon action. It's a it's a lucky module that's been published to the ecosystem
It's essentially an easy. It's it's syntactic sugar for for using This minimalist API that it has for instance. There is a there is a GitHub associative Variable that contains all the all the GitHub environment variables that are in there except what you have to write
It have underscore whatever. Yes, you know go go there then you have set output which which is a way of For for a step in an action to output something that can be using the next step or any other step You can also set environment variables with set dash
M debug will just print something If you if you got the debug environment set up error will you know print everything in red and It will just print something error is not going to To exit the action. So you need to take care of that. Anyway, this is set up in such a way
That if you if you issue an error Essentially if you use at the end a specific exit Function it's going to fail, right? Warning is warning and so so forth and you can do that from from right so you don't need to remember if it's
Column-column then whatever what you need to care about that and you can use that directly in your Git cab action so you can write Steps using any script remember at the beginning with I told you that the we could use any step written in any any shell
Or other scripted language that's available. But now we are going to have record by level in that environment So we can write things in records everything is that by default the shell is going to be Well bash or or shell But then we tell it what or shell is going to be raku and then zero among among curly braces which means that it's going to create a temporary file or of this and then it's going to
You know tack that file at the end of raku whatever that that Marker is right. So we say use it collections and set up with our of course you need to install that before
That's taking inside the merriment. So you can you can write steps in raku. So whatever you you can do in raku You can do it there for instance. You can run a standard scripts You can have a script in the intro repo and you can tell it no, I'm going to run this for instance this is something I run in the in the
for for doing class analytics, which is you know, the topic of my next Talk or my previous talk Exactly the order But you say that just run this with raku because crack with some I love you see that This is quite quite interesting So as long as you you've set up and you you found out all the quirks and all the specific
Ways that you need to set up your you have actions having draco available there, you know, it's a good thing it doesn't add a lot of overhead because the the Container is relatively small. It's like 300 megabytes. So it takes just a few seconds. So
Sorry To the law so we're up to the conclusion. We have full control forget how action is in raku not full food We still need to have some easy access to the GitHub API Right now there's there's no module or no distribution in there because except for that
Well, they were probably one in the near future And so you can use ready-made That one is already there and you can just you know Copy the file and start using it or made our own or roll out drum and that sit Thank you very much
well Hello there I'm going for the image to show up and now I see It So around here just in case you have any questions so main thing is that I
Tried to you know convey the idea. It's pretty lazy to set up all this stuff And taking my headphones off because this lag is driving me crazy
Anyway so I would like this to be kind of a the start to to The creation of lots of workflows written directly in drug And also some some modules that will be specifically for writing a stuff in right
So that's that's the basic idea that's way created to start with I think that but whatever you think about GitHub is in that it has set up a very nice environment for for creating Workflows and for kind of supporting testing
doing stuff related with open source and With this you can do it with right so I would really encourage you to to try it out so that We are going to do something like that Okay, so Liz is asking the intent to support other OS is apart from Linux
Hmm that's a good question so As a matter of fact if I want to do that We have to take a roundabout way Because the first thing you have to do is you have to create a multi art Container
I do have a multi-arch container for for doing this kind of thing So what I will have to do is to use that multi-arch container as the basis for Doing the same kind of functionality with that with the arch container
I can do that definitely so I will try and support Marcos as long as I am now a cos user myself, so We'll really try to do that. The thing with Windows is that
The trouble is that I'm not really sure how to create native containers for Windows anyway, take into account that What you are running is actually within the environment of these kind of actions
so it's Not kind of going to make a big difference So I mean First thing first. So the first thing is that the what what you have is is a
It's a module that's called we have actions That module can definitely run inside inside my cos That's the thing so what you would need is to have some Action that works within my cos, but that would need native Raku
That's something that can definitely be done I'm not totally sure if that would have some use case that's totally different from from testing and stuffing
In Windows it's not now It would definitely make sense if there are some specific modules that use native Macos code Liz probably knows better and she can tell me if there's such a thing
but But I mean Long story short, Camido I Will try to Get around to it in the future. Yeah windows and then I was
Under a short time. I was exclusively Wound to user now. I am a some a cos user. I don't think I will into my old age We'll switch to Windows anytime soon But Still I understand that there we need to support it. I mean if you want to test Windows a
Bear has a has a very good support for for Windows so Service asking what does the integration with the hub issues look like what? The thing is that in order to integrate with the it have issues issues
What you have to do is to you have to work with with a hub API, right? So right now as I have said in my talk, we don't really cover that kind of thing with in Greg so At the end of the day and they have a piece of rest API So you come most definitely just create a request to a rest API with it
Whether you have token or whatever so that That's what you can do right now In you know what I have a talk about my dark, which is the class repository. I'm doing that in pair
It's it's simply an API call so we can do that with with Raku very very easily but I'm not sure that that that's another baby you can you can have But I mean push comes to show I will Do that in Raku as you know, I'm already doing that kind of thing in my repository
You know and creating comments in the students repository So that they know whose other students are going to review that that put request so No, can be. Thank you, sir
And the overhead of installing Raku it into it have action credit time much no, no, it's absolutely You know fast It's faster than the loading it using using some some package manager. So it's it's very fast I think it's like something like eight seconds
Because I also tried to make this this are being a thing it's a small as possible the I Didn't talk about that, but you know, it's self-using Raku grew where I did is I created the record containers from a strap is scratch Compiling from scratch more BM and in QP and in Raku though, so that the initial
Containers less than 100 megabytes and Take into account that it's also in the in the it have A container registry so it's you know, I think it's six seconds or something like that. So it's very very fast
So it doesn't really it doesn't really it Into the into the credit a lot is I mean so far actually it's the best practice to do this kind of thing because because it's been it's been really designed to to Have the smallest overhead possible besides as you know
Open source is is free for you have action, but even if you use it in some private or paying workflow, it's not going to be a lot and I have added also the support for for caches Which makes actions even faster. So I mean all in all I
Have this Making stuff as fast as possible initially when I was doing stuff for my students. I really tried to get them in I mean to keep them into a flow estate when they Submit something and then you know if they get the feedback
Very slowly they are going to lose them the flow estate It's not something you want to right now, you know, I also acting as Senior software engineer in poly poly and I also taking care of some GitHub actions and there and Stuff and also trying to make them as fast as possible
so The overhead is something I really really care about and I really try to make I mean to cut into it as much as I Can I not really encourage you to try it out?
I mean, it's it's as easy as working with it in the command line And we have very good support and it's going to be very fast I think that's if it have really sees that there are lots of
actions that are working with with Raku it will encourage Having a little bit of Mars support for for Raku in GitHub, you know in the markdown highlights and in other places like like they eat ignore think or some other places I Don't know if it's changed. I mean then
In some places you go to breathe you could already use for a coup but I think that getting nor was still giving the whole name even if we have a full request in the GitHub Nora For a long time saying telling them that no, it's not called
That way anymore. So
There are apparently no more questions. So I'm going to Yes, this matters, right? So I'm going to stop transmitting and not going to any more silences to the video. Thank you very much
I'm going to stick around for the next Talk with a rocket steering console just going to be awesome. Yes. See you there