wopian/kitsu

View on GitHub
.github/workflows/ci.yml

Summary

Maintainability
Test Coverage
name: CI

on: [push, pull_request]

env:
  FORCE_COLOR: true

jobs:
  test:
    name: Test (${{ matrix.node_version}}-${{ matrix.os }})

    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        node_version: [14, 16, 18]
        os: [ubuntu-latest]

    steps:
    - name: Checkout repository
      uses: actions/checkout@v4

    - name: Use node ${{ matrix.node_version }}
      uses: actions/setup-node@v4
      with:
        node-version: ${{ matrix.node_version }}

    - name: Restore cache
      uses: actions/cache@v4
      with:
        path: |
          node_modules
          */*/node_modules
        key: ${{ matrix.os }}-${{ matrix.node_version}}-yarn-${{ hashFiles('**/yarn.lock') }}
        restore-keys: ${{ matrix.os }}-${{ matrix.node_version }}-yarn-

    - name: Install yarn dependencies
      run: yarn install

    - name: Bootstrap lerna packages
      run: yarn bootstrap

    - name: Lint source code
      run: yarn lint
      if: ${{ matrix.node_version == 18 }}

    - name: Jest with code coverage
      if: ${{ matrix.node_version == 18 }}
      run: yarn test:coverage

    - name: Jest
      if: ${{ matrix.node_version != 18 }}
      run: yarn jest

    - name: Upload test coverage to Code Climate
      if: ${{ matrix.node_version == 18 }}
      uses: paambaati/codeclimate-action@v6.0.0
      env:
        CC_TEST_REPORTER_ID: 7a4b78747587abb295ccb41439d7d067b9de2d885a766e7e88d5e8409599d2ea

  build:
    name: Build (${{ matrix.node_version}}-${{ matrix.os }})
    needs: test

    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        node_version: [18]
        os: [ubuntu-latest]

    steps:
    - name: Checkout repository
      uses: actions/checkout@v4

    - name: Use node ${{ matrix.node_version }}
      uses: actions/setup-node@v4
      with:
        node-version: ${{ matrix.node_version }}

    - name: Restore cache
      uses: actions/cache@v4
      with:
        path: |
          node_modules
          */*/node_modules
        key: ${{ matrix.os }}-${{ matrix.node_version}}-yarn-${{ hashFiles('**/yarn.lock') }}
        restore-keys: ${{ matrix.os }}-${{ matrix.node_version }}-yarn-

    - name: Install yarn dependencies
      run: yarn install

    - name: Bootstrap lerna packages
      run: yarn bootstrap

    - name: Build lerna packages
      run: yarn build

    - name: Lint package sizes
      run: yarn size