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"]; pub const BINARIES: [&str; 4] = ["skyd", "sky-bench", "skysh", "sky-migrate"];
/// The build mode /// The build mode
#[derive(Copy, Clone)] #[derive(Copy, Clone, PartialEq)]
pub enum BuildMode { pub enum BuildMode {
Debug, Debug,
Release, Release,

@ -54,12 +54,12 @@ fn get_bundle_name() -> String {
pub fn bundle(mode: BuildMode) -> HarnessResult<()> { pub fn bundle(mode: BuildMode) -> HarnessResult<()> {
let target_folder = build::build(mode)?; let target_folder = build::build(mode)?;
// now package // now package
package_binaries(target_folder)?; package_binaries(target_folder, mode)?;
Ok(()) Ok(())
} }
/// Package the binaries into a ZIP file /// 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 // get the file index
let file_index = build::get_files_index(&target_folder); let file_index = build::get_files_index(&target_folder);
// get the bundle file name // get the bundle file name
@ -72,9 +72,14 @@ fn package_binaries(target_folder: PathBuf) -> HarnessResult<()> {
// create a temp buffer // create a temp buffer
let mut buffer = Vec::new(); let mut buffer = Vec::new();
// ZIP settings // ZIP settings
let options = FileOptions::default() let mut options = FileOptions::default().unix_permissions(0o755);
.compression_method(zip::CompressionMethod::Deflated) if mode == BuildMode::Debug {
.unix_permissions(0o755); // 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 { for file in file_index {
let path = file.as_path(); let path = file.as_path();
let name = path.strip_prefix(Path::new(&target_folder)).unwrap(); let name = path.strip_prefix(Path::new(&target_folder)).unwrap();

@ -37,8 +37,9 @@ OPTIONS:
harness [SUBCOMMAND] harness [SUBCOMMAND]
SUBCOMMANDS: SUBCOMMANDS:
test Run the full test suite test Run the full test suite
bundle Build the bundle\ bundle Build the bundle
bundle-dbg Build the debug bundle \
"; ";
#[derive(Copy, Clone)] #[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 /// use within the `skyd` or `WORKSPACEROOT/server/` crate. If you use this compiler
/// macro in any other crate, you'll simply get compilation errors /// 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 /// All tests will clean up all values once a single test is over
/// be run in multi-threaded environments because they often use the same keys**
/// ///
/// ## Arguments /// ## Arguments
/// - `table -> str`: Custom table declaration /// - `table -> str`: Custom table declaration

Loading…
Cancel
Save