mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 13:28:30 +00:00
fix(ci): fix tests
This commit is contained in:
@@ -119,6 +119,36 @@ pub fn host_profile_dir(project_root: &Path, profile: &str) -> PathBuf {
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn default_artifact_path(project_root: &Path, project_name: &str) -> PathBuf {
|
||||
host_profile_dir(project_root, "debug").join(project_name)
|
||||
pub fn bin_name(project_name: &str) -> String {
|
||||
if cfg!(windows) {
|
||||
format!("{project_name}.exe")
|
||||
} else {
|
||||
project_name.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn default_artifact_path(project_root: &Path, project_name: &str) -> PathBuf {
|
||||
host_profile_dir(project_root, "debug").join(bin_name(project_name))
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn artifact_candidates(dir: &Path, project_name: &str) -> Vec<PathBuf> {
|
||||
let base = bin_name(project_name);
|
||||
let bare = project_name.to_string();
|
||||
vec![
|
||||
dir.join(&base),
|
||||
dir.join(&bare),
|
||||
dir.join(format!("{project_name}.exe")),
|
||||
]
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn assert_artifact_in(dir: &Path, project_name: &str, ctx: &str) {
|
||||
let candidates = artifact_candidates(dir, project_name);
|
||||
assert!(
|
||||
candidates.iter().any(|p| p.is_file()),
|
||||
"{ctx}: expected binary in {}, candidates: {candidates:?}",
|
||||
dir.display()
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user