Modern Python Projects Transcripts
Chapter: CI
Lecture: GitHub Actions

Login or purchase this course to watch this video and the rest of the course contents.
0:00 GitHub actions is a continuous integration tool built into GitHub,
0:05 and it's pretty easy to set up and use.
0:07 All you need to do is to create a configuration file with a few settings,
0:14 first a name that will be displayed in the GitHub interface,
0:18 and then you need to specify when this task should run.
0:21 In this example, it will be run each time someone pushes a new commit to
0:26 this repository, and finally you define jobs that you want to run.
0:30 In this case, we have one job called Super Lint.
0:34 Since, jobs run in containers, you need to specify what image you want to use
0:38 In this case, we want to use the latest Ubuntu image.
0:42 I will talk more about containers in the last chapter of this course where we will see
0:47 how to use Docker to deploy our application.
0:50 Each job will run a set of steps,
0:53 so under the key steps, you need to define what your job will do.
0:58 As you can see here in the first step,
1:00 we check out the latest version of code,
1:03 and in the second step we run a Super Linter command.
1:07 Both steps use a pre defined action.
1:09 So a plugin that was written by someone checkout is an action that is built
1:14 in directly into GitHub actions. And super Linter comes from GitHub.
1:19 You can search for this name,
1:21 and that way you can see some examples of how to use it.
1:31 As you can see, this tool is a combination of various linters that you can
1:35 use in different programming languages. So this simple GitHub action will check out our
1:44 code and run linter on it.
1:47 If there are some errors, it will report them,
1:49 and this job will fail. Of course,
1:53 you can build much more complicated workflows where you run some custom commands.
1:58 For example, if you're working on a Django website,
2:01 you will need to set up a database before you can run tests and you're not
2:05 limited to running tests or linking your code.
2:08 You can execute any type of a shell command.
2:11 You can install Linux packages when you use a Linux container and then run tools from
2:16 them. You can, for example,
2:18 create a file in one of the steps and use that file In another step,
2:23 you can probably run some Cryptocurrency mining script although it will quickly get you banned,
2:28 so please don't do that. But my point is you can build as complicated pipeline
2:33 as you want. You can even deploy your code to some test server so you
2:37 can then check manually that everything works fine.
2:40 Or if you're not scared by automatically deploying stuff,
2:44 you can deploy your Code to production each time and you commit is merged.
2:49 This practice is called continues delivery,
2:51 and it sometimes goes hand in hand with continuous integration.
2:55 But I personally don't trust it enoughto automatically deploy things to production.