visible/visible

View on GitHub
.github/workflows/ci.yml

Summary

Maintainability
Test Coverage
name: CI

on:
  push:
    branches:
      - main
      - develop
  pull_request:
    branches:
      - '*'

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [12.x]

    steps:
      - uses: actions/checkout@v2

      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v2.5.1
        with:
          node-version: ${{ matrix.node-version }}

      # - name: Get yarn cache directory path
      #   id: yarn-cache-dir-path
      #   run: echo "::set-output name=dir::$(yarn cache dir)"

      # - uses: actions/cache@v2.1.7
      #   id: yarn-cache
      #   with:
      #     path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
      #     key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
      #     restore-keys: |
      #       ${{ runner.os }}-yarn-

      # https://dev.to/mpocock1/how-to-cache-nodemodules-in-github-actions-with-yarn-24e
      - name: Restore Yarn dependencies
        uses: actions/cache@v2.1.7
        with:
          path: '**/node_modules'
          key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

      - name: Restore Linter Caches
        uses: actions/cache@v2.1.7
        with:
          path: |
            .eslintcache
            .stylelintcache
          key: ${{ runner.os }}-eslint-${{ hashFiles('**/yarn.lock') }}

      # https://github.com/zeit/next.js/blob/master/errors/no-cache.md
      - name: Restore .next/cache
        uses: actions/cache@v2.1.7
        with:
          path: ${{ github.workspace }}/packages/@visi/web-client/.next/cache
          key: ${{ runner.os }}-next-${{ hashFiles('**/yarn.lock') }}
          restore-keys: |
            ${{ runner.os }}-next-

      - name: Install dependencies
        run: yarn --frozen-lockfile

      - name: Build
        run: yarn run build

      - name: Lint
        run: yarn run lint

      - name: Test
        run: yarn run test

      - name: Codecov
        uses: codecov/codecov-action@v2.1.0
        with:
          token: ${{ secrets.CODECOV_TOKEN }}