sbt-wix-embedded-mysql is sbt-plugin for wix-embedded-mysql
You can start and stop embedded MySQL on sbt task.
Add this to your project/plugins.sbt file:
project/plugins.sbt
Supported sbt version is 1.x.
resolvers += "Sonatype OSS Release Repository" at "https://oss.sonatype.org/content/repositories/releases/"
addSbtPlugin("com.chatwork" % "sbt-wix-embedded-mysql" % "1.0.11")
If you want default settings, no configuration is necessary. Please refer to here for sbt keys of the plugin.These sbt keys base on the API of wix-embedded-mysql. If you understand how to use wix-embedded-mysql, it is easy to use this plugin.
build.sbt
wixMySQLVersion := com.wix.mysql.distribution.Version.v8_latest
wixMySQLSchemaName := "your schema name"
wixMySQLUserName := Some("my-db-user")
wixMySQLPassword := Some("my-db-passwd")
You can use sbt tasks that the followings.
// start mysqld
> wixMySQLStart
// stop mysqld
> wixMySQLStop
build.sbt
Test / testOptions ++= Seq(
Tests.Setup { () =>
wixMySQLStart.value
// If you want to use the flywayMigrate together, please join the two tasks using `Def.sequential` as follows.
// Def.sequential(wixMySQLStart, flywayMigrate).value
},
Tests.Cleanup { () =>
wixMySQLStop.value
}
)
.github/workflows/ci.yml
# -- snip
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- uses: olafurpg/setup-scala@v12
with:
java-version: "[email protected]"
- uses: coursier/cache-action@v6
- run: |
sudo echo 'deb http://security.ubuntu.com/ubuntu xenial-security main' | sudo tee -a /etc/apt/sources.list
sudo apt-get update -qq
sudo apt-get install -y libaio1 libevent-dev libssl-dev libssl1.0.0
- run: sbt -v test
# -- snip
build.sbt
wixMySQLDownloadPath := Some(sys.env("HOME") + "/.wixMySQL/downloads"),
.github/workflows/ci.yml
# -- snip
steps:
- uses: actions/cache@v2
with:
path: |
~/.wixMySQL
# -- snip