CI CD - JU-DEV-Bootcamps/ERAS GitHub Wiki

To automate the process of build and deploy different environments the tools to be used are the next ones:

  • Github Actions (as our code is in github)
  • Docker Hub
  • Docker and Docker Compose

CI/CD structure

ERAS

.github

workflows

main.yml

ERAS-BE

dockerfile

ERAS-FE

dockerfile

docker-compose.yml

Github Actions

Github Actions it's going to allow us to automate tasks in our Github repositories. We can configure actions to compile, test and deploy code. All of this gets defined in a YAML file in the main repository.

Key elements

  • Workflows: Defined processes in a YAML file.
  • Jobs: Set of steps that gets executed in a workflow.
  • Steps: Individual commands that are executed in a job.
  • Actions: Defined tasks that can be used inside the steps.

Create a basic workflow

Path: ./github/workflows/main.yml

Example:

name: CI

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Set up Node.js
      uses: actions/setup-node@v2
      with:
        node-version: '14'
    - name: Install dependencies
      run: npm install
    - name: Run tests
      run: npm test

Triggers

Events that activate workflows:

  • push
  • pull_request
  • schedule
  • etc

Jobs Matrix

Execution of jobs in different environments or configurations Example:

strategy:
  matrix:
    node: [10, 12, 14]
    os: [ubuntu-latest, windows-latest]