rox-cli 0.3.2

Composable build tool inspired by Make
Documentation

# Other files can be combined, but watch out for overwriting identical task names!
# Not yet implemented
supplemental_files: ["someotherfile.yml"]

# These checks require a single, well-formed SemVer version string as output from the command
version_requirements:
  - command: "docker version --format {{.Client.Version}}" # 20.10.23
    minimum_version: "20.10.7"
    maximum_version: "21.0.0"

  - command: "cargo watch --version"
    minimum_version: "8.1.7"
    split: true

  - command: "python --version" # Python 3.9.13
    # Splits on spaces and grabs the last output token,
    # useful for avoiding bash manipulation of output
    split: true 
    minimum_version: "3.8"

file_requirements: # Verify that these files exist
  - path: "Cargo.toml"
  
  - path: ".env"
    create_if_not_exists: true # Create the file if it doesn't exist 

# Contains templates for commands that can be used by tasks
templates:
  - name: docker_build
    command: "docker build {path} -t rox:{image_tag}"
    symbols: ["{path}", "{image_tag}"]

pipelines:
  - name: build-all-release
    description: "Build a release artifact binary and Docker image"
    tasks: ["build-release-binary", "build-release-image"]

  - name: ci
    description: "Run all CI-related tasks"
    tasks: ["fmt", "test", "clippy-ci"]

tasks:

  - name: ls
    command: "dir"
    description: "Demonstrates running things in a separate dir."
    workdir: "src/"

  - name: build-local
    description: "Build the application dockerfile"
    uses: docker_build
    values: [".", "local"]

  - name: build-prod
    description: "Build the application dockerfile"
    uses: docker_build
    values: [".", "latest"]

  - name: dr
    description: "Run 'help' for the packaged Docker application"
    command: "docker run rox:local"
    pre_tasks: ["db"]
    
  - name: "wr"
    command: "cargo watch -c -x run"
    description: "Run the application, restarting on file changes"

  - name: "wt"
    command: "cargo watch -c -x test"
    description: "Rerun tests on every file change"

  - name: "clippy-ci"
    description: "Run Clippy with a non-zero exit if warnings are found."
    command: "cargo clippy -- -D warnings"

  - name: clippy-fix
    command: "cargo clippy"

  - name: fmt
    command: "cargo fmt"

  - name: test
    command: "cargo test"
    description: "Run tests"

  - name: build-binary
    command: "cargo build"
    description: "Build the dev binary"

  - name: run
    description: "Runs the 'help' command as a basic test"
    command: "cargo run help"

  - name: precommit
    description: "All things to run before a commit"

  # Release-related
  - name: build-release-binary
    description: "Build a release binary with cargo."
    command: "cargo build --release"

  - name: build-release-image
    description: "Build a production image for Docker."
    command: "docker build . -t rox:latest"

  # This won't show up in the CLI help output
  - name: invalid
    description: "This task will throw an error becasue it has nothing to do!"
    hide: true