Migrate CI and builds to Just, add "full" builds (#660)

This commit is contained in:
Félix Saparelli 2023-01-08 18:27:36 +13:00 committed by GitHub
parent 305bf8123d
commit aea9df602c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 717 additions and 463 deletions

View file

@ -1,4 +1,5 @@
use std::{
env,
ffi::OsString,
fmt,
num::{NonZeroU64, ParseIntError},
@ -225,13 +226,8 @@ pub struct Args {
///
/// Set to `off` to disable logging completely, this will also
/// disable output from `cargo-install`.
#[clap(
help_heading = "Meta",
long,
default_value = "info",
value_name = "LEVEL"
)]
pub log_level: LevelFilter,
#[clap(help_heading = "Meta", long, value_name = "LEVEL")]
pub log_level: Option<LevelFilter>,
/// Equivalent to setting `log_level` to `off`.
///
@ -331,8 +327,16 @@ pub fn parse() -> Args {
// Load options
let mut opts = Args::parse_from(args);
if opts.quiet {
opts.log_level = LevelFilter::Off;
if let (true, Some(log)) = (
opts.log_level.is_none(),
env::var("BINSTALL_LOG_LEVEL")
.ok()
.and_then(|s| s.parse().ok()),
) {
opts.log_level = Some(log);
} else if opts.quiet {
opts.log_level = Some(LevelFilter::Off);
}
// Ensure no conflict

View file

@ -85,7 +85,7 @@ pub async fn install_crates(args: Args, jobserver_client: LazyJobserverClient) -
no_symlinks: args.no_symlinks,
dry_run: args.dry_run,
force: args.force,
quiet: args.log_level == LevelFilter::Off,
quiet: args.log_level == Some(LevelFilter::Off),
version_req: args.version_req,
manifest_path: args.manifest_path,

View file

@ -1,6 +1,7 @@
use std::time::Instant;
use binstalk::helpers::jobserver_client::LazyJobserverClient;
use log::LevelFilter;
use tracing::debug;
use cargo_binstall::{
@ -24,7 +25,10 @@ fn main() -> MainExit {
println!("{}", env!("CARGO_PKG_VERSION"));
MainExit::Success(None)
} else {
logging(args.log_level, args.json_output);
logging(
args.log_level.unwrap_or(LevelFilter::Info),
args.json_output,
);
let start = Instant::now();

View file

@ -9,8 +9,6 @@ use std::{
use cfg_if::cfg_if;
use tokio::process::Command;
use crate::TARGET;
cfg_if! {
if #[cfg(target_os = "linux")] {
mod linux;
@ -56,7 +54,7 @@ pub async fn detect_targets() -> Vec<String> {
{
let target = get_target_from_rustc().await.unwrap_or_else(|| {
guess_host_triple::guess_host_triple()
.unwrap_or(TARGET)
.unwrap_or(crate::TARGET)
.to_string()
});

View file

@ -11,3 +11,6 @@ license = "Apache-2.0 OR MIT"
[dependencies]
tempfile = "3.3.0"
[package.metadata.binstall]
pkg-url = "{ repo }/releases/download/v{ version }/cargo-binstall-{ target }.full.{ archive-format }"