SergiuToporjinschi/node-red-contrib-heater-controller

View on GitHub
.github/workflows/main.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: Tests

on:
  push:
    paths:
      - '**.js'
      - '**.css'
      - '**.json'
      - '**.html'
      - '**.yml'
    branches: [ master ]
  pull_request:
    paths:
      - '**.js'
      - '**.css'
      - '**.json'
      - '**.html'
      - '**.yml'
    branches: [ master ]

jobs:
  buildWindows:
    name: Windows${{ matrix.node-version }}
    runs-on: windows-latest
    strategy:
      fail-fast: false
      matrix:
        node-version:  [12.x, 14.x, 15.x, 16.x]
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-python@v2
      with:
        python-version: '2.7'

    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}

    - name: installForWindows
      shell: cmd
      run: |
        npm install --global --no-optional windows-build-tools@5.2.2 --vs2015
        npm audit fix
        npm install
        npm audit fix
        npm run build --if-present
        npm run test-cov


  buildLinux:
    name: Linux${{ matrix.node-version }}
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        node-version:  [12.x, 14.x, 15.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@v1
      with:
        node-version: ${{ matrix.node-version }}

    - name: installForLinux
      run: |
        npm ci
        npm run build --if-present
        npm run test-cov

    - name: Coveralls
      uses: coverallsapp/github-action@master
      with:
        github-token: ${{ secrets.GITHUB_TOKEN }}

    - name: Codacy Coverage Reporter
      if: runner.os == 'Linux'
      uses: codacy/codacy-coverage-reporter-action@0.2.0
      with:
        project-token: ${{ secrets.CODACY_TOKEN }}
        coverage-reports: ./coverage/lcov.info