mirror of
https://github.com/kjuulh/dagger-rs.git
synced 2024-11-26 00:42:42 +01:00
feat: introduce tests again
This commit is contained in:
parent
ecca036bc6
commit
f9e7af931d
@ -165,8 +165,21 @@ async fn select_base_image(client: Arc<Query>) -> eyre::Result<Container> {
|
|||||||
src_dir
|
src_dir
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn validate_pr(_client: Arc<Query>, container: Container) -> eyre::Result<()> {
|
async fn validate_pr(client: Arc<Query>, container: Container) -> eyre::Result<()> {
|
||||||
//let container = container.with_exec(vec!["cargo", "test", "--all"], None);
|
let exit = container.exit_code().await?;
|
||||||
|
if exit != 0 {
|
||||||
|
eyre::bail!("container failed with non-zero exit code");
|
||||||
|
}
|
||||||
|
let docker_cli = client
|
||||||
|
.container()
|
||||||
|
.from("docker:cli")
|
||||||
|
.file("/usr/local/bin/docker");
|
||||||
|
let socket = client.host().unix_socket("/var/run/docker.sock");
|
||||||
|
|
||||||
|
let container = container
|
||||||
|
.with_mounted_file("/usr/bin/docker", docker_cli.id().await?)
|
||||||
|
.with_unix_socket("/var/run/docker.sock", socket.id().await?)
|
||||||
|
.with_exec(vec!["cargo", "test", "--all"]);
|
||||||
|
|
||||||
let exit = container.exit_code().await?;
|
let exit = container.exit_code().await?;
|
||||||
if exit != 0 {
|
if exit != 0 {
|
||||||
|
@ -27,6 +27,7 @@ impl Platform {
|
|||||||
let normalize_arch = match arch.as_str() {
|
let normalize_arch = match arch.as_str() {
|
||||||
"x86_64" => "amd64",
|
"x86_64" => "amd64",
|
||||||
"aarch" => "arm64",
|
"aarch" => "arm64",
|
||||||
|
"aarch64" => "arm64",
|
||||||
arch => arch,
|
arch => arch,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -138,6 +139,10 @@ impl Downloader {
|
|||||||
if let Ok(entry) = file {
|
if let Ok(entry) = file {
|
||||||
let path = entry.path();
|
let path = entry.path();
|
||||||
if path != cli_bin_path {
|
if path != cli_bin_path {
|
||||||
|
println!(
|
||||||
|
"deleting client: path: {:?} vs cli_bin_path: {:?}",
|
||||||
|
path, cli_bin_path
|
||||||
|
);
|
||||||
std::fs::remove_file(path)?;
|
std::fs::remove_file(path)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -200,8 +205,6 @@ impl Downloader {
|
|||||||
hasher.update(&bytes);
|
hasher.update(&bytes);
|
||||||
let res = hasher.finalize();
|
let res = hasher.finalize();
|
||||||
|
|
||||||
println!("{}", hex::encode(&res));
|
|
||||||
|
|
||||||
if archive_url.ends_with(".zip") {
|
if archive_url.ends_with(".zip") {
|
||||||
// TODO: Nothing for now
|
// TODO: Nothing for now
|
||||||
todo!()
|
todo!()
|
||||||
@ -220,8 +223,6 @@ impl Downloader {
|
|||||||
let mut entry = entry?;
|
let mut entry = entry?;
|
||||||
let path = entry.path()?;
|
let path = entry.path()?;
|
||||||
|
|
||||||
println!("path: {:?}", path);
|
|
||||||
|
|
||||||
if path.ends_with("dagger") {
|
if path.ends_with("dagger") {
|
||||||
copy(&mut entry, output)?;
|
copy(&mut entry, output)?;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user