diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2019-05-20 07:17:49 +0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2019-05-20 07:17:49 +0800 |
commit | d12a0d762193d83f83c837eb4affad389744a6cd (patch) | |
tree | 3c26c7dfff35b27b843cdc6175fe05c53f930b76 /docs | |
parent | 827c72af63fdfd3ee6e4ed0e18a3e5a42e2c0c1c (diff) | |
parent | 1cb439fce4af7a61166f13a3c5045fa7c73b25de (diff) | |
download | mill-d12a0d762193d83f83c837eb4affad389744a6cd.tar.gz mill-d12a0d762193d83f83c837eb4affad389744a6cd.tar.bz2 mill-d12a0d762193d83f83c837eb4affad389744a6cd.zip |
Merge branch '599'
Diffstat (limited to 'docs')
-rw-r--r-- | docs/pages/9 - Contrib Modules.md | 88 |
1 files changed, 87 insertions, 1 deletions
diff --git a/docs/pages/9 - Contrib Modules.md b/docs/pages/9 - Contrib Modules.md index eca61be3..36eb40ef 100644 --- a/docs/pages/9 - Contrib Modules.md +++ b/docs/pages/9 - Contrib Modules.md @@ -99,6 +99,50 @@ object project extends BuildInfo { * `def buildInfoPackageName: Option[String]`, default: `None` The package name of the object. +### Docker + +Automatically build docker images from your mill project. + +Requires the docker CLI to be installed. + +In the simplest configuration just extend `DockerModule` and declare a `DockerConfig` object. + +```scala +import mill._, scalalib._ + +import ivy`com.lihaoyi::mill-contrib-docker:VERSION` +import contrib.docker.DockerModule + +object foo extends JavaModule with DockerModule { + object docker extends DockerConfig +} +``` + +Then + +``` +$ mill foo.docker.build +$ docker run foo +``` + +#### Configuration + +Configure the image by overriding tasks in the `DockerConfig` object + +```scala +object docker extends DockerConfig { + // Override tags to set the output image name + def tags = List("aws_account_id.dkr.ecr.region.amazonaws.com/hello-repository") + + def baseImage = "openjdk:11" + + // Configure whether the docker build should check the remote registry for a new version of the base image before building. + // By default this is true if the base image is using a latest tag + def pullBaseImage = true +} +``` + +Run mill in interactive mode to see the docker client output, like `mill -i foo.docker.build`. ## Flyway @@ -543,6 +587,49 @@ object example extends ScalaPBModule { } ``` + +## Scoverage + +This module allows you to generate code coverage reports for Scala projects with +[Scoverage](https://github.com/scoverage) via the +[scalac-scoverage-plugin](https://github.com/scoverage/scalac-scoverage-plugin). + +To declare a module for which you want to generate coverage reports you can +extends the `mill.contrib.scoverage.ScoverageModule` trait when defining your +module. Additionally, you must define a submodule that extends the +`ScoverageTests` trait that belongs to your instance of `ScoverageModule`. + +```scala +// You have to replace VERSION +import $ivy.`com.lihaoyi::mill-contrib-buildinfo:VERSION` +import mill.contrib.scoverage.ScoverageModule + +object foo extends ScoverageModule { + def scalaVersion = "2.11.8" + def scoverageVersion = "1.3.1" + + object test extends ScoverageTests { + def ivyDeps = Agg(ivy"org.scalatest::scalatest:3.0.5") + def testFrameworks = Seq("org.scalatest.tools.Framework") + } +} +``` + +In addition to the normal tasks available to your Scala module, Scoverage +modules introduce a few new tasks and changes the behavior of an existing one. + +``` +mill foo.scoverage.compile # compiles your module with test instrumentation + # (you don't have to run this manually, running the test task will force its invocation) + +mill foo.test # tests your project and collects metrics on code coverage +mill foo.scoverage.htmlReport # uses the metrics collected by a previous test run to generate a coverage report in html format +``` + +The measurement data is available at `out/foo/scoverage/data/`, +and the html report is saved in `out/foo/scoverage/htmlReport/`. + + ## TestNG Provides support for [TestNG](https://testng.org/doc/index.html). @@ -722,4 +809,3 @@ These imports will always be added to every template. You don't need to list th ### Example There's an [example project](https://github.com/lihaoyi/cask/tree/master/example/twirl) - |