soluble-io/cache-interop

View on GitHub
.github/workflows/ci.yml

Summary

Maintainability
Test Coverage
name: CI

on:
  push:
    branches: [main, dev]

  pull_request:
    types: [opened, synchronize, reopened]

jobs:
  test:
    # containers must run in Linux based operating systems
    runs-on: ubuntu-latest
    timeout-minutes: 15

    strategy:
      matrix:
        node-version: [14.x, 16.x, 18.x, 20.x]
    steps:
      - uses: actions/checkout@v3
        with:
          # This allows yarn workspaces --since to compare with origin/main branch
          fetch-depth: 0

      - name: โš™๏ธ Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}

      - name: ๐Ÿ“ฅ Monorepo install
        uses: ./.github/actions/yarn-nm-install

      - name: โ™ป๏ธ Restore packages cache
        uses: actions/cache@v3
        with:
          path: |
            ${{ github.workspace }}/.cache
            ${{ github.workspace }}/**/tsconfig.tsbuildinfo
          key: ${{ runner.os }}-dx-${{ hashFiles('**/yarn.lock') }}

      - name: List changed workspaces
        run: yarn workspaces list --since --recursive --json

      - name: ๐Ÿ”ฌ ESLint checks
        run: |
          yarn workspaces foreach --from 'packages/*' -v run lint

      - name: ๐Ÿ•ต๏ธ Typecheck
        run: |
          yarn workspaces foreach --from 'packages/*' -v run typecheck

      - name: ๐Ÿ— Build packages
        # Till https://github.com/atlassian/changesets/issues/432 has a solution we can remove the
        # build-release and replace with a regular build command
        run: |
          yarn workspaces foreach --from 'packages/*' -tv run build-release

      - name: ๐Ÿ“ Check build for size-limits
        run: |
          yarn workspaces foreach -v run size-limit

      - name: ๐Ÿ›Ÿ Check build for ecmascript compliance
        if: matrix.node-version == '18.x'
        run: |
          yarn workspaces foreach -v run check-dist

      - name: ๐Ÿ›Ÿ Check publishable dist  (publint)
        if: matrix.node-version == '18.x'
        run: yarn workspaces foreach -tv --from 'packages/*' --no-private run check-pub

      - name: ๐Ÿงช Unit tests
        run: |
          yarn workspaces foreach -tv --from 'packages/*' run test-unit --coverage
        env:
          CI: true

      - name: ๐Ÿงช E2E tests
        run: |
          yarn g:test-e2e --coverage
        env:
          CI: true

      - name: โ˜‚๏ธ Codecov upload
        working-directory: ${{ github.workspace }}
        if: matrix.node-version == '18.x'
        run: |
          bash .github/scripts/install-codecov.sh
          yarn g:ci-coverage-upload
        shell: bash