fabasoad/icq-notify-action

View on GitHub
.github/workflows/unit-tests.yml

Summary

Maintainability
Test Coverage
---
name: Unit Tests

on:  # yamllint disable-line rule:truthy
  pull_request: {}
  push:
    branches:
      - main

defaults:
  run:
    shell: sh

jobs:
  unit-tests:
    name: Unit tests
    timeout-minutes: 5
    runs-on: ubuntu-latest
    steps:
      - name: Checkout ${{ github.repository }}
        uses: actions/checkout@v4
      - name: Cache yarn dependencies
        id: yarn-cache
        uses: actions/cache@v4
        with:
          path: |
            .yarn/cache
            node_modules
          key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/.yarnrc.yml') }}
          restore-keys: |
            ${{ runner.os }}-yarn-
      - name: Compile
        if: ${{ steps.yarn-cache.outputs.cache-hit != 'true' }}
        run: yarn install
      - name: Unit tests
        if: github.ref != 'refs/heads/main'
        run: yarn test
      - name: Unit tests with coverage
        uses: paambaati/codeclimate-action@v6.0.0
        if: github.event_name == 'push' && github.ref == 'refs/heads/main'
        env:
          CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
        with:
          coverageCommand: yarn test
          debug: true