DEV Community

Tymur Levtsun
Tymur Levtsun

Posted on

Making sure Izyum is always fresh

Overview

This week we worked on integrating CI into our open-source projects. It is not the first time for me to work with CI and pipelines in general, but I find it very satisfying to put my project on some pipeline every time. These kinds of automations sometimes feel like magic to me.

Implementation

Since my project isn't that big I had only two things that I want to perform on my pipeline:

  1. Running ESlint check
  2. Running my units tests, which are already built After some time of going through the GitHub actions documentation I ended up with the .yml that looked like this:
name: ci

on:
  pull_request:
    branches:
      - main
  push:
    branches:
      - main

jobs:
  lint:
    name: ESLint
    runs-on: ubuntu-latest
    steps:
      - name: Check out code
        uses: actions/checkout@v2

      - name: Setup node
        uses: actions/setup-node@v2
        with:
          node-version: '16'
          cache: 'npm'

      - name: Install node dependencies
        run: npm ci

      - name: Run ESLint
        run: npm run lint
  unit-tests:
    name: Unit Tests
    runs-on: ubuntu-latest
    steps:
      - name: Check out code
        uses: actions/checkout@v2

      - name: Setup node
        uses: actions/setup-node@v2
        with:
          node-version: '16'
          cache: 'npm'

      - name: Install node dependencies and run Tests
        run: npm install-ci-test
Enter fullscreen mode Exit fullscreen mode

Then I created the PR and made sure that it run successfully and also made another commit where I purposely crashed tests to make sure that CI would fail too. After all of these, I merge the PR in the main branch.

Top comments (0)