name: lint-test
on: [push]

jobs:
  lint-test:
    strategy:
      matrix:
        os: [ubuntu-latest]
        node: [14]
    runs-on: ${{ matrix.os }}
    env:
      CI: true
    steps:
      - uses: actions/checkout@v2
      - name: Node.js ${{ matrix.node }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node }}
      - name: Get yarn cache directory path
        id: yarn-cache-dir-path
        run: echo "::set-output name=dir::$(yarn cache dir)"
      - name: Cache node_modules
        uses: actions/cache@v2
        id: yarn-cache
        with:
          path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
          key:
            ${{ runner.os }}-yarn-${{ matrix.node }}-${{ hashFiles('yarn.lock')
            }}
          restore-keys: |
            ${{ runner.os }}-yarn-${{ matrix.node }}-
            ${{ runner.os }}-yarn-
      - run: |
          yarn
          yarn lbu docker up
          yarn lbu lint
          yarn lbu migrate
          yarn lbu test
          yarn lbu docker clean
