evandcoleman/node-appletv

View on GitHub
.github/workflows/tests.yml

Summary

Maintainability
Test Coverage
name: Tests

on: [push]

jobs:
  test:
    runs-on: ${{ matrix.platform }}
    strategy:
      matrix:
        platform: [ubuntu-latest]
        node-version: [8.x, 10.x]
    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - name: Cache node modules
      uses: actions/cache@v1
      env:
        cache-name: cache-node-modules
      with:
        path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
        key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
        restore-keys: |
          ${{ runner.os }}-build-${{ env.cache-name }}-
          ${{ runner.os }}-build-
          ${{ runner.os }}-
    - run: sudo apt-get install libavahi-compat-libdnssd-dev
    - run: npm install
    - run: |
        if [ ! -f ./coverage/cc-test-reporter ]; then
          mkdir -p coverage/
          curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./coverage/cc-test-reporter
          chmod +x ./coverage/cc-test-reporter
        fi
      name: Install code climate reporter
    - run: ./coverage/cc-test-reporter before-build
      env:
        CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
    - run: npm run build --if-present
    - run: npm run coverage
      name: Run tests
    - run: |
        ./coverage/cc-test-reporter format-coverage -t lcov -o ./coverage/coverage.json ./coverage/lcov.info
        ./coverage/cc-test-reporter upload-coverage -i ./coverage/coverage.json
      name: Upload to code climate
      env:
        CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}