DEV Community

Vicky Vasilopoulou
Vicky Vasilopoulou

Posted on

Simple Github Workflow for Lint - Prettier & Jest (yarn)

For this workflow make sure you add your own version of node that you have installed on your machine


name: Master Preview

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
jobs:
  run-linters:
    name: Lint & Jest
    runs-on: ubuntu-latest
    steps:
      - name: Check out Git repository
        uses: actions/checkout@v2
      - name: Set up Node.js
        uses: actions/setup-node@v1
        with:
          node-version: v16.6.1
      - name: Install dependencies
        run: yarn --prefer-offline
      - name: Run linters
        run: yarn lint
      - name: Test
        run: yarn test
  prettier:
    name: Prettier
    runs-on: ubuntu-latest
    steps:
      - name: Check out Git repository
        uses: actions/checkout@v2
      - name: Set up Node.js
        uses: actions/setup-node@v1
        with:
          node-version: v16.6.1
      - name: Install dependencies
        run: yarn --prefer-offline
      - name: Run Prettier
        run: yarn run format
  build:
    runs-on: ubuntu-latest
    name: Build and Test
    steps:
      - uses: actions/checkout@v2
        name: Check out repository
      - uses: actions/setup-node@v1
        name: Set up Node.js
        with:
          node-version: 16.10.0
Enter fullscreen mode Exit fullscreen mode

Top comments (0)