solrcopy 0.9.2

Command line tool useful for migration, transformations, backup, and restore of documents stored inside cores of Apache Solr
#!/usr/bin/env -S bash -x -c 'cargo make lint'

# Testing Solrcopy using a container with Solr --------------------------------------- #

#region Usage

#1 Intall Dependencies:

#$ cargo install --force cargo-make
#$ sudo apt install docker-ce

#2 Run any of the following commands:

#$ cargo make list
#$ cargo make lint
#$ cargo make check
#$ cargo make test
#$ cargo make all

#endregion

#region Basic

[tasks.default]
category = "Basic"
alias = "list"

[tasks.list]
category = "Basic"
description = "List all available tasks"
command = "cargo"
args = ["make", "--list-all-steps"]

[tasks.check]
category = "Basic"
description = "Runs all lint checks and runs all basic tests possible without a Solr Server"
dependencies = ["lint", "test-basic"]

[tasks.all]
category = "Basic"
description = "Runs all lint checks and runs all tests against a local Solr container"
dependencies = ["set-stable", "lint", "test-docker"]

[tasks.test]
category = "Basic"
description = "Runs tests against a local solr server created using docker compose"
dependencies = ["test-basic", "test-docker"]

#endregion Basic

#region Docker

[env]
#? Choose the Solr image tag to use in the docker container passing TAG like:
## cargo make --env TAG=9-slim test
TAG="slim"
#? Choose the Solr run mode: standalone, cloud, precreate, demo, testing
## cargo make --env MODE=cloud test
MODE="testing"

[tasks.compose-up]
category = "Test"
description = "Runs the command `docker compose up` to create a container running Solr for use in testing"
private = true
command = "docker"
args = [
    "compose",
    "-f",
    "./docker/docker-compose.yml",
    "up",
    "--no-recreate",
    "--wait",
    "--detach",
]

[tasks.compose-down]
category = "Test"
description = "Runs the command `docker compose down` to remove and cleanup the container running Solr after testing"
private = true
command = "docker"
args = ["compose", "-f", "./docker/docker-compose.yml", "down", "-v"]

[tasks.compose-ingest]
category = "Test"
description = "Ingest some documents into an existing local Solr container"
private = true
command = "docker"
args = [
    "compose",
    "-f",
    "./docker/docker-compose.yml",
    "exec",
    "solr",
    "solr-ingest-examples",
]

#endregion Docker

#region Test

[tasks.test-basic]
category = "Test"
description = "Runs tests that do not require a Solr container"
command = "cargo"
args = ["test"]

[tasks.test-begin]
category = "Test"
description = "Setup a local Solr container and ingest some documents allowing to run tests manually after"
dependencies = ["compose-up", "compose-ingest"]

[tasks.test-cleanup]
category = "Test"
description = "Cleanup the local Solr container after testing"
dependencies = ["compose-down"]

[tasks.test-full]
category = "Test"
description = "Runs tests against an existing local solr server"
command = "cargo"
args = ["test", "--features", "testsolr"]

[tasks.test-docker]
category = "Test"
description = "Setup a local Solr container, ingest some documents, run all tests, and cleanup the container"
private = true
run_task = { name = [
    "test-begin",
    "test-full",
], fork = true, cleanup_task = "compose-down" }

#endregion Test

#region Coverage

[tasks.coverage-basic]
category = "Test Coverage"
description = "Generate coverage for the source code test that does not require Solr"
command = "cargo"
args = ["llvm-cov", "--lcov", "--output-path", "target/lcov.info"]

[tasks.coverage-full]
category = "Test Coverage"
description = "Generate coverage for the source code while testing Solr"
command = "cargo"
args = [
    "llvm-cov",
    "--all-features",
    "--lcov",
    "--output-path",
    "target/lcov.info",
]

[tasks.coverage-report]
category = "Test Coverage"
description = "Generate a coverage report while testing Solr"
command = "cargo"
args = ["llvm-cov", "--all-features", "--html", "--output-dir", "target/coverage-report"]

[tasks.coverage]
category = "Test Coverage"
description = "Setup Solr container, generate a coverage report, and cleanup"
run_task = { name = [
    "test-begin",
    "coverage-full",
], fork = true, cleanup_task = "compose-down" }

#endregion Coverage

