image: "hseeberger/scala-sbt:17.0.1_1.6.1_3.1.0"

variables:
  SBT_OPTS: "-Dsbt.global.base=sbt-cache/sbtboot -Dsbt.boot.directory=sbt-cache/boot -Dsbt.ivy.home=sbt-cache/ivy"

cache:
  untracked: true
  paths:
    - "sbt-cache/ivy/cache"
    - "sbt-cache/boot"
    - "sbt-cache/sbtboot"
    - "sbt-cache/target"

init:
  script:
    - sbt version

build:
  needs: [init]
  script:
    - sbt compile

update:
  needs: [init]
  allow_failure: true
  only:
    refs:
      - main
  script:
    - sbt "set dependencyUpdatesFailBuild := true" dependencyUpdates

format:
  needs: [init]
  script:
    - sbt scalafmtCheck

# test:
#   needs: [build]
#   script:
#     - sbt test
