This action handles the setup and teardown of a RavenDB database.
This action does not provision WSL or Docker itself. On Windows runners it requires setup-wsl-action to run first in the same job. That action provisions WSL2 and Docker, keeps the instance alive, and exports the WSL_DISTRIBUTION, WSL_IP, and WSL_TOOLS_MODULE_PATH environment variables this action relies on. On Linux runners setup-wsl-action is a no-op but should still be included so the workflow is uniform.
If setup-wsl-action has not run, the action fails fast with a clear error.
See action.yml
steps:
- name: Setup WSL
uses: Particular/setup-wsl-action@v1
- name: Setup RavenDB
uses: Particular/setup-ravendb-action@v1.0.0
with:
single-connection-string-name: <my connection string name for the single node>
cluster-connection-string-name: <my connection string name for the cluster nodes>
ravendb-license: <Single Line JSON License String>
ravendb-version: <RavenDB Container Tag Name>
ravendb-mode: <RavenDB Server Mode>
registry-login-server: index.docker.io
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
registry-password: ${{ secrets.DOCKERHUB_TOKEN }}ravendb-license is required. ravendb-mode defaults to Single.
For logging into a container registry when running on Windows:
registry-login-serverdefaults toindex.docker.ioand is not required if logging into Docker Hub.registry-usernameandregistry-passwordare optional and will result in pulling the container anonymously if omitted.
On Linux runners the RavenDB container runs directly through Docker. On Windows runners the Linux RavenDB container runs inside WSL2 provisioned by setup-wsl-action. Run it first, see Prerequisites.
The scripts and documentation in this project are released under the MIT License.
Open the folder in Visual Studio Code. If you don't already have them, you will be prompted to install remote development extensions. After installing them, and re-opening the folder in a container, do the following:
Run the npm installation
npm installWhen changing index.mjs, either run npm run dev beforehand, which will watch the file for changes and automatically compile it, or run npm run prepare afterwards.
To test the setup action add a new .env.setup file in the root directory with the following content
# Input overrides
INPUT_SINGLE_CONNECTION-STRING-NAME=RavenDBConnectionString
INPUT_CLUSTER_CONNECTION-STRING-NAME=RavenDBClusterConnectionString
INPUT_RAVENDB_LICENSE=...
INPUT_WHATEVER_ELSE_YOU_NEED_TO_OVERRIDE=...
# Runner overrides
# Use LINUX to run on Linux
RUNNER_OS=WINDOWSthen execute the script
node -r dotenv/config dist/index.mjs dotenv_config_path=.env.setupTo test the cleanup action add a .env.cleanup file in the root directory with the following content
# State overrides
STATE_IsPost=true
STATE_containerName=nameOfPreviouslyCreatedContainer
STATE_ravenMode=nameOfPreviouslyUsedModenode -r dotenv/config dist/index.mjs dotenv_config_path=.env.cleanupTo test the setup action set the required environment variables and execute setup.ps1 with the desired parameters.
$Env:RUNNER_OS=Windows
.\setup.ps1 -ScriptDirectory . -ContainerName psw-ravendb-1 -SingleConnectionStringName RavenDBConnectionString -ClusterConnectionStringName RavenDBConnectionString -RavenDBLicense 'SingleLineJSON' -RavenDBVersion "6.2" -RavenDBMode "Single"To test the cleanup action set the required environment variables and execute cleanup.ps1 with the desired parameters.
$Env:RUNNER_OS=Windows
.\cleanup.ps1 -ScriptDirectory . -ContainerName psw-ravendb-1 -RavenDBMode "Single"Running
setup.ps1/cleanup.ps1directly on Windows requiresWSL_TOOLS_MODULE_PATHto point at setup-wsl-action'sWslToolsmodule (set it by running setup-wsl-action first).