masnagam/wd-runjs

View on GitHub
.github/workflows/ci.yml

Summary

Maintainability
Test Coverage
name: CI

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  test:
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest]
        node-version: ['12', '14']
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - name: npm install, build, and test
        run: |
          npm ci
          npm run build --if-present
          npm test
        env:
          CI: true
  auto-merge:
    if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
    needs:
      - test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/github-script@v2
        with:
          github-token: ${{secrets.GH_TOKEN}}
          script: |
            await github.pulls.createReview({
              owner: context.payload.repository.owner.login,
              repo: context.payload.repository.name,
              pull_number: context.payload.pull_request.number,
              event: 'APPROVE'
            })
            await github.pulls.merge({
              owner: context.payload.repository.owner.login,
              repo: context.payload.repository.name,
              pull_number: context.payload.pull_request.number
            })
  coverage:
    if: github.event_name == 'push'
    needs:
      - test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
      - run: |
          npm ci
          npm run build --if-present
        env:
          CI: true
      - uses: paambaati/codeclimate-action@v2.6.0
        with:
          coverageCommand: npm test
        env:
          CC_TEST_REPORTER_ID: c7c8db9e1cf497607caf14d5f0072ac4376d1ef2e97e71acdabcf0400014fbed