Exploring workflow jobs
In this section, we’ll explore how you can use containers and services to run jobs in your GitHub Actions workflows. This powerful feature allows you to control the environment in which your jobs run and can be incredibly useful when your jobs have specific dependencies. But before we do this, let’s take a look at how jobs work.
Understanding how jobs work
In GitHub Actions, a workflow run is made up of one or more jobs. Jobs are defined in the workflow file and represent the tasks the workflow will perform. Each job runs in an environment specified by runs-on
. Here’s a high-level look at how jobs work:
- Run on a virtual host: Each job runs on a fresh instance of the virtual environment specified by
runs-on
. This could be GitHub-hosted runners, such asubuntu-latest
,windows-latest
, andmacos-latest
, or self-hosted runners. - Run in parallel: By default, jobs run in parallel. If you need jobs to run sequentially, you can define...