name: '[ci]'

on:
  push:

    # ignore changes to docs and mkdocs.yml
    paths-ignore:
    - 'docs/**'
    - 'mkdocs.yml'

jobs:
  lint:
    if: always()
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js 14.x for lint
      uses: actions/setup-node@v1
      with:
        node-version: '14.x'
    - run: npm i
    - run: npm run lint

  frontend:
    if: always()
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [12.x, 14.x, 16.x]

    env:
      NODE_ENV: test
      
    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - run: npm i
    - run: npm run test-ci

  backend:
    if: always()
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [12.x, 14.x, 16.x]

    env:
      NODE_ENV: test

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - run: |
        cd deploy
        npm i
        npm run test
  
