name: CI

on: push

jobs:
  build:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: ["16.x"]

    steps:
      - uses: actions/checkout@v2

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

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

      - name: Use Yarn cache
        uses: actions/cache@v2
        id: yarn-cache
        with:
          path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
          key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}

      - name: Install dependencies
        run: yarn install --prefer-offline --frozen-lockfile

      - run: yarn test
