 Welcome to my talk about open source CD components for GitHub Actions. Unfortunately, I can't be in Singapore due to the travel restrictions, so I'm happy to record that talk. My name is Lothar and I work for Movie Becomes Regional. We build the Regional App. The Regional App is a multi-modal commuter app that brings you from A to B in cities. And we offer you multiple options. So in this screenshot you see public transport, drive now my taxi, TAE scooters and next bikes. And all those options can bring you from A to B. You need only one account for this and subsequently only one payment profile. So this app may replace multiple apps that you use to go from A to B. I work as an engineering manager together with engineers to build products. In my spare time I organize with Jan and Fabrizio the CICD meetup in Berlin, Germany. So in case you are in town drop us a line and check out the next meetup edition. I also write on my blog from time to time and have some source code open source and use some social media. I encourage in my talks to ask questions at any time which I can't do right now because this is a recording. So please send me direct messages in using one of those channels and I try to answer as quick as I can. And also as much questions as possible. Now what are github actions? So it's Docker container runs as workflow automation on the github platform. And last year built in CICD into github actions has been announced. If you look closer into github actions it's workflows and steps and those steps are just code and this code can be shared. And a lot of this code is shared open source and about an open source capabilities with github actions. This is what I want to tell you today about. You see that rather big projects in our industry are connected with github actions. So you can use github actions to deploy to those cloud providers. There are other projects that might be a little bit smaller that also are integrated into github actions. So what is the open source part in here? Those actions that I showed you are available on the curated lists of github actions that github provides. All the examples I checked out were open source. So you could go to all those individual repositories and find out how is the Docker file defined. What does the action do on code level? If you search for something that you can't find in here there are community resources which add a lot of additional options. This is just one example or some actions lists a lot of resources about github actions that you can use on top of the github curated list. And you find also fun things like shaking finger. Jess Frazel offers a shaking finger action and this one uses the shaking finger gift that you just saw on pull request in case a step fails. There are a lot of big open source projects out there that use github actions. Most of the open source projects I am aware of run on github anyway. And a lot of those use github actions. If you want to find out if your favorite open source project uses github actions and how you just search for the .github folder in the open source repository. And if you experience such a folder you can check out what is defined as github actions and how. This is just code and if it's open source you see this github action code as well. This list is by far not complete. I just wanted to give you an idea of which open source projects use github actions. Now I would like to share some of the code capabilities I used and later on I share the open source project where this is showcased to. Matrix builds. This is something that other CI offerings also offer. The main idea is that you create a matrix out of two dimensions and based on the size of the matrix there are multiple jobs that will be executed. In this case the matrix is two by two so four jobs and I do not want all four jobs to be executed so I exclude two of them. The exclusion is defined in this case by the operating system and the go operating flag operating system flag. One exclusion is the operating the combination of the operating system macOS x and the go operating system flag linux. And the second example is operating system Ubuntu linux Ubuntu and the go operating operation system flag double. Now in matrix builds you can define a strategy and in this case the strategy is defined as fail fast false. So this causes all matrix builds to be finished even if a matrix builds fails while there are other builds still running. So this enables you to get feedback about all your matrix builds. In most of the cases apart from that use case you want to fail fast true because round trip time is very important. In this case I decided differently by purpose in GitHub actions you can also use include keyword for matrix builds. And I gave an example here what I initially tried to include and actually it fails. So please be aware if you use include in GitHub actions matrix builds you have you are asked to include items that are not part of the matrix already. And in this case I try to include items that are part of the matrix already and this fails within workflows you can define jobs. And those jobs can run at any time in parallel. In case you want that fine in case you do not want that in case you want to run jobs in sequence you will have to tell GitHub actions that you want to do so. And for that there is a keyword it's called needs and in this case you see a job that is labeled build and docker hub push if Linux. And that job show run only after the benchmark and the test job has been run. And that's why it's defined with the needs keyword. Now benchmark and test job they can run in parallel and it also it's not important according to this definition if benchmark or test finishes first. The important thing here is that benchmark and test job has to be finished before docker and the docker hub push job gets executed. There is the if keyword for conditionals and that allows you to specify certain actions only if certain states or conditions are met. This example will push to docker hub only if the operation system of the metrics job is important. Such a metrics will look like after a successful run similar to that. And I ask you to note the red box because this is the if condition and this if condition was not true. So the step defined within the if condition wasn't executed. Whereas in the other job the condition was true and the commands afterwards have been executed. I also went through surprises that weren't obvious real quick to me. So this is one surprise on the left hand side where I was rather sure this code is OK. Still I got an error message and the error detail was every step must define a uses or run key. And although there is uses in the code already I still got that error message. And it took me quite some time to realize that the name was the culprit here and removing the name fixed that issue. This in general those things became better and better over time. Still I ask you to watch out for similar cases and experiment with your GitHub actions code to fix those. Now I would like to show you some demo using the open source repository that I prepared for that. That's the repository. It's called Hello GitHub actions. And in this repository have a file CICD YAML and in this CICD YAML I define those steps that I introduced earlier to you. So you see here the benchmark and the test step. You see here the sequential execution of build and Docker Hub push if Linux after the benchmark and test step has been executed. You see here the metrics definition and you see here the fail fast false. I dump a lot of context to the console. So I have additional meta information that I may use later to define certain specifics. I do build a binary. And if the metrics operation system is Ubuntu I do push to Docker Hub. Now I would like to show you how that looks like when I do prepare some changes. So the talk that I record right now should be available on this repository too. So I just add this and I add that to the code base and in the commits list I should now see my commit. And there is this little yellow dot that tells me there are some GitHub action runs. So now let's check how those action runs look like. You see here again the commit and those steps that are currently ongoing. The first and the second has been executed already. And the third and the fourth is about to run. You see here what currently happens in those definitions and job runs. And if you enlarge those sections you'll see something similar to live logs. You can search in those logs if you want or you just go with the very tiny feedback that you have in the commits list as this dot. Those runs are also executed in pull requests. I think that is the main use case. Still I would like wanted to show you an alternative and this is just a commit into your repository. So let's wait for the job to be finished. Maybe this one is finished too. So you see here that the condition was false. You also realize that I did the screenshot earlier when a different icon was used. And now you see that also the job that pushes to Docker Hub has been finished already. So let's check out if that is true. Now I'm at Docker Hub. I ask to show me the latest Docker images that belong to Hello GitHub Actions. And you see now that somehow the tech does not show me exactly what I would expect. So let me hard reload. And now I see the expected result. So there is a new Docker Hub, a new Docker image pushed to Docker Hub. So this timestamp is what I defined and with some hash as well. And this just happened recently going back to the presentation. If you want to check out the code, you can follow the link in the slide. And there is even more. So there are way more core concepts than workflows and steps. And in case you are interested, I ask you to read more details about this. I used secrets to deploy to Docker Hub. And those can be encrypted. And you can run those actions not only on GitHub platform but also on self-hosted runners. And if you follow that link, you'll find a post that describes how to run those self-hosted runners on AWS. The contexts that are available on GitHub Actions are also documented. It's rather detailed. Check it out in case you want to know what option this gives you. And you can also start your GitHub Actions run not only using events on the GitHub platform but also outside of that platform. I did push to Docker Hub. And in case you do not want to do so, you can use other targets like package manager or GitHub Docker registry. But you can also deploy to cloud providers as I showed in the beginning or artifact stores like NPM also. Thank you very much for listening to that. In case you are interested in the slides and you want to follow with the links in the slides, please scan this QR code. And I'm happy to answer your questions with direct messages. Thank you very much.