-
-
Notifications
You must be signed in to change notification settings - Fork 180
Running Boot on CI systems
CircleCI v2 uses Docker containers to run the tasks. This can result in faster builds and also lifts some limits of the previous environment, like problems in managing caching and inotify watch limits that have caused problems with Boot.
This example uses CircleCI Clojure image which provides additional tools over Clojure docker image. CircleCI image also provides versions with Node and browsers installed, which can be useful for testing Cljs.
version: 2
jobs:
build:
working_directory: ~/project
docker:
- image: circleci/clojure:boot-2.7.2
# Use boot-2.7.2-node-browsers for version with both Node and browsers (e.g. Chrome)
steps:
- checkout
- restore_cache:
key: project-{{checksum "boot.properties" }}-{{ checksum "build.boot" }}
- run: boot test
- save_cache:
paths:
- ~/.m2
- ~/.boot/cache/lib
- ~/.boot/cache/bin
key: project-{{checksum "boot.properties" }}-{{ checksum "build.boot" }}
environment:
BOOT_JVM_OPTIONS: "-Xms512m -Xmx1024m"
BOOT_WATCHERS_DISABLE: "yes"
Challenges
- Circle saves the cache after dependencies step so files downloaded in test step are not cached
- Solution: Run tests in dependencies step
- Boot sometimes uses over 4G memory when downloading deps
- Set
_JAVA_OPTIONS
- Set
- Boot creates fs watches for the source directories, and CircleCI limits this resource. You may get the error:
clojure.lang.ExceptionInfo: User limit of inotify watches reached
.- Set
BOOT_WATCHERS_DISABLE
to "yes" to disable Boot's watchers. N.B. this feature is only available in Boot 2.7.2-SNAPSHOT and later.
- Set
circle.yml
machine:
java:
version: oraclejdk8
environment:
# Boot sometimes uses over 4G when dowloading deps
# Limit could be higher probably, 2-3G?
_JAVA_OPTIONS: "-Xms512m -Xmx1024m"
BOOT_WATCHERS_DISABLE: "yes"
dependencies:
pre:
# Could use `latest` tag instead of version number
- curl -L https://github.com/boot-clj/boot-bin/releases/download/2.5.2/boot.sh -o ~/bin/boot
- chmod +x ~/bin/boot
override:
# Run tests here so everything loaded by test task is cached
- boot run-tests
cache_directories:
- "~/bin"
- "~/.m2"
- "~/.boot/cache/bin"
- "~/.boot/cache/lib"
test:
override:
# Nothing to run here
- echo 1
You could also define a deps
task in your build.boot
:
(deftask deps [])
and run boot deps
and boot test
in the dependencies and tests section overrides, respectively.
sudo: false
language: java
script: boot run-tests
install:
- mkdir -p ~/bin
- export PATH=~/bin:$PATH
# Could use `latest` tag instead of version number
- curl -L https://github.com/boot-clj/boot-bin/releases/download/2.5.2/boot.sh -o ~/bin/boot
- chmod +x ~/bin/boot
env:
matrix:
# Runs tests twice, using Clj 1.7 and 1.8
- BOOT_CLOJURE_VERSION=1.7.0
- BOOT_CLOJURE_VERSION=1.8.0
jdk:
- oraclejdk8
cache:
directories:
- $HOME/.m2
- $HOME/.boot/cache/bin
- $HOME/.boot/cache/lib
- $HOME/bin
You can find other developers and users in the #hoplon
channel on freenode IRC or the boot slack channel.
If you have questions or need help, please visit the Discourse site.
- Environments
- Boot environment
- Java environment
- Tasks
- Built-ins
- Third-party
- Tasks Options
- Filesets
- Target Directory
- Pods
- Boot Exceptions
- Configuring Boot
- Updating Boot
- Setting Clojure version
- JVM Options
- S3 Repositories
- Scripts
- Task Writer's Guide
- Require inside Tasks
- Boot for Leiningen Users
- Boot in Leiningen Projects
- Repl reloading
- Repository Credentials and Deploying
- Snippets
- Troubleshooting
- FAQ
- API docs
- Core
- Pod
- Util