I am trying to make my first gitlab ci pipeline with sbt. i am trying to make build and test stages.
the problem is that although i compile the project at build, it compiles again at test stage before running the tests.
can someone help me to understand why this is happening and how to solve it?
sbt version: 1.2.7
this is my gitlab-ci.yml file:
image: docker-registry:5000/sbt-docker:latest
variables:
SBT_OPTS: "-Dsbt.global.base=sbt-cache/sbtboot -Dsbt.boot.directory=sbt-cache/boot -Dsbt.ivy.home=sbt-cache/ivy Dsbt.coursier.home=sbt-cache/coursier -Dsbt.io.jdktimestamps=true"
COURSIER_CACHE: sbt-cache/coursier
stages:
- build
- test
cache:
paths:
- "sbt-cache/ivy/cache"
- "sbt-cache/boot"
- "sbt-cache/sbtboot"
- "sbt-cache/coursier"
build:
stage: build
script:
- sbt -J-Xmx2G clean core/compile core/package
artifacts:
untracked: true
paths:
- "target/"
test:
stage: test
dependencies:
- build
script:
- sbt core/test
allow_failure: true
untracked
andpaths
keys seem incorrectly indented. Is that just a copy-n-paste issue? – cbleysbt core/test
in your second stage, it probably doesn't see thetarget/
directory from your first stage, so it compiles sources again from scratch. You'd need to find a way to pass this directory to the next stage, using artifacts and dependencies. – Etienne Neveu