on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - "**" # matches every branch
name: "Node.js Tests and Coverage"
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          persist-credentials: false
      - name: Reconfigure git to use HTTP authentication
        run: >
          git config --global url."https://github.com/".insteadOf
          ssh://git@github.com/
      - uses: actions/setup-node@v1
        with:
          node-version: 14.x
      - run: npm ci
      - run: npm run build
      - run: npm test
      - run: npm run coverage

      # - name: Upload coverage to Codecov
      #   uses: codecov/codecov-action@v1
      #   with:
      #     token: ${{ secrets.CODECOV_TOKEN }}
      #     file: ./coverage.json
      #     flags: unittests
      #     name: codecov-umbrella
      #     fail_ci_if_error: true
