cargo-green

Crates.iocargo-green
lib.rscargo-green
version0.10.0
sourcesrc
created_at2024-05-11 10:27:16.385342
updated_at2024-09-24 20:13:51.444583
descriptionCargo plugin and $RUSTC_WRAPPER to sandbox & cache cargo builds and execute jobs remotely
homepage
repositoryhttps://github.com/fenollp/supergreen
max_upload_size
id1236783
size189,950
Pierre Fenoll (fenollp)

documentation

README

cargo-green

Cached & remote-ready Rust projects builder by forwarding rustc calls to BuildKit builders.

cargo-green is

  • a cargo plugin that sets a $RUSTC_WRAPPER then calls cargo.

  • a RUSTC_WRAPPER that builds Dockerfiles

Configuration

Reads envs

  • $BUILDX_BUILDER

  • $CARGOGREEN_LOG: sets $RUSTCBUILDX_LOG level

  • $CARGOGREEN_REMOTE: reserved for now

  • $DOCKER_HOST

  • $RUSTCBUILDX

  • $RUSTCBUILDX_BASE_IMAGE

  • $RUSTCBUILDX_BUILDER_IMAGE

  • $RUSTCBUILDX_CACHE_IMAGE

  • $RUSTCBUILDX_INCREMENTAL

  • $RUSTCBUILDX_LOG

  • $RUSTCBUILDX_LOG_PATH

  • $RUSTCBUILDX_LOG_STYLE

  • $RUSTCBUILDX_RUNNER

  • $RUSTCBUILDX_RUNS_ON_NETWORK

  • $RUSTCBUILDX_SYNTAX

Sets

Usage

  • Ensure at least either a docker or podman client is installed
  • Known to work on Ubuntu 22.04 with github.com/docker/buildx v0.11.2 9872040 and rust 1.73
cargo green add
cargo green bench
cargo green build
cargo green check
cargo green clean
cargo green clippy
cargo green doc
cargo green init
cargo green install
cargo green new
cargo green package
cargo green publish
cargo green remove
cargo green run
cargo green search
cargo green test
cargo green uninstall
cargo green update

# or, setting an alias in e.g. ~/.bashrc
alias cargo='cargo green'

# With this, one may also use this set of subcommands: [UNSTABLE API] (refacto into a `cache` cmd)
cargo supergreen config get   VAR*
cargo supergreen config set   VAR VAL
cargo supergreen config unset VAR
cargo supergreen pull-images             Pulls latest versions of images used for the build, no cache (respects $DOCKER_HOST)
cargo supergreen pull-cache              Pulls all from `--cache-from`
cargo supergreen push-cache              Pushes all to `--cache-to`

Fine tuning settings

cargo-green@0.6.0: Cargo plugin and $RUSTC_WRAPPER to sandbox & cache cargo builds and execute jobs remotely
    https://github.com/fenollp/supergreen

Usage:
  cargo green supergreen env             Show used values
  cargo green supergreen pull            Pulls images (respects $DOCKER_HOST)
  cargo green supergreen push            Push cache image (all tags)
  cargo green supergreen -h | --help
  cargo green supergreen -V | --version

Remote execution

Say you have a bigger machine in your ~/.ssh/config called extra_oomph:

export DOCKER_HOST=ssh://extra_oomph
cargo green test ...

Installation

# Installs to ~/.cargo/bin
cargo install --locked --force --git https://github.com/fenollp/supergreen.git cargo-green

# Make sur $CARGO_HOME/bin is in your $PATH
which cargo-green

En vrac

Commit count: 51

cargo fmt