Next: , Up: Continuous Integration (CI)   [Contents]


5.1 GitHub Actions

There are several continuous integration and continuous deployment (CI/CD) platforms that can be used, but for the sake of simplicity and to unify the Git repositories remotes with all automated capabilities, this section is focused on the solution provided by GitHub.

With GitHub Actions, there can be defined custom workflows (pipelines), jobs (set of steps within a workflow) and steps (individual tasks within a job). Also, GitHub provides hosted runners (execution environments for workflows) that are managed and maintained by them, but there can be deployed self-hosted ones in our own infrastructure, e.g. to run the workflow that monitors and controls a k8s cluster defined with Terraform and Ansible; also they are needed to perform a local SonarQube analysis.

This is a blank basic example (‘.github/workflows/example.yaml’) that showcases the order of jobs and the GitHub Actions’s workflow syntax (YAML).

name: example

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
    types:
      - opened
      - synchronize

jobs:
  build:
  test:
  analysis:
  package-and-storage:

In the next sections, a complete overview and description of all key CI stages described here, which are relevant when developing an application.