I have a play 2.4.x project. I would like to use gitlab to do CI.
How can I run tests in ci.gitlab.com?
My gitbal-ci.yml
file looks like the following but its obviously wrong.
tests:
script: "apt-get install -y sbt && sbt test"
I get the error
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package sbt
You can use directly an SBT
image.
This gitbal-ci.yml
worked in my case (handles also caching):
image: "sbtscala/scala-sbt:17.0.2_1.6.2_3.1.3"
variables:
SBT_VERSION: "1.2.8"
SBT_OPTS: "-Dsbt.global.base=sbt-cache/.sbtboot -Dsbt.boot.directory=sbt-cache/.boot -Dsbt.ivy.home=sbt-cache/.ivy"
cache:
key: "$CI_BUILD_REF_NAME" # contains either the branch or the tag, so it's caching per branch
untracked: true
paths:
- "sbt-cache/.ivy.cache"
- "sbt-cache/.boot"
- "sbt-cache/.sbtboot"
- "sbt-cache/target"
stages:
- test
test:
script:
- sbt test
This is from: Stackoverflow Answer
To install sbt on a Debian based distribution, you have to run the following steps
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 642AC823
sudo apt-get update
sudo apt-get install sbt
See the official sbt documentation for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With