Last active
April 5, 2020 01:18
-
-
Save davegurnell/4a5fcca48e08e080ac613480947830f0 to your computer and use it in GitHub Desktop.
Minimal CircleCI 2.0 Scala build configuration with caching of Ivy/Maven dependencies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2 | |
jobs: | |
build: | |
docker: | |
- image: circleci/openjdk:8-jdk | |
steps: | |
- checkout | |
- restore_cache: | |
key: scala-library-dependencies-{{ checksum "build.sbt" }} | |
- run: sbt test:compile | |
- save_cache: | |
paths: [ "~/.m2", "~/.ivy2", "~/.cache/coursier" ] | |
key: scala-library-dependencies-{{ checksum "build.sbt" }} | |
- run: sbt test |
what about cache of the sbt launcher itself?
I came up with:
version: 2
jobs:
build:
docker:
- image: circleci/openjdk:8-jdk
working_directory: ~/repo
environment:
JVM_OPTS: -Xmx3200m
TERM: dumb
steps:
- checkout
- restore_cache:
keys:
- sbt-scala-cache-{{ checksum "build.sbt" }}
- run: sbt clean test:compile
- save_cache:
paths: ["/home/circleci/.m2", "/home/circleci/.ivy2/cache", "/home/circleci/.coursier/cache", "/home/circleci/.sbt/launchers", "/home/circleci/.cache/coursier"]
key: sbt-scala-cache-{{ checksum "build.sbt" }}
- run: sbt test
This caches all the libs and the sbt launcher.
~/.cache/coursier
-> ~/.coursier/cache
?
~/.cache/coursier
is correct
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note. You may need to add this to your
build.sbt
to work around some weird filesystem restriction:See here for information: https://stackoverflow.com/questions/45022231/getting-file-name-too-long-when-running-tests-on-circleci