name: "Build"

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  build:
    name: Test build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Get yarn cache directory path
        id: yarn-cache-dir-path
        run: echo "::set-output name=dir::$(yarn cache dir)"
      
      - uses: actions/cache@v2
        with:
          path: '**/node_modules'
          key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

      - name: Setup Node
        uses: actions/setup-node@v2
        with:
          node-version: '14'

      - name: Install dependencies
        if: steps.yarn-cache.outputs.cache-hit != 'true'
        run: yarn install

      # Using TSC instead of microbundle because it detects the same errors and is alot quicker
      - name: Build
        run: tsc
