acuminous/twiki-gherkish-feature-parser

View on GitHub
.github/workflows/node-js-ci.yml

Summary

Maintainability
Test Coverage
name: Node.js CI

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [14.x, 16.x, 18.x]
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node-version }}
      - name: Cache Dependencies
        uses: actions/cache@v3
        id: cache
        with:
          path: ./node_modules
          key: npm-${{ hashFiles('package-lock.json') }}
      - name: Install Dependencies
        if: steps.cache.outputs.cache-hit != 'true'
        run: npm ci --ignore-scripts
      - name: Lint
        run: npm run lint
      - name: Tests
        run: npm test

  code-climate:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v2
        with:
          node-version: "16.x"
      - name: Cache Dependencies
        uses: actions/cache@v3
        id: cache
        with:
          path: ./node_modules
          key: npm-${{ hashFiles('package-lock.json') }}
      - name: Install Dependencies
        if: steps.cache.outputs.cache-hit != 'true'
        run: npm ci --ignore-scripts
      - name: Code Climate
        run: |
          curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
          chmod +x ./cc-test-reporter
          ./cc-test-reporter before-build
          npm run coverage
          ./cc-test-reporter format-coverage -t lcov coverage/lcov.info
          ./cc-test-reporter upload-coverage
        env:
          CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}