name: CI
on:
  push:
    branches:
      - main 
  pull_request:
    branches:
      - main 
jobs:
  unit:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Scaladex
        uses: actions/checkout@v2
        with:
          path: scaladex
      - name: Checkout Scaladex small index
        uses: actions/checkout@v2
        with:
          repository: scalacenter/scaladex-small-index
          path: scaladex-small-index
      - name: Checkout Scaladex contrib 
        uses: actions/checkout@v2
        with:
          repository: scalacenter/scaladex-contrib
          path: scaladex-contrib
      - uses: olafurpg/setup-scala@v10
        with:
          java-version: "adopt@1.8"
      - uses: coursier/cache-action@v5
      - name: Formatting
        run: |
          cd scaladex
          ./bin/scalafmt --test      
        shell: bash
      - name: Load elastic search
        run: |
          cd scaladex
          sbt "data/run elastic"      
        shell: bash
      - name: Unit tests
        run: |
          cd scaladex
          sbt test      
        shell: bash
      - name: Package server
        run: |
          cd scaladex
          sbt server/universal:packageBin
        shell: bash

name: CI
on:
  push:
    branches:
      - main 
  pull_request:
    branches:
      - main 
jobs:
  unit:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Scaladex
        uses: actions/checkout@v2
        with:
          path: scaladex
      - name: Checkout Scaladex small index
        uses: actions/checkout@v2
        with:
          repository: scalacenter/scaladex-small-index
          path: scaladex-small-index
      - name: Checkout Scaladex contrib 
        uses: actions/checkout@v2
        with:
          repository: scalacenter/scaladex-contrib
          path: scaladex-contrib
      - uses: laughedelic/coursier-setup@v1
        with:
          jvm: "adopt:1.8"
      - uses: coursier/cache-action@v5
      - name: Formatting
        run: |
          cd scaladex
          ./bin/scalafmt --test      
        shell: bash
      - name: Load elastic search
        run: |
          cd scaladex
          sbtn "data/run elastic"      
        shell: bash
      - name: Unit tests
        run: |
          cd scaladex
          sbtn test      
        shell: bash
      - name: Package server
        run: |
          cd scaladex
          sbtn server/universal:packageBin
        shell: bash

Use sbtn in CI to load sbt once
Use sbtn in CI to load sbt once