#region Publish

[tasks.clean]
category = "Publish"
description = "Clean all compiled artifacts"
command = "cargo"
args = ["clean"]

[tasks.verify]
category = "Publish"
description = "Verify packaging"
command = "cargo"
args = ["publish", "--dry-run", "--allow-dirty"]

[tasks.publish]
category = "Publish"
description = "Publish to crates.io"
command = "cargo"
args = ["publish"]

#endregion Publish

#region Lint

[tasks.check-compile]
category = "Lint"
description = "Check if the source code compiles"
command = "cargo"
args = ["check", "--all-features"]

[tasks.check-lint]
category = "Lint"
description = "Check if the source code has any language issues"
command = "cargo"
args = ["clippy", "--all-features"]

[tasks.check-fmt]
category = "Lint"
description = "Check if the source code follows the formatting rules"
command = "cargo"
args = ["fmt", "--check"]

[tasks.check-doc]
category = "Lint"
description = "Check if the source code has any documentation issues"
command = "cargo"
args = ["doc", "--no-deps", "--document-private-items", "--all-features"]

[tasks.check-future]
category = "Lint"
description = "Check if the source code has any future incompatibilities"
command = "cargo"
args = ["check", "--future-incompat-report"]

[tasks.check-msrv]
category = "Lint"
description = "Verify the minimum supported rust version"
command = "cargo"
args = ["msrv", "verify", "--all-features"]

[tasks.check-unused]
category = "Lint"
description = "Check if the source code has any unused dependencies"
command = "sh"
args = ["-c", "cargo +nightly udeps --release"]

[tasks.format]
category = "Lint"
description = "Format the source code"
command = "cargo"
args = ["fmt"]

[tasks.pre-commit]
category = "Lint"
description = "Verify the source code before committing"
dependencies = ["format", "check-compile", "check-lint"]

[tasks.lint]
category = "Basic"
description = "Verify the source code using all the checks configured"
dependencies = [
    "check-compile",
    "check-lint",
    "check-fmt",
    "check-doc",
    "check-future",
    "check-msrv",
    "check-unused",
]

#endregion Lint

#region Security

[tasks.auditable-build]
category = "Security"
description = "Build the source code using the auditable feature"
private = true
command = "cargo"
args = ["auditable", "build", "--release"]

[tasks.audit-release]
category = "Security"
description = "Check if the release build has any security issues"
dependencies = ["auditable-build"]
command = "cargo"
args = ["audit", "bin", "target/release/solrcopy"]

[tasks.audit]
category = "Security"
description = "Check if the release build has any security issues and clean the compiled artifacts after"
dependencies = ["audit-release", "clean"]

#endregion Security

#region Upgrade

[tasks.show]
category = "Upgrade"
description = "Show the installed and current rust toolchains"
command = "rustup"
args = ["show"]

[tasks.set-stable]
category = "Upgrade"
description = "Set the stable rust toolchain as the default"
private = true
command = "rustup"
args = ["default", "stable"]

[tasks.upgrade-check]
category = "Upgrade"
description = "Check if the rust toolchain is up to date"
command = "rustup"
args = ["check"]

[tasks.upgrade-rustup]
category = "Upgrade"
description = "Upgrade the rustup tool"
command = "rustup"
args = ["self", "update"]

[tasks.upgrade-toolchain]
category = "Upgrade"
description = "Upgrade the stable rust toolchain"
command = "rustup"
args = ["update", "stable"]

[tasks.upgrade]
category = "Upgrade"
description = "Upgrade rustup, rust andthe rust toolchain"
run_task = { name = ["upgrade-check", "upgrade-rustup", "upgrade-toolchain"] }

#endregion Upgrade

#region Others

[tasks.example]
category = "Others"
private = true
script_runner = "@rust"
script = '''
//! ```cargo
//! [dependencies]
//! envmnt = "*"
//! ```
fn main() {
    let value = envmnt::get_or("PATH", "NO PATH VAR DEFINED");
    println!("Path Value: {}", &value);
}
'''

#endregion Others

#region Settings

[config]
# In order to prevent loading of internal core tasks and flows, simply add the following
#configuration property in your external Makefile.toml:
skip_core_tasks = true

[tasks.empty]
category = "Settings"
private = true

#endregion Settings