GitHub Actions

Agenda 🧐

1) What is Actions?

2) Essential terminology

3) Review of workflow example

4) How to setup?

What is Actions? 🤔

automation service integrated directly to your GitHub repositories

Concept and components

Workflow

is a configurable automated process that will run jobs.

Can be triggered by:

  • event
  • manually
  • defined schedule

Defined in the .github/workflows directory in a repository,

so you can have multiple workflows in one repository.

Event

is a specific activity in a repository that triggers a workflow run.

For example:

  • create pull request
  • push commit

Complete list of events: click

Job

is a set of steps in a workflow that is executed on the same runner.

Each step is either a shell script that will be executed, or an action that will be run.

Steps are executed in order and are dependent on each other.
Jobs have no dependencies and run in parallel with each other (can be configured).

Action

is a custom application for the GitHub Actions platform that performs a complex but frequently repeated task.

You can write your own actions, or you can find existing in the GitHub Marketplace.

For example:

  • pull your git repository from GitHub
  • run linter for your codebase

Runner

is a server that runs your workflows when they're triggered.

You can use GitHub-hosted runners or self-hosted runners.

Each runner can run a single job at a time.

Workflow example

Workflow example

name: CI

on: [push]

jobs:
  tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Set up Go
        uses: actions/setup-go@v4
        with:
          go-version: '1.20'

      - name: Run tests
        run: go test ./...

  linter:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - uses: actions/setup-go@v4
        with:
          go-version: '1.20'
          cache: false

      - name: golangci-lint
        uses: golangci/golangci-lint-action@v3
        with:
          version: v1.54

So, how to setup? ⚙️

1) Create yaml file in repo in .github/workflow folder

2) Configure events

3) Describe jobs

✅ Done!

GitHub Actions

By Volodymyr Kupriienko

GitHub Actions

  • 87