continuous-integrationgithub-actions

What does ubuntu-latest mean for GitHub Actions?


Today I am dealing with the topic of Github Actions. I am not familiar with the topic of CI.

At GitHub I want to create an action. For the time being I use the boilplate of GitHub. I don't understand what ubuntu-latest jobs: build: runs-on: ubuntu-latest means. In another tutorial I saw self-hosted. On the server I want to deploy is also ubuntu, but that has nothing to do with it, right?

Thank you very much for an answer, feedback, comments and ideas.

GitHub workflow yml

name: CI

# Controls when the workflow will run
on:
  # Triggers the workflow on push or pull request events but only for the master branch
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2

      # Runs a single command using the runners shell
      - name: Run a one-line script
        run: echo Hello, world!

      # Runs a set of commands using the runners shell
      - name: Run a multi-line script
        run: |
          echo Add other actions to build,
          echo test, and deploy your project.

Solution

  • The runner is the application that runs a job and its steps from a GitHub Actions workflow.

    It is used by GitHub Actions in the hosted virtual environments, or you can self-host the runner in your own environment.

    Basically, GitHub-hosted runners offer a quicker, simpler way to run your workflows, while self-hosted runners are a highly configurable way to run workflows in your own custom environment.

    Quoting the Github documentation:

    GitHub-hosted runners:
    
    - Receive automatic updates for the operating system, preinstalled packages and tools, and the self-hosted runner application.
    - Are managed and maintained by GitHub.
    - Provide a clean instance for every job execution.
    - Use free minutes on your GitHub plan, with per-minute rates applied after surpassing the free minutes.
    
    Self-hosted runners:
    
    - Receive automatic updates for the self-hosted runner application only. You are responsible for updating the operating system and all other software.
    - Can use cloud services or local machines that you already pay for.
    - Are customizable to your hardware, operating system, software, and security requirements.
    - Don't need to have a clean instance for every job execution.
    Are free to use with GitHub Actions, but you are responsible for the cost of maintaining your runner machines.
    

    You can also see on the link shared above the following table showing the available Github hosted runners with their associated label (such as ubuntu-latest):

    enter image description here

    So when you informed ubuntu-latest on your workflow, you asked Github to provide a runner to execute all the steps contained in your job implementation (it is not related to the server you wish to deploy, but to the pipeline that will perform the deploy operation (in your case)).