remirror/remirror

View on GitHub
.github/workflows/ci.yml

Summary

Maintainability
Test Coverage
name: ci

on:
  schedule:
    - cron: '0 0 * * *'

  push:
    branches:
      - main
      - v3

  pull_request:
    branches:
      - main
      - v3

env:
  TURBO_TOKEN: ${{ secrets.VERCEL_STORYBOOK_TOKEN }}
  TURBO_TEAM: ${{ vars.TURBO_TEAM }}

jobs:
  # Lint the project
  lint:
    timeout-minutes: 50
    runs-on: ubuntu-latest
    steps:
      - name: checkout code repository
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: install and audit
        uses: ./support/actions/pnpm

      - name: check css
        run: pnpm run lint:css

      - name: check TS / JS files
        run: pnpm run lint:es -f github

      - name: check markdown code blocks
        run: pnpm run lint:md -f github

      - name: check formatting
        run: pnpm run lint:prettier

      - name: check repo and versions
        run: pnpm run lint:repo

  # Typecheck the project
  typecheck:
    timeout-minutes: 50
    runs-on: ubuntu-latest
    steps:
      - name: checkout code repository
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: install and audit
        uses: ./support/actions/pnpm

      - name: typecheck project
        run: pnpm typecheck

  # Unit test
  unit_test:
    timeout-minutes: 50
    runs-on: ubuntu-latest
    steps:
      - name: checkout code repository
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: install and audit
        uses: ./support/actions/pnpm

      - name: run unit tests (part 1)
        run: pnpm test -- --shard=1/3

      - name: run unit tests (part 2)
        run: pnpm test -- --shard=2/3

      - name: run unit tests (part 3)
        run: pnpm test -- --shard=3/3

      # - name: publish code coverage report
      #   uses: paambaati/codeclimate-action@v2.7.5
      #   if: github.ref == 'refs/heads/main'
      #   env:
      #     CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
      #   with:
      #     coverageCommand: 'echo Coverage'
      #     debug: false

  # Build the project and run tests on built files.
  build_test:
    timeout-minutes: 50
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [18.x, 20.x]
      fail-fast: false

    steps:
      - name: checkout code repository
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: install and audit
        uses: ./support/actions/pnpm
        with:
          node-version: ${{ matrix.node-version }}

      - name: build project
        run: pnpm build

      - name: run unit tests with built code
        run: pnpm test:build

  # Check that package sizes are within their boundaries
  size_check:
    timeout-minutes: 50
    runs-on: ubuntu-latest
    steps:
      - name: checkout code repository
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: install and audit
        uses: ./support/actions/pnpm

      - name: build project
        run: pnpm build

      - name: check sizes
        run: pnpm size