tuplo/unhandler

View on GitHub
.github/workflows/build.yml

Summary

Maintainability
Test Coverage
name: build
on:
  push:
    branches:
      - main

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [16.x, 18.x, 20.x]
    steps:
      - uses: actions/checkout@main
        with:
          fetch-depth: "0"
      - uses: actions/cache@main
        with:
          path: node_modules
          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
      - run: |
          npm ci
          npm run lint
          # npm run lint:ts
          npm run test:ci

  test-coverage:
    needs: test
    name: test-coverage
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@main
        with:
          fetch-depth: "0"
      - uses: actions/setup-node@main
        with:
          node-version: 20
      - uses: actions/cache@main
        with:
          path: node_modules
          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
      - run: |
          npm ci
      - uses: paambaati/codeclimate-action@v2.7.2
        env:
          CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
        with:
          coverageCommand: npm run coverage
          debug: true

  publish-to-npm:
    needs: test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@main
        with:
          fetch-depth: "0"
      - uses: actions/setup-node@main
        with:
          node-version: 20
          registry-url: https://registry.npmjs.org/
      - uses: actions/cache@main
        with:
          path: node_modules
          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
      - run: |
          npm ci
          npm run build
      - name: Semantic Release
        uses: cycjimmy/semantic-release-action@main
        with:
          branch: main
        env:
          GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
          NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}