belsrc/worker-promise

View on GitHub
.github/workflows/build-check.yml

Summary

Maintainability
Test Coverage
name: build-check

on:
  # trigger on PRs.
  # `opened` is when the PR is opend
  # `synchronize` is when any additional pushes are made to the PR
  pull_request:
    types: [opened, synchronize]

  # trigger on branch push
  # only trigger on pushes to the `master` and `develop` branches (this also means PR merges)
  # we can also ignore them if they only contain documentation changes
  push:
    branches:
      - master
      - develop
    paths-ignore:
      - 'docs/**'
      - '**.md'

jobs:
  # If the job does NOT have any `needs` jobs, then they are ran in parallel
  # Run ESLint over the code base
  lint:
    runs-on: ubuntu-latest
    steps:
      - name: Git Checkout
        uses: actions/checkout@v2
      - name: Setup Node
        uses: actions/setup-node@v1
        with:
          node-version: 10
      - name: Install Yarn
        run: npm i -g yarn
      - name: Install Packages
        run: yarn install
      - name: Run Linter
        run: yarn run lint:ci

  # Run all of the unit tests
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Git Checkout
        uses: actions/checkout@v2
      - name: Setup Node
        uses: actions/setup-node@v1
        with:
          node-version: 10
      - name: Install Yarn
        run: npm i -g yarn
      - name: Install Packages
        run: yarn install
      - name: Run Unit Tests
        run: yarn run coverage
      - name: Upload coverage to CodeClimate
        run: |
          export GIT_BRANCH="${GITHUB_REF/refs\/heads\//}"
          curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
          chmod +x ./cc-test-reporter
          ./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}}

  analyze:
    runs-on: ubuntu-latest
    steps:
      # We must fetch at least the immediate parents so that if this is
      # a pull request then we can checkout the head.
      - name: Git Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 2
      # If this run was triggered by a pull request event, then checkout
      # the head of the pull request instead of the merge commit.
      - run: git checkout HEAD^2
        if: ${{ github.event_name == 'pull_request' }}
      - name: Initialize CodeQL
        uses: github/codeql-action/init@v1
        with:
          languages: javascript
      - name: Perform CodeQL Analysis
        uses: github/codeql-action/analyze@v1

  # If `lint` and `test` pass (this is the `needs` line)
  # then check the actual compiling
  build:
    needs: [test, lint, analyze]
    runs-on: ubuntu-latest
    steps:
      - name: Git Checkout
        uses: actions/checkout@v2
      - name: Setup Node
        uses: actions/setup-node@v1
        with:
          node-version: 10
      - name: Install Yarn
        run: npm i -g yarn
      - name: Install Packages
        run: yarn install
      - name: Run Build
        run: yarn run build