DEV Community

Tue
Tue

Posted on

Bugs are not allowed in

During Hacktoberfest, whenever I openend a PR, a list of checks would automatically run and tell me whether my changes broke the code or not. And this week, I had a chance to implement it into my SSG project.

Setting up GitHub Actions:

These are the steps that I went through setting up the automatic process.
I first went to Actions tab and chose this workflow.
Node.js Workflow
GitHub generated a workflow config file for me, I removed the npm build and specified it to run node version 14 and up as some of my syntaxes were not version 10 compatible.

name: Node.js CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [14.x, 16.x]
        # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node-version }}
          cache: "npm"
      - run: npm ci
      - run: npm test
Enter fullscreen mode Exit fullscreen mode

Afterwards, I pulled the repo to update my local and added more tests to my program as I recently refactored it to test easier. One of the commits passed testing after integrating GitHub Actions.
PR passes tests

Adding tests to other repos:

I added some tests to Gustavo's SSG project. I added some e2e tests to his repo which reminded me to add e2e tests to my repo as well :D

Top comments (0)