@@ -74,6 +74,10 @@ fn fmt() {
7474}
7575
7676fn build ( target : & str ) {
77+ if env:: var ( "GITHUB_ACTIONS" ) . is_ok ( ) && cfg ! ( target_os = "linux" ) {
78+ run ( "sudo" , & [ "apt" , "install" , "musl-tools" ] ) ;
79+ }
80+
7781 env:: set_var ( "RUSTFLAGS" , "-C target-feature=+crt-static" ) ;
7882 run ( "rustup" , & [ "target" , "add" , target] ) ;
7983 run (
@@ -95,32 +99,16 @@ fn build(target: &str) {
9599 . join ( "release" )
96100 . join ( "kill_tree_cli" )
97101 } ;
98- let zip_path = format ! ( "{target}.zip" ) ;
99- let zip_file = std:: fs:: File :: create ( zip_path. clone ( ) ) . unwrap ( ) ;
100- let mut zip = zip:: ZipWriter :: new ( zip_file) ;
101- let options = zip:: write:: FileOptions :: default ( )
102- . compression_method ( zip:: CompressionMethod :: Stored )
103- . unix_permissions ( 0o755 ) ;
104- let file_name = file_path. file_name ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) ;
105- zip. start_file ( file_name, options) . unwrap ( ) ;
106- let mut file = std:: fs:: File :: open ( file_path) . unwrap ( ) ;
107- std:: io:: copy ( & mut file, & mut zip) . unwrap ( ) ;
108- zip. finish ( ) . unwrap ( ) ;
109-
110102 let mut output_path = std:: fs:: OpenOptions :: new ( )
111103 . write ( true )
112104 . append ( true )
113105 . open ( output)
114106 . unwrap ( ) ;
115- writeln ! ( output_path, "ARTIFACT_PATH={zip_path}" ) . unwrap ( ) ;
107+ writeln ! ( output_path, "ARTIFACT_PATH={}" , file_path . to_str ( ) . unwrap ( ) ) . unwrap ( ) ;
116108 }
117109}
118110
119111fn test ( target : Option < String > ) {
120- if env:: var ( "GITHUB_ACTIONS" ) . is_ok ( ) && cfg ! ( target_os = "linux" ) {
121- run ( "sudo" , & [ "apt" , "install" , "musl-tools" ] ) ;
122- }
123-
124112 let Some ( target) = target else {
125113 run ( "cargo" , & [ "test" , "--workspace" ] ) ;
126114 return ;
0 commit comments