| |
info!("radicle-native-ci starts");
|
| |
|
| |
let config = Config::load_via_env()?;
|
| - |
|
| - |
let state = &config.state;
|
| - |
if !state.exists() {
|
| - |
debug!("creating {}", state.display());
|
| - |
std::fs::create_dir_all(state).map_err(|e| NativeError::CreateState(state.into(), e))?;
|
| - |
}
|
| - |
|
| - |
let run_id = Uuid::new_v4();
|
| - |
let run_dir = state.join(run_id.to_string());
|
| - |
debug!("directory for this run: {}", run_dir.display());
|
| - |
std::fs::create_dir(&run_dir).map_err(|e| NativeError::CreateRunDir(run_dir.clone(), e))?;
|
| + |
let (run_id, run_dir) = mkdir_run(&config)?;
|
| |
|
| |
let src = run_dir.join("src");
|
| |
let log = run_dir.join("log");
|
| |
Ok(())
|
| |
}
|
| |
|
| + |
/// Create a per-run directory.
|
| + |
fn mkdir_run(config: &Config) -> Result<(Uuid, PathBuf), NativeError> {
|
| + |
let state = &config.state;
|
| + |
if !state.exists() {
|
| + |
debug!("creating state directory {}", state.display());
|
| + |
std::fs::create_dir_all(state).map_err(|e| NativeError::CreateState(state.into(), e))?;
|
| + |
}
|
| + |
|
| + |
let run_id = Uuid::new_v4();
|
| + |
let run_dir = state.join(run_id.to_string());
|
| + |
debug!("directory for this run: {}", run_dir.display());
|
| + |
std::fs::create_dir(&run_dir).map_err(|e| NativeError::CreateRunDir(run_dir.clone(), e))?;
|
| + |
Ok((run_id, run_dir))
|
| + |
}
|
| + |
|
| |
/// Perform the CI run.
|
| |
fn run(
|
| |
run_id: Uuid,
|