This commit is contained in:
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -29,7 +29,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y pristine-tar sbuild mmdebstrap util-linux dpkg-dev
|
sudo apt-get install -y pristine-tar sbuild mmdebstrap util-linux dpkg-dev
|
||||||
- name: Run tests with verbose logging
|
- name: Run tests with verbose logging (timeout 30min)
|
||||||
env:
|
env:
|
||||||
RUST_LOG: debug
|
RUST_LOG: debug
|
||||||
run: timeout 30m cargo test -- --nocapture
|
run: timeout 30m cargo test -- --nocapture
|
||||||
|
|||||||
@@ -28,3 +28,6 @@ serde_json = "1.0.145"
|
|||||||
directories = "6.0.0"
|
directories = "6.0.0"
|
||||||
ssh2 = "0.9.5"
|
ssh2 = "0.9.5"
|
||||||
tempfile = "3.10.1"
|
tempfile = "3.10.1"
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
test-log = "0.2.19"
|
||||||
|
|||||||
@@ -107,9 +107,19 @@ fn find_dsc_file(
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
async fn test_build_end_to_end(package: &str, series: &str, arch: Option<&str>, cross: bool) {
|
async fn test_build_end_to_end(package: &str, series: &str, arch: Option<&str>, cross: bool) {
|
||||||
|
log::info!(
|
||||||
|
"Starting end-to-end test for package: {} (series: {}, arch: {:?}, cross: {})",
|
||||||
|
package,
|
||||||
|
series,
|
||||||
|
arch,
|
||||||
|
cross
|
||||||
|
);
|
||||||
|
|
||||||
let temp_dir = tempfile::tempdir().unwrap();
|
let temp_dir = tempfile::tempdir().unwrap();
|
||||||
let cwd = temp_dir.path();
|
let cwd = temp_dir.path();
|
||||||
|
log::debug!("Created temporary directory: {}", cwd.display());
|
||||||
|
|
||||||
|
log::info!("Pulling package {} from Ubuntu {}...", package, series);
|
||||||
crate::pull::pull(
|
crate::pull::pull(
|
||||||
package,
|
package,
|
||||||
"",
|
"",
|
||||||
@@ -122,12 +132,16 @@ mod tests {
|
|||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.expect("Cannot pull package");
|
.expect("Cannot pull package");
|
||||||
|
log::info!("Successfully pulled package {}", package);
|
||||||
|
|
||||||
// Change directory to the package directory
|
// Change directory to the package directory
|
||||||
let cwd = cwd.join(package).join(package);
|
let cwd = cwd.join(package).join(package);
|
||||||
|
log::debug!("Package directory: {}", cwd.display());
|
||||||
|
|
||||||
|
log::info!("Starting binary package build...");
|
||||||
crate::deb::build_binary_package(arch, Some(series), Some(&cwd), cross, None)
|
crate::deb::build_binary_package(arch, Some(series), Some(&cwd), cross, None)
|
||||||
.expect("Cannot build binary package (deb)");
|
.expect("Cannot build binary package (deb)");
|
||||||
|
log::info!("Successfully built binary package");
|
||||||
|
|
||||||
// Check that the .deb files are present
|
// Check that the .deb files are present
|
||||||
let parent_dir = cwd.parent().expect("Cannot find parent directory");
|
let parent_dir = cwd.parent().expect("Cannot find parent directory");
|
||||||
@@ -137,7 +151,16 @@ mod tests {
|
|||||||
.filter(|entry| entry.path().extension().is_some_and(|ext| ext == "deb"))
|
.filter(|entry| entry.path().extension().is_some_and(|ext| ext == "deb"))
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
log::info!("Found {} .deb files after build", deb_files.len());
|
||||||
|
for file in &deb_files {
|
||||||
|
log::debug!(" - {}", file.path().display());
|
||||||
|
}
|
||||||
|
|
||||||
assert!(!deb_files.is_empty(), "No .deb files found after build");
|
assert!(!deb_files.is_empty(), "No .deb files found after build");
|
||||||
|
log::info!(
|
||||||
|
"End-to-end test completed successfully for package: {}",
|
||||||
|
package
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
@@ -146,6 +169,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[test_log::test]
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
async fn test_deb_hello_ubuntu_cross_end_to_end() {
|
async fn test_deb_hello_ubuntu_cross_end_to_end() {
|
||||||
test_build_end_to_end("hello", "noble", Some("riscv64"), true).await;
|
test_build_end_to_end("hello", "noble", Some("riscv64"), true).await;
|
||||||
|
|||||||
Reference in New Issue
Block a user