name: 'Run tests + checks'

on:
  pull_request:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: 'Install docker-compose'
        uses: KengoTODA/actions-setup-docker-compose@main
        with:
          version: '1.29.2'
      - name: 'Checkout'
        uses: actions/checkout@v2
      - name: Read .nvmrc
        id: nvmrc
        run: echo "##[set-output name=NODE_VERSION;]$(cat .nvmrc)"
      - name: 'Set up node'
        uses: actions/setup-node@v2
        with:
          node-version: "${{ steps.nvmrc.outputs.NODE_VERSION }}"
      - name: 'Install node modules'
        run: npm ci
        env:
          NPM_TOKEN: ${{secrets.NPM_TOKEN}}
      - name: 'Check lint'
        run: npm run lint
        env:
          NPM_TOKEN: ${{secrets.NPM_TOKEN}}
      - name: 'Run tests E2E'
        run: npm run test:e2e
        env:
          NPM_TOKEN: ${{secrets.NPM_TOKEN}}
      - name: 'Check build'
        run: npm run build
        env:
          NPM_TOKEN: ${{secrets.NPM_TOKEN}}
