CI Integration using Neurelo CLI
Last updated
Last updated
Testing is a critical step in the software development lifecycle. makes it really easy to set up a "CI" environment that can be used for testing purposes.
The first step to automating your testing process with Neurelo is to create a new "Machine User" for your Organization. This user will have access to all projects in your Organization, and can be removed at any time.
To create one,
Go to the
Click on the dropdown next to "Invite User" on the top right
Click "Create Machine User"
Set an identifier for your "Machine User" and click "Submit".
Once the "Machine User" has been created, you will be shown two pieces of information: the "client id" and the "client secret", make sure to store them safely and don't lose them, as the "client secret" won't be shown again.
This "client id" and "client secret" can now be used to authenticate the CLI and execute commands without any human interaction. For more details on the Neurelo CLI, please refer
Before running the CLI,
Setup environment variables NEURELO_CLIENT_ID
and NEURELO_CLIENT_SECRET
using the "client_id" and "client_secret" from the prior step
Then,
Run neurelo login
The CLI will look for the environment variables NEURELO_CLIENT_ID
and NEURELO_CLIENT_SECRET
, and will use them automatically when neurelo login
is invoked.
Once the CLI is authenticated, you can invoke
which will do multiple things:
Use the project configured with the --projectId=
value
Create a Data Source pointing to the provided --connectionString=
value
Create an Environment using the provided --region=
and --commitId=
values and attaching the previously created Data Source to it
Create an API Key for the created Environment
Start the Environment runners and wait for them to be ready
Present the API Key as the output for it to be used in your tests
The --runId=
value is used to generate the Data Source, Environment, and API Key names. It is recommended to use unique and easy-to-identify values for this, like the short version of a commit hash or similar
The --resetDb
flag indicates that a full reset of the database should be applied before the runners are started. This means, delete the existing db schema and execute the available migrations for the environment
After your tests have finished executing, by just invoking neurelo ci stop
, all the previously created resources will be deleted.
Here is a sample bash script that makes use of the Neurelo CLI to execute tests for a nodejs project: