name: Node.js CI
on: push

jobs:

  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [8.x, 10.x, 12.x]

    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - run: yarn install
      - run: yarn run lint
      - run:  yarn run test
        env:
          CI: true

name: Node.js CI
on: push

jobs:

  build:

    runs-on: ubuntu-latest

    steps:

      - uses: actions/checkout@v2

      - uses: actions/setup-node@v1
        with:
          node-version: 12.x

      - name: Install
        run: yarn install

      - name: Build & Code analysis
        run: yarn run lint

      - name: Build
        run: yarn run build

      - name: Upload build
        uses: actions/upload-artifact@v2
        with:
          name: build
          path: |
            lib/**/*.js
            lib/**/*.js.map
            lib/**/*.d.ts
            test/**/*.js
            test/**/*.js.map

  test:

    runs-on: ubuntu-latest

    needs: build

    strategy:
      matrix:
        node-version: [8.x, 10.x, 12.x]

    steps:

      - uses: actions/checkout@v2

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

      - name: Install
        run: yarn install

      - name: Download build
        uses: actions/download-artifact@v2
        with:
          name: build

      - name: Test with Node.js ${{ matrix.node-version }}
        run: yarn run test
        env:
          CI: true

Split build from unit test step
Split build from unit test step
