Avoid deflating for debug builds

next
Sayan Nandan 3 years ago
parent 93223c80c3
commit 4af6bef7de
No known key found for this signature in database
GPG Key ID: 8BC07A0A4D41DD52

@ -32,7 +32,7 @@ use std::{path::PathBuf, process::Command};
pub const BINARIES: [&str; 4] = ["skyd", "sky-bench", "skysh", "sky-migrate"];
/// The build mode
#[derive(Copy, Clone)]
#[derive(Copy, Clone, PartialEq)]
pub enum BuildMode {
Debug,
Release,

@ -54,12 +54,12 @@ fn get_bundle_name() -> String {
pub fn bundle(mode: BuildMode) -> HarnessResult<()> {
let target_folder = build::build(mode)?;
// now package
package_binaries(target_folder)?;
package_binaries(target_folder, mode)?;
Ok(())
}
/// Package the binaries into a ZIP file
fn package_binaries(target_folder: PathBuf) -> HarnessResult<()> {
fn package_binaries(target_folder: PathBuf, mode: BuildMode) -> HarnessResult<()> {
// get the file index
let file_index = build::get_files_index(&target_folder);
// get the bundle file name
@ -72,9 +72,14 @@ fn package_binaries(target_folder: PathBuf) -> HarnessResult<()> {
// create a temp buffer
let mut buffer = Vec::new();
// ZIP settings
let options = FileOptions::default()
.compression_method(zip::CompressionMethod::Deflated)
.unix_permissions(0o755);
let mut options = FileOptions::default().unix_permissions(0o755);
if mode == BuildMode::Debug {
// avoid compressing in debug since the binaries will be huge, so it's
// better to avoid wasting CI time
options = options.compression_method(zip::CompressionMethod::Stored);
} else {
options = options.compression_method(zip::CompressionMethod::Deflated);
}
for file in file_index {
let path = file.as_path();
let name = path.strip_prefix(Path::new(&target_folder)).unwrap();

@ -37,8 +37,9 @@ OPTIONS:
harness [SUBCOMMAND]
SUBCOMMANDS:
test Run the full test suite
bundle Build the bundle\
test Run the full test suite
bundle Build the bundle
bundle-dbg Build the debug bundle \
";
#[derive(Copy, Clone)]

@ -60,8 +60,7 @@ pub fn dbtest_module(args: TokenStream, item: TokenStream) -> TokenStream {
/// use within the `skyd` or `WORKSPACEROOT/server/` crate. If you use this compiler
/// macro in any other crate, you'll simply get compilation errors
///
/// All tests will clean up all values once a single test is over. **These tests should not
/// be run in multi-threaded environments because they often use the same keys**
/// All tests will clean up all values once a single test is over
///
/// ## Arguments
/// - `table -> str`: Custom table declaration

Loading…
Cancel
Save