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


Talk Python's Mastodon Michael Kennedy's Mastodon