imaginerio/narratives

View on GitHub
.github/workflows/unit-tests.yml

Summary

Maintainability
Test Coverage
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Unit Tests

on:
  push:
    branches: [ master, development ]
  pull_request:
    branches: [ master, development ]
jobs:
  # install dependencies and run test command
  test:
    name: Tests
    runs-on: ubuntu-latest
    steps:
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          node-version: 12
      - name: Checkout repository
        uses: actions/checkout@v2
      - uses: actions/cache@v2
        with:
          path: '**/node_modules'
          key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
      - run: npm install -g yarn
      - name: Install dependencies
        run: yarn
      - name: Run test command
        run: yarn test
  coverage:
    needs: [ test ]
    name: Test Coverage
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - uses: actions/cache@v2
      with:
        path: '**/node_modules'
        key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
    - uses: actions/setup-node@master
      with:
        node-version: '12'
    - run: npm install -g yarn
    - run: yarn install
    - uses: paambaati/codeclimate-action@v2.7.5
      env:
        CC_TEST_REPORTER_ID: 31e81fa2e518d4b3ca9a0aeb7611c052a8e077098fdc795fe689332481e5b4d7
      with:
        coverageCommand: yarn coverage