vinicius73/vue-page-title

View on GitHub
.github/workflows/tests.yml

Summary

Maintainability
Test Coverage
name: Tests

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

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node: [16, 18]
    name: Test Node v${{ matrix.node }}
    steps:
      - name: ๐Ÿ“ฅโ€‹ Checkout
        uses: actions/checkout@v3

      - name: ๐Ÿช„ Setup Node
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node }}
          cache: 'yarn'

      - name: ๐Ÿ“ฆ Install dependencies
        run: yarn install

      - name: ๐Ÿ—๏ธ Build
        run: yarn run build

      - name: ๐Ÿงช Tests
        run: yarn run test

      - name: ๐ŸŽจ ESLint
        run: |
          yarn run lint || (echo "##[error] found lint errors. please 'yarn run lint --fix'" \
                 "and fix all errors" \
            && exit 1)

      - name: ๐ŸŽจ Format
        run: |
          yarn run format:check || (echo "##[error] found unformatted files. please 'yarn run format'" \
                 "and check in all changes" \
            && exit 1)

      - name: ๐Ÿ—๏ธ Example build
        run: yarn run build:doc

  summary:
    runs-on: ubuntu-latest
    needs: test
    if: always()
    name: test-summary
    steps:
      - name: Summary status
        run: if ${{ needs.test.result != 'success' && needs.test.result != 'skipped' }}; then exit 1; fi

  coverage:
    needs: summary
    name: coverage
    runs-on: ubuntu-latest
    if: ${{ github.event_name == 'push' }}
    steps:
      - name: ๐Ÿ“ฅโ€‹ Checkout
        uses: actions/checkout@v3

      - name: ๐Ÿช„ Setup Node
        uses: actions/setup-node@v3
        with:
          node-version: 16
          cache: 'yarn'

      - name: ๐Ÿ“ฆ Install dependencies
        run: yarn install

      - name: ๐Ÿ—‚๏ธ Collect coverage
        uses: paambaati/codeclimate-action@v3.0.0
        env:
          CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
        with:
          coverageCommand: yarn test --coverage