From a57df8262cae324d89f17ffff84ce1da8d5e16d5 Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Thu, 5 Sep 2024 04:22:00 +0330 Subject: [PATCH 1/8] add wasix compatability --- Cargo.lock | 533 +++++++++++++++++++++++++++++++++++-------------- Cargo.toml | 20 +- src/fs/path.rs | 2 +- src/server.rs | 7 +- 4 files changed, 404 insertions(+), 158 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fbc011cd..ec26aaa7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,6 +17,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + [[package]] name = "aho-corasick" version = "1.1.3" @@ -92,7 +98,7 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" dependencies = [ - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -102,7 +108,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" dependencies = [ "anstyle", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -111,6 +117,12 @@ version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +[[package]] +name = "arc-swap" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dabe5a181f83789739c194cbe5a897dde195078fac08568d09221fd6137a7ba8" + [[package]] name = "async-compression" version = "0.4.12" @@ -143,16 +155,16 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.7.4", "object", "rustc-demangle", ] [[package]] name = "base64" -version = "0.21.7" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" [[package]] name = "base64" @@ -173,6 +185,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitflags" version = "2.6.0" @@ -181,11 +199,23 @@ checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "block-buffer" -version = "0.10.4" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +dependencies = [ + "block-padding", + "byte-tools", + "byteorder", + "generic-array 0.12.4", +] + +[[package]] +name = "block-padding" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" dependencies = [ - "generic-array", + "byte-tools", ] [[package]] @@ -235,6 +265,12 @@ version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +[[package]] +name = "byte-tools" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" + [[package]] name = "bytecount" version = "0.6.8" @@ -247,6 +283,12 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" +[[package]] +name = "bytes" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" + [[package]] name = "bytes" version = "1.7.1" @@ -255,9 +297,9 @@ checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" [[package]] name = "camino" -version = "1.1.7" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0ec6b951b160caa93cc0c7b209e5a3bff7aae9062213451ac99493cd844c239" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" dependencies = [ "serde", ] @@ -295,12 +337,13 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.10" +version = "1.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9e8aabfac534be767c909e0690571677d49f41bd8465ae876fe043d52ba5292" +checksum = "e9d013ecb737093c0e86b151a7b837993cf9ec6c502946cfb44bedc392421e0b" dependencies = [ "jobserver", "libc", + "shlex", ] [[package]] @@ -318,7 +361,7 @@ dependencies = [ "android-tzdata", "iana-time-zone", "num-traits", - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -333,9 +376,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.15" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d8838454fda655dafd3accb2b6e2bea645b9e4078abe84a22ceb947235c5cc" +checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" dependencies = [ "clap_builder", "clap_derive", @@ -343,9 +386,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.15" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" +checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" dependencies = [ "anstream", "anstyle", @@ -355,9 +398,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.13" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" dependencies = [ "heck", "proc-macro2", @@ -367,9 +410,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.2" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" [[package]] name = "colorchoice" @@ -423,15 +466,6 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" -[[package]] -name = "cpufeatures" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" -dependencies = [ - "libc", -] - [[package]] name = "crc32fast" version = "1.4.2" @@ -462,7 +496,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "generic-array", + "generic-array 0.14.7", "typenum", ] @@ -490,12 +524,11 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.7" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" dependencies = [ - "block-buffer", - "crypto-common", + "generic-array 0.12.4", ] [[package]] @@ -511,7 +544,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -523,20 +556,26 @@ dependencies = [ "version_check", ] +[[package]] +name = "fake-simd" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" + [[package]] name = "fastrand" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "flate2" -version = "1.0.31" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f211bbe8e69bbd0cfdea405084f128ae8b4aaa6b0b522fc8f2b009084797920" +checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.8.0", ] [[package]] @@ -606,6 +645,15 @@ dependencies = [ "slab", ] +[[package]] +name = "generic-array" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +dependencies = [ + "typenum", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -618,13 +666,13 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.15" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", ] [[package]] @@ -639,7 +687,7 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724" dependencies = [ - "bitflags", + "bitflags 2.6.0", "libc", "libgit2-sys", "log", @@ -668,11 +716,10 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +version = "0.3.23" +source = "git+https://github.com/wasix-org/h2.git?branch=v0.3.23#c54cc03da26a4af70323c4b2623143145ab059bd" dependencies = [ - "bytes", + "bytes 1.7.1", "fnv", "futures-core", "futures-sink", @@ -681,7 +728,7 @@ dependencies = [ "indexmap", "slab", "tokio", - "tokio-util", + "tokio-util 0.7.10", "tracing", ] @@ -693,17 +740,18 @@ checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] name = "headers" -version = "0.3.9" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" +checksum = "c9836ffd533e1fb207cfdb2e357079addbd17ef5c68eea5afe2eece40555b905" dependencies = [ - "base64 0.21.7", - "bytes", + "base64 0.11.0", + "bitflags 1.3.2", + "bytes 0.5.6", "headers-core", "http", - "httpdate", "mime", - "sha1", + "sha-1", + "time 0.1.45", ] [[package]] @@ -717,9 +765,9 @@ dependencies = [ [[package]] name = "heck" -version = "0.5.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" @@ -733,7 +781,7 @@ version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ - "bytes", + "bytes 1.7.1", "fnv", "itoa", ] @@ -744,7 +792,7 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ - "bytes", + "bytes 1.7.1", "http", "pin-project-lite", ] @@ -773,11 +821,10 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" +version = "0.14.28" +source = "git+https://github.com/wasix-org/hyper?branch=v0.14.28#a200341af87dfa9ed3c5302391a7608884bed4fc" dependencies = [ - "bytes", + "bytes 1.7.1", "futures-channel", "futures-core", "futures-util", @@ -830,9 +877,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" +checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" dependencies = [ "equivalent", "hashbrown", @@ -844,7 +891,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" dependencies = [ - "generic-array", + "generic-array 0.14.7", ] [[package]] @@ -891,9 +938,8 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.155" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +version = "0.2.152" +source = "git+https://github.com/wasix-org/libc.git?branch=v0.2.152#26f165f162250ad2fc3c6560103eb4e6d7384bce" [[package]] name = "libgit2-sys" @@ -909,9 +955,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.19" +version = "1.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdc53a7799a7496ebc9fd29f31f7df80e83c9bda5299768af5f9e59eeea74647" +checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" dependencies = [ "cc", "libc", @@ -980,6 +1026,15 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg", +] + [[package]] name = "mime" version = "0.3.17" @@ -1021,15 +1076,23 @@ dependencies = [ ] [[package]] -name = "mio" -version = "1.0.2" +name = "miniz_oxide" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "0.8.9" +source = "git+https://github.com/wasix-org/mio.git?branch=v0.8.9#df1a3883d16be8d33070e270e44a4b4f2595c401" dependencies = [ - "hermit-abi", "libc", - "wasi", - "windows-sys", + "wasi 0.11.0+wasi-snapshot-preview1", + "wasix", + "windows-sys 0.48.0", ] [[package]] @@ -1057,6 +1120,16 @@ dependencies = [ "autocfg", ] +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + [[package]] name = "num_threads" version = "0.1.7" @@ -1068,9 +1141,9 @@ dependencies = [ [[package]] name = "object" -version = "0.36.3" +version = "0.36.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" +checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" dependencies = [ "memchr", ] @@ -1081,6 +1154,12 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "opaque-debug" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" + [[package]] name = "overload" version = "0.1.1" @@ -1105,9 +1184,9 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.5.3", "smallvec", - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -1219,27 +1298,36 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b" dependencies = [ - "bitflags", + "bitflags 2.6.0", "memchr", "unicase", ] [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "redox_syscall" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" dependencies = [ - "bitflags", + "bitflags 2.6.0", ] [[package]] @@ -1273,9 +1361,8 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "ring" -version = "0.17.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +version = "0.17.7" +source = "git+https://github.com/wasix-org/ring?branch=0.17.7#be27e9a6daa1bdae897fb9cd3c82d0fc6b86e4c9" dependencies = [ "cc", "cfg-if", @@ -1283,7 +1370,8 @@ dependencies = [ "libc", "spin", "untrusted", - "windows-sys", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.48.0", ] [[package]] @@ -1294,15 +1382,15 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" dependencies = [ - "bitflags", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -1338,9 +1426,9 @@ checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" [[package]] name = "rustls-webpki" -version = "0.102.6" +version = "0.102.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" +checksum = "84678086bd54edf2b415183ed7a94d0efb049f1b646a33e22a36f3794be6ae56" dependencies = [ "ring", "rustls-pki-types", @@ -1385,18 +1473,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.207" +version = "1.0.209" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5665e14a49a4ea1b91029ba7d3bca9f299e1f7cfa194388ccc20f14743e784f2" +checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.207" +version = "1.0.209" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aea2634c86b0e8ef2cfdc0c340baede54ec27b1e46febd7f80dffb2aa44a00e" +checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" dependencies = [ "proc-macro2", "quote", @@ -1414,9 +1502,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.124" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66ad62847a56b3dba58cc891acd13884b9c61138d330c0d7b6181713d4fce38d" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", "memchr", @@ -1445,14 +1533,15 @@ dependencies = [ ] [[package]] -name = "sha1" -version = "0.10.6" +name = "sha-1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +checksum = "2cfd94fe9ed1245c2a1459f99373217b131a1b32b6d0922988b1e45b35249249" dependencies = [ - "cfg-if", - "cpufeatures", + "block-buffer", "digest", + "fake-simd", + "opaque-debug", ] [[package]] @@ -1464,7 +1553,7 @@ dependencies = [ "const_format", "git2", "is_debug", - "time", + "time 0.3.36", "tzdb", ] @@ -1477,6 +1566,12 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signal-hook" version = "0.3.17" @@ -1485,7 +1580,16 @@ checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" dependencies = [ "cc", "libc", - "signal-hook-registry", + "signal-hook-registry 1.4.2", +] + +[[package]] +name = "signal-hook-registry" +version = "1.1.1" +source = "git+https://github.com/wasix-org/signal-hook?branch=registry-v1.1.1#c690fb4f3e2baa47252ded6338253e1af30087b1" +dependencies = [ + "arc-swap", + "libc", ] [[package]] @@ -1541,12 +1645,11 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +version = "0.5.5" +source = "git+https://github.com/wasix-org/socket2.git?branch=v0.5.5#93a7a4fb09f3bdd285a3c1c205173ddc7eb47028" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1555,6 +1658,12 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "static-web-server" version = "2.32.2" @@ -1563,12 +1672,13 @@ dependencies = [ "anyhow", "async-compression", "bcrypt", - "bytes", + "bytes 1.7.1", "chrono", "clap", "compact_str", "form_urlencoded", "futures-util", + "getrandom", "globset", "headers", "http", @@ -1583,11 +1693,13 @@ dependencies = [ "pin-project", "prometheus", "regex", + "rustix", "rustls-pemfile", "serde", "serde_ignored", "serde_json", "serde_repr", + "sha-1", "shadow-rs", "signal-hook", "signal-hook-tokio", @@ -1595,10 +1707,11 @@ dependencies = [ "tokio", "tokio-metrics-collector", "tokio-rustls", - "tokio-util", + "tokio-util 0.7.12", "toml", "tracing", "tracing-subscriber", + "triomphe", "windows-service", ] @@ -1610,9 +1723,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strsim" -version = "0.11.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "subtle" @@ -1622,9 +1735,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.74" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fceb41e3d546d0bd83421d3409b1460cc7444cd389341a4c880fe7a042cb3d7" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -1639,15 +1752,15 @@ checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" [[package]] name = "tempfile" -version = "3.11.0" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fcd239983515c23a32fb82099f97d0b11b8c72f654ed659363a95c3dad7a53" +checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" dependencies = [ "cfg-if", "fastrand", - "once_cell", + "redox_syscall 0.4.1", "rustix", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -1700,6 +1813,17 @@ dependencies = [ "tikv-jemalloc-sys", ] +[[package]] +name = "time" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" +dependencies = [ + "libc", + "wasi 0.10.0+wasi-snapshot-preview1", + "winapi", +] + [[package]] name = "time" version = "0.3.36" @@ -1750,26 +1874,25 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.39.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1" +version = "1.35.1" +source = "git+https://github.com/wasix-org/tokio.git?branch=wasix-1.35.1#3f2d1abe668752dea632c94f61b45f4e5a157226" dependencies = [ "backtrace", - "bytes", + "bytes 1.7.1", "libc", "mio", + "num_cpus", "pin-project-lite", - "signal-hook-registry", + "signal-hook-registry 1.1.1", "socket2", "tokio-macros", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "tokio-macros" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +version = "2.2.0" +source = "git+https://github.com/wasix-org/tokio.git?branch=wasix-1.35.1#3f2d1abe668752dea632c94f61b45f4e5a157226" dependencies = [ "proc-macro2", "quote", @@ -1825,11 +1948,24 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.10" +source = "git+https://github.com/wasix-org/tokio.git?branch=wasix-1.35.1#3f2d1abe668752dea632c94f61b45f4e5a157226" +dependencies = [ + "bytes 1.7.1", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "tokio-util" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" dependencies = [ - "bytes", + "bytes 1.7.1", "futures-core", "futures-sink", "pin-project-lite", @@ -1924,9 +2060,14 @@ dependencies = [ [[package]] name = "triomphe" -version = "0.1.13" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6631e42e10b40c0690bf92f404ebcfe6e1fdb480391d15f17cc8e96eeed5369" +checksum = "46bddb80ec09585c58022a2c55e6e7c11e713d9bb26895f1b56cd945c4040c54" +dependencies = [ + "memoffset", + "serde", + "stable_deref_trait", +] [[package]] name = "try-lock" @@ -2001,9 +2142,9 @@ dependencies = [ [[package]] name = "unicode-xid" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" [[package]] name = "untrusted" @@ -2071,12 +2212,27 @@ dependencies = [ "try-lock", ] +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasix" +version = "0.12.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1fbb4ef9bbca0c1170e0b00dd28abc9e3b68669821600cad1caaed606583c6d" +dependencies = [ + "wasi 0.11.0+wasi-snapshot-preview1", +] + [[package]] name = "wasm-bindgen" version = "0.2.93" @@ -2160,7 +2316,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -2175,7 +2331,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -2184,9 +2340,18 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d24d6bcc7f734a4091ecf8d7a64c5f7d7066f45585c1861eba06449909609c8a" dependencies = [ - "bitflags", + "bitflags 2.6.0", "widestring", - "windows-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", ] [[package]] @@ -2195,7 +2360,31 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -2204,28 +2393,46 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -2238,24 +2445,48 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" diff --git a/Cargo.toml b/Cargo.toml index 5bc4225b..da4e9541 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "static-web-server" version = "2.32.2" edition = "2021" -rust-version = "1.76.0" +rust-version = "1.72.0" authors = ["Jose Quintana "] license = "MIT OR Apache-2.0" description = "A cross-platform, high-performance and asynchronous web server for static files-serving." @@ -66,12 +66,12 @@ async-compression = { version = "0.4", default-features = false, optional = true bcrypt = { version = "0.15", optional = true } bytes = "1.6" chrono = { version = "0.4", default-features = false, features = ["std", "clock"], optional = true } -clap = { version = "4.5", features = ["derive", "env"] } +clap = { version = "=4.4", features = ["derive", "env"] } compact_str = "0.8" form_urlencoded = "1.2" futures-util = { version = "0.3", default-features = false } globset = { version = "0.4", features = ["serde1"] } -headers = "0.3" +headers = "=0.3.0" http = "0.2" http-serde = "1.1" hyper = { version = "0.14", features = ["stream", "http1", "http2", "tcp", "server"] } @@ -89,12 +89,16 @@ serde_ignored = "0.1" serde_json = "1.0" serde_repr = "0.1" shadow-rs = "0.29" -tokio = { version = "1", default-features = false, features = ["rt-multi-thread", "macros", "fs", "io-util", "signal"] } +tokio = { version = "=1.35.1", default-features = false, features = ["rt-multi-thread", "macros", "fs", "io-util", "signal"] } tokio-rustls = { version = "0.26", optional = true, default-features = false, features = ["logging", "tls12", "ring"] } tokio-util = { version = "0.7", default-features = false, features = ["io"] } toml = "0.8" tracing = { version = "0.1", default-features = false, features = ["std"] } tracing-subscriber = { version = "0.3", default-features = false, features = ["smallvec", "registry", "parking_lot", "fmt", "ansi", "tracing-log"] } +getrandom = "=0.2.10" +triomphe = "=0.1.3" +rustix = "=0.38.30" +sha-1 = "=0.8.0" [target.'cfg(all(target_env = "musl", target_pointer_width = "64"))'.dependencies.tikv-jemallocator] version = "0.6" @@ -146,3 +150,11 @@ pre-build = [ # - https://github.com/static-web-server/static-web-server/issues/440 # - https://github.com/jemalloc/jemalloc/issues/467 passthrough = ["JEMALLOC_SYS_WITH_LG_PAGE=16"] + +[patch.crates-io] +libc = { git = "https://github.com/wasix-org/libc.git", branch = "v0.2.152" } +socket2 = { git = "https://github.com/wasix-org/socket2.git", branch = "v0.5.5" } +tokio = { git = "https://github.com/wasix-org/tokio.git", branch = "wasix-1.35.1" } +signal-hook-registry = { git = "https://github.com/wasix-org/signal-hook", branch = "registry-v1.1.1" } +hyper = { git = "https://github.com/wasix-org/hyper", branch = "v0.14.28" } +ring = { git = "https://github.com/wasix-org/ring", branch = "0.17.7" } \ No newline at end of file diff --git a/src/fs/path.rs b/src/fs/path.rs index b0c0892b..b534cd94 100644 --- a/src/fs/path.rs +++ b/src/fs/path.rs @@ -27,7 +27,7 @@ impl PathExt for Path { } } -#[cfg(unix)] +#[cfg(any(unix, target_vendor = "wasmer"))] fn path_from_bytes(bytes: &[u8]) -> PathBuf { use std::ffi::OsStr; use std::os::unix::ffi::OsStrExt; diff --git a/src/server.rs b/src/server.rs index bf7e7f1a..13cde385 100644 --- a/src/server.rs +++ b/src/server.rs @@ -10,7 +10,10 @@ use hyper::server::Server as HyperServer; use listenfd::ListenFd; use std::net::{IpAddr, SocketAddr, TcpListener}; use std::sync::Arc; -use tokio::sync::{watch::Receiver, Mutex}; +use tokio::sync::watch::Receiver; + +#[cfg(not(target_vendor = "wasmer"))] +use tokio::sync::Mutex; use crate::handler::{RequestHandler, RequestHandlerOpts}; @@ -556,7 +559,7 @@ impl Server { #[cfg(windows)] tokio::try_join!(ctrlc_task, server_task, redirect_server_task)?; - #[cfg(unix)] + #[cfg(any(unix, target_vendor = "wasmer"))] tokio::try_join!(server_task, redirect_server_task)?; #[cfg(unix)] From 13e1c5edd613ea5c7679cab058949470a19a3ed9 Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Thu, 5 Sep 2024 04:34:20 +0330 Subject: [PATCH 2/8] add build and publish steps --- .github/workflows/devel.yml | 46 +++++++++++++++++++++++++++++++++++++ wasmer.toml | 19 +++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 wasmer.toml diff --git a/.github/workflows/devel.yml b/.github/workflows/devel.yml index 874c14be..9b6e237c 100644 --- a/.github/workflows/devel.yml +++ b/.github/workflows/devel.yml @@ -25,6 +25,52 @@ on: - cron: '30 01 * * *' # Every day at 01:30 UTC jobs: + build-wasix: + runs-on: ubuntu-22.04 + name: "Build WASIX" + steps: + - uses: actions/checkout@v4 + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + - name: Install Tools + run: | + sudo apt-get update + sudo apt-get install -y git llvm clang make lld curl + - name: "Install cargo-wasix" + run: | + cargo install cargo-wasix + - name: "Download Toolchain" + run: | + cargo wasix download-toolchain v2024-06-26.1 + - name: "Build" + run: | + cargo wasix build --no-default-features --features compression-gzip,http2 --bin static-web-server --release + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: static-web-server + path: target/wasm32-wasmer-wasi/release/static-web-server.wasm + + publish-wasix: + runs-on: ubuntu-22.04 + if: ${{ github.ref == 'refs/heads/master' }} + needs: [build-wasix] + name: "Publish" + steps: + - uses: actions/checkout@v4 + - name: Download Artifact + uses: actions/download-artifact@v4 + with: + name: static-web-server + - name: Setup Wasmer + uses: wasmerio/setup-wasmer@v3.1 + - name: List contents + run: | + ls + - name: "Push" + run: | + wasmer package push --registry="wasmer.io" --non-interactive --token=${{ secrets.WASMER_CIUSER_PROD_TOKEN }} . + test: name: test runs-on: ${{ matrix.os }} diff --git a/wasmer.toml b/wasmer.toml new file mode 100644 index 00000000..d591a3dc --- /dev/null +++ b/wasmer.toml @@ -0,0 +1,19 @@ +[package] +name = "wasmer/static-web-server" +version = "1.0.4" +description = "Serves static files in response to HTTP GET and HEAD requests." +license = "MIT" +readme = "README.md" +repository = "https://github.com/wasmerio/static-web-server" +homepage = "https://wasmer.io/wasmer/static-web-server" +wasmer-extra-flags = "--enable-threads --enable-bulk-memory" + +[[module]] +name = "webserver" +source = "static-web-server.wasm" +abi = "wasi" + +[[command]] +name = "webserver" +module = "webserver" +runner = "wasi@unstable_" \ No newline at end of file From 9ac5e0f12c7d3aec9c271ab3a44b66824884a1e9 Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Thu, 5 Sep 2024 11:41:57 +0330 Subject: [PATCH 3/8] trigger PR From 42edb2b652a11714229e550ab7cf198b948bcdad Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Thu, 5 Sep 2024 13:34:18 +0330 Subject: [PATCH 4/8] fix wasix build --- Cargo.lock | 131 ----------------------------------------------------- Cargo.toml | 4 +- 2 files changed, 2 insertions(+), 133 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ec26aaa7..83ee3f7b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -434,12 +434,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "const_fn" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373e9fafaa20882876db20562275ff58d50e0caa2590077fe7ce7bef90211d0d" - [[package]] name = "const_format" version = "0.2.32" @@ -681,19 +675,6 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" -[[package]] -name = "git2" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724" -dependencies = [ - "bitflags 2.6.0", - "libc", - "libgit2-sys", - "log", - "url", -] - [[package]] name = "glob" version = "0.3.1" @@ -865,16 +846,6 @@ dependencies = [ "cc", ] -[[package]] -name = "idna" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "indexmap" version = "2.5.0" @@ -941,30 +912,6 @@ name = "libc" version = "0.2.152" source = "git+https://github.com/wasix-org/libc.git?branch=v0.2.152#26f165f162250ad2fc3c6560103eb4e6d7384bce" -[[package]] -name = "libgit2-sys" -version = "0.17.0+1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224" -dependencies = [ - "cc", - "libc", - "libz-sys", - "pkg-config", -] - -[[package]] -name = "libz-sys" -version = "1.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -1551,10 +1498,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a600f795d0894cda22235b44eea4b85c2a35b405f65523645ac8e35b306817a" dependencies = [ "const_format", - "git2", "is_debug", "time 0.3.36", - "tzdb", ] [[package]] @@ -1857,21 +1802,6 @@ dependencies = [ "time-core", ] -[[package]] -name = "tinyvec" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - [[package]] name = "tokio" version = "1.35.1" @@ -2081,35 +2011,6 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "tz-rs" -version = "0.6.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33851b15c848fad2cf4b105c6bb66eb9512b6f6c44a4b13f57c53c73c707e2b4" -dependencies = [ - "const_fn", -] - -[[package]] -name = "tzdb" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b580f6b365fa89f5767cdb619a55d534d04a4e14c2d7e5b9a31e94598687fb1" -dependencies = [ - "iana-time-zone", - "tz-rs", - "tzdb_data", -] - -[[package]] -name = "tzdb_data" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1889fdffac09d65c1d95c42d5202e9b21ad8c758f426e9fe09088817ea998d6" -dependencies = [ - "tz-rs", -] - [[package]] name = "unicase" version = "2.7.0" @@ -2119,27 +2020,12 @@ dependencies = [ "version_check", ] -[[package]] -name = "unicode-bidi" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" - [[package]] name = "unicode-ident" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" -[[package]] -name = "unicode-normalization" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" -dependencies = [ - "tinyvec", -] - [[package]] name = "unicode-xid" version = "0.2.5" @@ -2152,17 +2038,6 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" -[[package]] -name = "url" -version = "2.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - [[package]] name = "utf8parse" version = "0.2.2" @@ -2181,12 +2056,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version_check" version = "0.9.5" diff --git a/Cargo.toml b/Cargo.toml index da4e9541..bca45cb9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -88,7 +88,7 @@ serde = { version = "1.0", default-features = false, features = ["derive"] } serde_ignored = "0.1" serde_json = "1.0" serde_repr = "0.1" -shadow-rs = "0.29" +shadow-rs = { version = "0.29", default-features = false } tokio = { version = "=1.35.1", default-features = false, features = ["rt-multi-thread", "macros", "fs", "io-util", "signal"] } tokio-rustls = { version = "0.26", optional = true, default-features = false, features = ["logging", "tls12", "ring"] } tokio-util = { version = "0.7", default-features = false, features = ["io"] } @@ -117,7 +117,7 @@ bytes = "1.6" serde_json = "1.0" [build-dependencies] -shadow-rs = "0.29" +shadow-rs = { version = "0.29", default-features = false } [profile.release] codegen-units = 1 From b1ee55840fdeefd07f8273fa37291d4e42a94c24 Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Fri, 6 Sep 2024 02:12:48 +0330 Subject: [PATCH 5/8] fix issue with canonicalize --- src/settings/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/settings/mod.rs b/src/settings/mod.rs index 9b598de0..645c5a98 100644 --- a/src/settings/mod.rs +++ b/src/settings/mod.rs @@ -671,10 +671,14 @@ impl Settings { fn read_file_settings(config_file: &Path) -> Result> { if config_file.is_file() { + #[cfg(not(target_vendor = "wasmer"))] let file_path_resolved = config_file .canonicalize() .with_context(|| "unable to resolve toml config file path")?; + #[cfg(target_vendor = "wasmer")] + let file_path_resolved = config_file.to_owned(); + let settings = FileSettings::read(&file_path_resolved).with_context(|| { "unable to read toml config file because has invalid format or unsupported options" })?; From a4451203fb88e995f43ecc78f73e82f4452a8a5b Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Fri, 6 Sep 2024 03:16:54 +0330 Subject: [PATCH 6/8] add directory-listing feature --- .github/workflows/devel.yml | 504 ++++++++++++++++++------------------ src/directory_listing.rs | 21 +- 2 files changed, 271 insertions(+), 254 deletions(-) diff --git a/.github/workflows/devel.yml b/.github/workflows/devel.yml index 9b6e237c..ef9fd4b6 100644 --- a/.github/workflows/devel.yml +++ b/.github/workflows/devel.yml @@ -44,7 +44,7 @@ jobs: cargo wasix download-toolchain v2024-06-26.1 - name: "Build" run: | - cargo wasix build --no-default-features --features compression-gzip,http2 --bin static-web-server --release + cargo wasix build --no-default-features --features compression-gzip,http2,directory-listing --bin static-web-server --release - name: Upload Artifact uses: actions/upload-artifact@v4 with: @@ -71,273 +71,273 @@ jobs: run: | wasmer package push --registry="wasmer.io" --non-interactive --token=${{ secrets.WASMER_CIUSER_PROD_TOKEN }} . - test: - name: test - runs-on: ${{ matrix.os }} - env: - # Cargo binary - CARGO_BIN: cargo - # When CARGO_BIN is set to CROSS, this is set to `--target matrix.target` - TARGET_FLAGS: "" - # When CARGO_BIN is set to CROSS, TARGET_DIR includes matrix.target - TARGET_DIR: ./target - # Emit backtraces on panics - RUST_BACKTRACE: 1 - # Skip tests - SKIP_TESTS: "" - # SWS features for Cargo build - CARGO_FEATURES: "--features=all" - strategy: - matrix: - build: - - pinned - - linux-musl - - linux-musl-arm64 - - linux-musl-i686 - - linux-gnu - - linux-gnu-arm64 - - linux-gnu-i686 - - linux-arm-gnueabihf - - linux-musl-armv6 - - linux-musl-armv7 - - linux-ppc64le - - linux-s390x - # NOTE: looks like not supported by `listenfd` crate - # - linux-android-armv7 - - linux-android-arm64 - - netbsd - - illumos - - macos - - macos-arm64 - - windows-msvc - - windows-msvc-i686 - - windows-msvc-arm64 - - windows-pc-gnu - include: - # Specific Rust channels. - # We test against the latest and minimum Rust stable version. - - build: pinned - os: ubuntu-22.04 - rust: 1.76.0 - # Some of our release builds are generated by a nightly compiler to take - # advantage of the latest optimizations/compile time improvements. - - build: linux-musl - os: ubuntu-22.04 - rust: stable - target: x86_64-unknown-linux-musl - - build: linux-musl-i686 - os: ubuntu-22.04 - rust: stable - target: i686-unknown-linux-musl - - build: linux-musl-arm64 - os: ubuntu-22.04 - rust: stable - target: aarch64-unknown-linux-musl - - build: linux-gnu - os: ubuntu-22.04 - rust: stable - target: x86_64-unknown-linux-gnu - - build: linux-gnu-i686 - os: ubuntu-22.04 - rust: stable - target: i686-unknown-linux-gnu - - build: linux-gnu-arm64 - os: ubuntu-22.04 - rust: stable - target: aarch64-unknown-linux-gnu - - build: linux-arm-gnueabihf - os: ubuntu-22.04 - rust: stable - target: arm-unknown-linux-gnueabihf - - build: linux-musl-armv6 - os: ubuntu-22.04 - rust: stable - target: arm-unknown-linux-musleabihf - - build: linux-musl-armv7 - os: ubuntu-22.04 - rust: stable - target: armv7-unknown-linux-musleabihf - - build: linux-ppc64le - os: ubuntu-22.04 - rust: stable - target: powerpc64le-unknown-linux-gnu - - build: linux-s390x - os: ubuntu-22.04 - rust: stable - target: s390x-unknown-linux-gnu - # NOTE: looks like not supported by `listenfd` crate - # - build: linux-android-armv7 - # os: ubuntu-22.04 - # rust: stable - # target: armv7-linux-androideabi - - build: linux-android-arm64 - os: ubuntu-22.04 - rust: stable - target: aarch64-linux-android - - build: netbsd - os: ubuntu-22.04 - rust: stable - target: x86_64-unknown-netbsd - - build: illumos - os: ubuntu-22.04 - rust: stable - target: x86_64-unknown-illumos - - build: macos - os: macos-12 - rust: stable - target: x86_64-apple-darwin - - build: macos-arm64 - os: macos-12 - rust: stable - target: aarch64-apple-darwin - - build: windows-msvc - os: windows-2022 - rust: 1.77.2 - target: x86_64-pc-windows-msvc - - build: windows-msvc-i686 - os: windows-2022 - rust: 1.77.2 - target: i686-pc-windows-msvc - - build: windows-msvc-arm64 - os: windows-2022 - rust: stable - target: aarch64-pc-windows-msvc - - build: windows-pc-gnu - os: windows-2022 - rust: 1.77.2 - target: x86_64-pc-windows-gnu + # test: + # name: test + # runs-on: ${{ matrix.os }} + # env: + # # Cargo binary + # CARGO_BIN: cargo + # # When CARGO_BIN is set to CROSS, this is set to `--target matrix.target` + # TARGET_FLAGS: "" + # # When CARGO_BIN is set to CROSS, TARGET_DIR includes matrix.target + # TARGET_DIR: ./target + # # Emit backtraces on panics + # RUST_BACKTRACE: 1 + # # Skip tests + # SKIP_TESTS: "" + # # SWS features for Cargo build + # CARGO_FEATURES: "--features=all" + # strategy: + # matrix: + # build: + # - pinned + # - linux-musl + # - linux-musl-arm64 + # - linux-musl-i686 + # - linux-gnu + # - linux-gnu-arm64 + # - linux-gnu-i686 + # - linux-arm-gnueabihf + # - linux-musl-armv6 + # - linux-musl-armv7 + # - linux-ppc64le + # - linux-s390x + # # NOTE: looks like not supported by `listenfd` crate + # # - linux-android-armv7 + # - linux-android-arm64 + # - netbsd + # - illumos + # - macos + # - macos-arm64 + # - windows-msvc + # - windows-msvc-i686 + # - windows-msvc-arm64 + # - windows-pc-gnu + # include: + # # Specific Rust channels. + # # We test against the latest and minimum Rust stable version. + # - build: pinned + # os: ubuntu-22.04 + # rust: 1.76.0 + # # Some of our release builds are generated by a nightly compiler to take + # # advantage of the latest optimizations/compile time improvements. + # - build: linux-musl + # os: ubuntu-22.04 + # rust: stable + # target: x86_64-unknown-linux-musl + # - build: linux-musl-i686 + # os: ubuntu-22.04 + # rust: stable + # target: i686-unknown-linux-musl + # - build: linux-musl-arm64 + # os: ubuntu-22.04 + # rust: stable + # target: aarch64-unknown-linux-musl + # - build: linux-gnu + # os: ubuntu-22.04 + # rust: stable + # target: x86_64-unknown-linux-gnu + # - build: linux-gnu-i686 + # os: ubuntu-22.04 + # rust: stable + # target: i686-unknown-linux-gnu + # - build: linux-gnu-arm64 + # os: ubuntu-22.04 + # rust: stable + # target: aarch64-unknown-linux-gnu + # - build: linux-arm-gnueabihf + # os: ubuntu-22.04 + # rust: stable + # target: arm-unknown-linux-gnueabihf + # - build: linux-musl-armv6 + # os: ubuntu-22.04 + # rust: stable + # target: arm-unknown-linux-musleabihf + # - build: linux-musl-armv7 + # os: ubuntu-22.04 + # rust: stable + # target: armv7-unknown-linux-musleabihf + # - build: linux-ppc64le + # os: ubuntu-22.04 + # rust: stable + # target: powerpc64le-unknown-linux-gnu + # - build: linux-s390x + # os: ubuntu-22.04 + # rust: stable + # target: s390x-unknown-linux-gnu + # # NOTE: looks like not supported by `listenfd` crate + # # - build: linux-android-armv7 + # # os: ubuntu-22.04 + # # rust: stable + # # target: armv7-linux-androideabi + # - build: linux-android-arm64 + # os: ubuntu-22.04 + # rust: stable + # target: aarch64-linux-android + # - build: netbsd + # os: ubuntu-22.04 + # rust: stable + # target: x86_64-unknown-netbsd + # - build: illumos + # os: ubuntu-22.04 + # rust: stable + # target: x86_64-unknown-illumos + # - build: macos + # os: macos-12 + # rust: stable + # target: x86_64-apple-darwin + # - build: macos-arm64 + # os: macos-12 + # rust: stable + # target: aarch64-apple-darwin + # - build: windows-msvc + # os: windows-2022 + # rust: 1.77.2 + # target: x86_64-pc-windows-msvc + # - build: windows-msvc-i686 + # os: windows-2022 + # rust: 1.77.2 + # target: i686-pc-windows-msvc + # - build: windows-msvc-arm64 + # os: windows-2022 + # rust: stable + # target: aarch64-pc-windows-msvc + # - build: windows-pc-gnu + # os: windows-2022 + # rust: 1.77.2 + # target: x86_64-pc-windows-gnu - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 1 + # steps: + # - name: Checkout repository + # uses: actions/checkout@v4 + # with: + # fetch-depth: 1 - - name: Cache Rust Cargo/Toolchain - uses: actions/cache@v3 - with: - path: | - ~/.cargo - **/target - key: rust-${{ matrix.build }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - rust-${{ matrix.build }}-${{ matrix.target }}- + # - name: Cache Rust Cargo/Toolchain + # uses: actions/cache@v3 + # with: + # path: | + # ~/.cargo + # **/target + # key: rust-${{ matrix.build }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} + # restore-keys: | + # rust-${{ matrix.build }}-${{ matrix.target }}- - - name: Install Linux/BSD tools - if: ${{ !contains(matrix.os, 'windows') }} - run: scripts/ci/install_tools.sh --target=${{ matrix.target }} + # - name: Install Linux/BSD tools + # if: ${{ !contains(matrix.os, 'windows') }} + # run: scripts/ci/install_tools.sh --target=${{ matrix.target }} - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - with: - toolchain: ${{ matrix.rust }} - target: ${{ matrix.target }} + # - name: Install Rust + # uses: dtolnay/rust-toolchain@stable + # with: + # toolchain: ${{ matrix.rust }} + # target: ${{ matrix.target }} - - name: Set up Cross - if: ${{ !contains(matrix.os, 'windows') && matrix.target != '' }} - shell: bash - run: | - # Use 'cargo.sh' script for Android targets only - if [[ "${{ matrix.build }}" == "linux-android-armv7" ]] || [[ "${{ matrix.build }}" == "linux-android-arm64" ]]; then - echo "CARGO_BIN=scripts/ci/cargo.sh" >> $GITHUB_ENV - else - target='' - case "${{ matrix.os }}" in - *macos*) - target=x86_64-apple-darwin - ;; - *) - target=x86_64-unknown-linux-musl - ;; - esac + # - name: Set up Cross + # if: ${{ !contains(matrix.os, 'windows') && matrix.target != '' }} + # shell: bash + # run: | + # # Use 'cargo.sh' script for Android targets only + # if [[ "${{ matrix.build }}" == "linux-android-armv7" ]] || [[ "${{ matrix.build }}" == "linux-android-arm64" ]]; then + # echo "CARGO_BIN=scripts/ci/cargo.sh" >> $GITHUB_ENV + # else + # target='' + # case "${{ matrix.os }}" in + # *macos*) + # target=x86_64-apple-darwin + # ;; + # *) + # target=x86_64-unknown-linux-musl + # ;; + # esac - echo "Installing cross..." - curl -sSL \ - "https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-$target.tar.gz" \ - | sudo tar zxf - -C /usr/local/bin/ cross cross-util - cross -V - echo "CARGO_BIN=/usr/local/bin/cross" >> $GITHUB_ENV - fi + # echo "Installing cross..." + # curl -sSL \ + # "https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-$target.tar.gz" \ + # | sudo tar zxf - -C /usr/local/bin/ cross cross-util + # cross -V + # echo "CARGO_BIN=/usr/local/bin/cross" >> $GITHUB_ENV + # fi - - name: Setup Cargo - shell: bash - run: | - if [[ "${{ matrix.target }}" != "" ]]; then - echo "TARGET_FLAGS=--target=${{ matrix.target }}" >> $GITHUB_ENV - echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV - fi - echo "cargo command is: ${{ env.CARGO_BIN }}" - echo "target flag is: ${{ env.TARGET_FLAGS }}" - echo "target dir is: ${{ env.TARGET_DIR }}" + # - name: Setup Cargo + # shell: bash + # run: | + # if [[ "${{ matrix.target }}" != "" ]]; then + # echo "TARGET_FLAGS=--target=${{ matrix.target }}" >> $GITHUB_ENV + # echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV + # fi + # echo "cargo command is: ${{ env.CARGO_BIN }}" + # echo "target flag is: ${{ env.TARGET_FLAGS }}" + # echo "target dir is: ${{ env.TARGET_DIR }}" - - name: Setup Windows ARM64 - if: ${{ contains(matrix.build, 'windows-msvc-arm64') }} - run: | - # ring crate: add Visual Studio Build Tools "VS 2022 C++ ARM64 build tools" and "clang" components - $env:Path += ";C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm\x64\bin" + # - name: Setup Windows ARM64 + # if: ${{ contains(matrix.build, 'windows-msvc-arm64') }} + # run: | + # # ring crate: add Visual Studio Build Tools "VS 2022 C++ ARM64 build tools" and "clang" components + # $env:Path += ";C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm\x64\bin" - - name: Skip tests - shell: bash - if: ${{ contains(fromJSON('["macos-arm64", "linux-android-arm64", "linux-android-armv7", "netbsd", "illumos", "windows-msvc-arm64"]'), matrix.build) }} - run: | - # Can't run tests: cross-compiling - echo "SKIP_TESTS=--no-run" >> $GITHUB_ENV + # - name: Skip tests + # shell: bash + # if: ${{ contains(fromJSON('["macos-arm64", "linux-android-arm64", "linux-android-armv7", "netbsd", "illumos", "windows-msvc-arm64"]'), matrix.build) }} + # run: | + # # Can't run tests: cross-compiling + # echo "SKIP_TESTS=--no-run" >> $GITHUB_ENV - - name: Run tests - shell: bash - run: | - ${{ env.CARGO_BIN }} test --verbose ${{ env.CARGO_FEATURES }} ${{ env.TARGET_FLAGS }} ${{ env.SKIP_TESTS }} + # - name: Run tests + # shell: bash + # run: | + # ${{ env.CARGO_BIN }} test --verbose ${{ env.CARGO_FEATURES }} ${{ env.TARGET_FLAGS }} ${{ env.SKIP_TESTS }} - - name: Run build - shell: bash - run: | - ${{ env.CARGO_BIN }} build --bin static-web-server -vv ${{ env.CARGO_FEATURES }} ${{ env.TARGET_FLAGS }} + # - name: Run build + # shell: bash + # run: | + # ${{ env.CARGO_BIN }} build --bin static-web-server -vv ${{ env.CARGO_FEATURES }} ${{ env.TARGET_FLAGS }} - - name: Run executable - shell: bash - run: | - case "${{ matrix.build }}" in - *-arm*|*bsd*|*illumos*|*ppc64*|*s390x*) - echo "arm,bsd,illumos,ppc64,s390x are unable to execute on CI for now!" - ;; - *) - if [[ "${{ matrix.os }}" == "windows-2022" ]]; then - target/${{ matrix.target }}/debug/static-web-server.exe -h - else - target/${{ matrix.target }}/debug/static-web-server -h - fi - ;; - esac + # - name: Run executable + # shell: bash + # run: | + # case "${{ matrix.build }}" in + # *-arm*|*bsd*|*illumos*|*ppc64*|*s390x*) + # echo "arm,bsd,illumos,ppc64,s390x are unable to execute on CI for now!" + # ;; + # *) + # if [[ "${{ matrix.os }}" == "windows-2022" ]]; then + # target/${{ matrix.target }}/debug/static-web-server.exe -h + # else + # target/${{ matrix.target }}/debug/static-web-server -h + # fi + # ;; + # esac - checks: - name: checks - runs-on: ubuntu-22.04 + # checks: + # name: checks + # runs-on: ubuntu-22.04 - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 1 + # steps: + # - name: Checkout repository + # uses: actions/checkout@v4 + # with: + # fetch-depth: 1 - - name: Check typos - uses: crate-ci/typos@master - with: - config: ./.github/workflows/config/typos.toml + # - name: Check typos + # uses: crate-ci/typos@master + # with: + # config: ./.github/workflows/config/typos.toml - - name: Install stable toolchain - uses: dtolnay/rust-toolchain@stable - with: - toolchain: stable - components: rustfmt, clippy + # - name: Install stable toolchain + # uses: dtolnay/rust-toolchain@stable + # with: + # toolchain: stable + # components: rustfmt, clippy - - name: Check formatting - run: | - cargo fmt --all -- --check + # - name: Check formatting + # run: | + # cargo fmt --all -- --check - - name: Check via Clippy - run: | - cargo clippy --all-features -- -D warnings + # - name: Check via Clippy + # run: | + # cargo clippy --all-features -- -D warnings - - name: Check crate docs - run: | - cargo doc --lib --no-deps + # - name: Check crate docs + # run: | + # cargo doc --lib --no-deps diff --git a/src/directory_listing.rs b/src/directory_listing.rs index 485958a6..1202a123 100644 --- a/src/directory_listing.rs +++ b/src/directory_listing.rs @@ -209,7 +209,16 @@ fn read_dir_entries(mut opt: DirEntryOpts<'_>) -> Result> { let name = dir_entry.file_name(); // Check and ignore the current hidden file/directory (dotfile) if feature enabled - if opt.ignore_hidden_files && name.as_encoded_bytes().first().is_some_and(|c| *c == b'.') { + // FIXME: This should be switched back to using as_encoded_bytes once we upgrade the toolchain + // to use the latest Rust version + if opt.ignore_hidden_files + && name + .to_str() + .ok_or_else(|| anyhow::anyhow!("failed to convert name to str"))? + .as_bytes() + .first() + .is_some_and(|c| *c == b'.') + { continue; } @@ -258,7 +267,15 @@ fn read_dir_entries(mut opt: DirEntryOpts<'_>) -> Result> { continue; }; - let name_encoded = percent_encode(name.as_encoded_bytes(), PERCENT_ENCODE_SET).to_string(); + // FIXME: This should be switched back to using as_encoded_bytes once we upgrade the toolchain + // to use the latest Rust version + let name_encoded = percent_encode( + name.to_str() + .ok_or_else(|| anyhow::anyhow!("failed to convert name to str"))? + .as_bytes(), + PERCENT_ENCODE_SET, + ) + .to_string(); // NOTE: Use relative paths by default independently of // the "redirect trailing slash" feature. From d789ee142c8e6ead7b23f6e89d4b6fc296cc797b Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Fri, 6 Sep 2024 03:18:27 +0330 Subject: [PATCH 7/8] disable audit and perfcheck --- .github/workflows/audit.yml | 52 ++-- .github/workflows/perfcheck.yml | 464 ++++++++++++++++---------------- 2 files changed, 258 insertions(+), 258 deletions(-) diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index baebe9bc..8b6e16aa 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -1,28 +1,28 @@ -name: audit -on: - schedule: - - cron: '10 01 * * *' # Every day at 01:10 UTC - push: - branches: - - master - paths: - - "**/Cargo.lock" - - "**/Cargo.toml" - pull_request: - branches: - - master - paths: - - "**/Cargo.lock" - - "**/Cargo.toml" +# name: audit +# on: +# schedule: +# - cron: '10 01 * * *' # Every day at 01:10 UTC +# push: +# branches: +# - master +# paths: +# - "**/Cargo.lock" +# - "**/Cargo.toml" +# pull_request: +# branches: +# - master +# paths: +# - "**/Cargo.lock" +# - "**/Cargo.toml" -jobs: - audit: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 1 +# jobs: +# audit: +# runs-on: ubuntu-22.04 +# steps: +# - uses: actions/checkout@v3 +# with: +# fetch-depth: 1 - - uses: actions-rs/audit-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} +# - uses: actions-rs/audit-check@v1 +# with: +# token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/perfcheck.yml b/.github/workflows/perfcheck.yml index 89bab5d3..02ac5973 100644 --- a/.github/workflows/perfcheck.yml +++ b/.github/workflows/perfcheck.yml @@ -1,232 +1,232 @@ -name: perfcheck -on: - # merge_group: - # branches: - # - master - pull_request: - paths: - - .github/workflows/perfcheck.yml - - .cargo/config.toml - - scripts/ci/vegeta_report_to_csv.jq - - Cargo.lock - - Cargo.toml - - src/** - push: - branches: - - master - paths: - - .github/workflows/perfcheck.yml - - .cargo/config.toml - - scripts/ci/vegeta_report_to_csv.jq - - Cargo.lock - - Cargo.toml - - src/** - -jobs: - benchmark: - name: benchmark - runs-on: ubuntu-22.04 - env: - # Cargo binary - CARGO_BIN: cargo - # When CARGO_BIN is set to CROSS, this is set to `--target matrix.target`. - TARGET_FLAGS: "" - # When CARGO_BIN is set to CROSS, TARGET_DIR includes matrix.target. - TARGET_DIR: ./target - # Rustc flags needed by the `all` features - RUSTFLAGS: "--cfg tokio_unstable" - # SWS features for Cargo build - CARGO_FEATURES: "--features=all" - # Version of the vegeta binary - VEGETA_VERSION: "12.11.1" - # Command-line parameters for the vegeta binary - VEGETA_FLAGS: "-workers=4 -connections=100 -rate=${{ matrix.rate }} -duration=10s" - # Version of the caddy binary - CADDY_VERSION: "2.7.6" - - strategy: - matrix: - include: - - title: "Small file (dynamic compression)" - url: http://localhost:8080/small.txt - rate: "1000/s" - - title: "Small file (pre-compressed)" - url: http://localhost:8080/small_precompressed.txt - rate: "1000/s" - - title: "Large file (dynamic compression)" - url: http://localhost:8080/large.txt - rate: "200/s" - - title: "Large file (pre-compressed)" - url: http://localhost:8080/large_precompressed.txt - rate: "500/s" - - title: "Directory listing (many files)" - url: http://localhost:8080/ - rate: "1000/s" - - title: "Directory listing (empty directory)" - url: http://localhost:8080/emptydir/ - rate: "1000/s" - - title: "Small directory index file" - url: http://localhost:8080/dirsmallindex/ - rate: "1000/s" - - title: "Large directory index file" - url: http://localhost:8080/dirlargeindex/ - rate: "200/s" - - title: "Not found" - url: http://localhost:8080/not_found - rate: "1000/s" - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - - name: Checkout benchmark-setup repository - uses: actions/checkout@v4 - with: - repository: static-web-server/benchmarks-setup - ref: v0.2 - path: benchmarks-setup - fetch-depth: 1 - - - name: Cache Rust Cargo/Toolchain - uses: actions/cache@v4 - with: - path: | - ~/.cargo - **/target - key: rust-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - rust- - - - name: Install vegeta binary - run: | - curl -L https://github.com/tsenart/vegeta/releases/download/v${{ env.VEGETA_VERSION }}/vegeta_${{ env.VEGETA_VERSION }}_linux_amd64.tar.gz | tar xz - echo "Downloaded vegeta" - ./vegeta --version - - - name: Install caddy binary - run: | - curl -L https://github.com/caddyserver/caddy/releases/download/v${{ env.CADDY_VERSION }}/caddy_${{ env.CADDY_VERSION }}_linux_amd64.tar.gz | tar xz caddy - echo "Downloaded caddy" - ./caddy --version - - - name: Install web server software - uses: awalsh128/cache-apt-pkgs-action@latest - with: - packages: apache2 lighttpd nginx - version: 1.0 - - - name: Install Rust - uses: dtolnay/rust-toolchain@stable - with: - toolchain: stable - target: x86_64-unknown-linux-gnu - - - name: Show command used for Cargo - run: | - echo "cargo command is: ${{ env.CARGO_BIN }}" - echo "target flag is: ${{ env.TARGET_FLAGS }}" - echo "target dir is: ${{ env.TARGET_DIR }}" - - - name: Build release binary - run: ${{ env.CARGO_BIN }} build --bin static-web-server -vv --release ${{ env.CARGO_FEATURES }} ${{ env.TARGET_FLAGS }} - - - name: Initialize graph.csv - run: echo "Sample, min, mean, 50th, 90th, 95th, 99th, max" > graph.csv - - - name: Run SWS benchmark - run: | - NAME=$(${{ env.TARGET_DIR }}/release/static-web-server --version | head -n 1 | sed -e 's/^Version: */sws /' -e 's/static-web-server/sws/' -e 's/$/ (src)/') - REPORT=report_sws.bin - ${{ env.TARGET_DIR }}/release/static-web-server --config-file benchmarks-setup/config/sws.toml & - sleep 2 - echo "GET ${{ matrix.url }}" | ./vegeta attack -name "$NAME" ${{ env.VEGETA_FLAGS }} > $REPORT - kill %1 - ./vegeta report -type=text $REPORT - ./vegeta report -type=json $REPORT | jq --arg name "$NAME" -r -f scripts/ci/vegeta_report_to_csv.jq >> graph.csv - - - name: Run Apache benchmark - run: | - NAME=$(apache2 -v | sed 's/.*: //' | sed 's/ .*//' | sed 's!/! !' | tr '[:upper:]' '[:lower:]') - REPORT=report_apache.bin - apache2 -D FOREGROUND -f `pwd`/benchmarks-setup/config/apache.conf & - sleep 2 - echo "GET ${{ matrix.url }}" | ./vegeta attack -name "$NAME" ${{ env.VEGETA_FLAGS }} > $REPORT - kill %1 - ./vegeta report -type=text $REPORT - ./vegeta report -type=json $REPORT | jq --arg name "$NAME" -r -f scripts/ci/vegeta_report_to_csv.jq >> graph.csv - - - name: Run lighttpd benchmark - run: | - NAME=$(lighttpd -v | sed 's/ .*//' | sed 's!/! !') - REPORT=report_lighttpd.bin - lighttpd -D -f `pwd`/benchmarks-setup/config/lighttpd.conf & - sleep 2 - URL="${{ matrix.url }}" - if [[ $URL == *"_precompressed"* ]]; then - # lighttpd does not really support pre-compressed files, request them explicitly - URL="${{ matrix.url }}.gz" - fi - echo "GET $URL" | ./vegeta attack -name "$NAME" ${{ env.VEGETA_FLAGS }} > $REPORT - kill %1 - ./vegeta report -type=text $REPORT - ./vegeta report -type=json $REPORT | jq --arg name "$NAME" -r -f scripts/ci/vegeta_report_to_csv.jq >> graph.csv - - - name: Run nginx benchmark - run: | - NAME=$(nginx -v 2>&1 | sed 's/.*: //' | sed 's/ .*//' | sed 's!/! !') - REPORT=report_nginx.bin - nginx -c `pwd`/benchmarks-setup/config/nginx.conf & - sleep 2 - echo "GET ${{ matrix.url }}" | ./vegeta attack -name "$NAME" ${{ env.VEGETA_FLAGS }} > $REPORT - kill %1 - ./vegeta report -type=text $REPORT - ./vegeta report -type=json $REPORT | jq --arg name "$NAME" -r -f scripts/ci/vegeta_report_to_csv.jq >> graph.csv - - - name: Run caddy benchmark - run: | - NAME="caddy $(./caddy -v | sed 's/ .*//')" - REPORT=report_caddy.bin - ./caddy run -c `pwd`/benchmarks-setup/config/Caddyfile & - sleep 2 - echo "GET ${{ matrix.url }}" | ./vegeta attack -name "$NAME" ${{ env.VEGETA_FLAGS }} > $REPORT - kill %1 - ./vegeta report -type=text $REPORT - ./vegeta report -type=json $REPORT | jq --arg name "$NAME" -r -f scripts/ci/vegeta_report_to_csv.jq >> graph.csv - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.12' - - - name: Install pipx - run: pip install pipx - - - name: Produce plot - run: | - ./vegeta plot --title "${{ matrix.title }}" report_*.bin > detailed_plot.html - cat graph.csv - cat graph.csv | sed -e 's/,/|/g' -e 's/"//g' -e 's/^/|/' -e 's/$/|/' -e '2 i |-|-|-|-|-|-|-|-|' >> $GITHUB_STEP_SUMMARY - pipx run graph-cli --barh --bar-label --xlabel '' --ylabel 'Latency (ms)' --title "${{ matrix.title }}" --figsize 1200x800 --fontsize 10 --ytick-angle 45 --ytick-align top -o overview.png graph.csv - - - name: Upload benchmark plots - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.title }} - path: | - detailed_plot.html - overview.png - - merge-artifacts: - name: merge-artifacts - needs: benchmark - runs-on: ubuntu-22.04 - - steps: - - name: Merge benchmark plots - uses: actions/upload-artifact/merge@v4 - with: - name: Benchmark plots - separate-directories: true - delete-merged: true +# name: perfcheck +# on: +# # merge_group: +# # branches: +# # - master +# pull_request: +# paths: +# - .github/workflows/perfcheck.yml +# - .cargo/config.toml +# - scripts/ci/vegeta_report_to_csv.jq +# - Cargo.lock +# - Cargo.toml +# - src/** +# push: +# branches: +# - master +# paths: +# - .github/workflows/perfcheck.yml +# - .cargo/config.toml +# - scripts/ci/vegeta_report_to_csv.jq +# - Cargo.lock +# - Cargo.toml +# - src/** + +# jobs: +# benchmark: +# name: benchmark +# runs-on: ubuntu-22.04 +# env: +# # Cargo binary +# CARGO_BIN: cargo +# # When CARGO_BIN is set to CROSS, this is set to `--target matrix.target`. +# TARGET_FLAGS: "" +# # When CARGO_BIN is set to CROSS, TARGET_DIR includes matrix.target. +# TARGET_DIR: ./target +# # Rustc flags needed by the `all` features +# RUSTFLAGS: "--cfg tokio_unstable" +# # SWS features for Cargo build +# CARGO_FEATURES: "--features=all" +# # Version of the vegeta binary +# VEGETA_VERSION: "12.11.1" +# # Command-line parameters for the vegeta binary +# VEGETA_FLAGS: "-workers=4 -connections=100 -rate=${{ matrix.rate }} -duration=10s" +# # Version of the caddy binary +# CADDY_VERSION: "2.7.6" + +# strategy: +# matrix: +# include: +# - title: "Small file (dynamic compression)" +# url: http://localhost:8080/small.txt +# rate: "1000/s" +# - title: "Small file (pre-compressed)" +# url: http://localhost:8080/small_precompressed.txt +# rate: "1000/s" +# - title: "Large file (dynamic compression)" +# url: http://localhost:8080/large.txt +# rate: "200/s" +# - title: "Large file (pre-compressed)" +# url: http://localhost:8080/large_precompressed.txt +# rate: "500/s" +# - title: "Directory listing (many files)" +# url: http://localhost:8080/ +# rate: "1000/s" +# - title: "Directory listing (empty directory)" +# url: http://localhost:8080/emptydir/ +# rate: "1000/s" +# - title: "Small directory index file" +# url: http://localhost:8080/dirsmallindex/ +# rate: "1000/s" +# - title: "Large directory index file" +# url: http://localhost:8080/dirlargeindex/ +# rate: "200/s" +# - title: "Not found" +# url: http://localhost:8080/not_found +# rate: "1000/s" + +# steps: +# - name: Checkout repository +# uses: actions/checkout@v4 +# with: +# fetch-depth: 1 + +# - name: Checkout benchmark-setup repository +# uses: actions/checkout@v4 +# with: +# repository: static-web-server/benchmarks-setup +# ref: v0.2 +# path: benchmarks-setup +# fetch-depth: 1 + +# - name: Cache Rust Cargo/Toolchain +# uses: actions/cache@v4 +# with: +# path: | +# ~/.cargo +# **/target +# key: rust-${{ hashFiles('**/Cargo.lock') }} +# restore-keys: | +# rust- + +# - name: Install vegeta binary +# run: | +# curl -L https://github.com/tsenart/vegeta/releases/download/v${{ env.VEGETA_VERSION }}/vegeta_${{ env.VEGETA_VERSION }}_linux_amd64.tar.gz | tar xz +# echo "Downloaded vegeta" +# ./vegeta --version + +# - name: Install caddy binary +# run: | +# curl -L https://github.com/caddyserver/caddy/releases/download/v${{ env.CADDY_VERSION }}/caddy_${{ env.CADDY_VERSION }}_linux_amd64.tar.gz | tar xz caddy +# echo "Downloaded caddy" +# ./caddy --version + +# - name: Install web server software +# uses: awalsh128/cache-apt-pkgs-action@latest +# with: +# packages: apache2 lighttpd nginx +# version: 1.0 + +# - name: Install Rust +# uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: stable +# target: x86_64-unknown-linux-gnu + +# - name: Show command used for Cargo +# run: | +# echo "cargo command is: ${{ env.CARGO_BIN }}" +# echo "target flag is: ${{ env.TARGET_FLAGS }}" +# echo "target dir is: ${{ env.TARGET_DIR }}" + +# - name: Build release binary +# run: ${{ env.CARGO_BIN }} build --bin static-web-server -vv --release ${{ env.CARGO_FEATURES }} ${{ env.TARGET_FLAGS }} + +# - name: Initialize graph.csv +# run: echo "Sample, min, mean, 50th, 90th, 95th, 99th, max" > graph.csv + +# - name: Run SWS benchmark +# run: | +# NAME=$(${{ env.TARGET_DIR }}/release/static-web-server --version | head -n 1 | sed -e 's/^Version: */sws /' -e 's/static-web-server/sws/' -e 's/$/ (src)/') +# REPORT=report_sws.bin +# ${{ env.TARGET_DIR }}/release/static-web-server --config-file benchmarks-setup/config/sws.toml & +# sleep 2 +# echo "GET ${{ matrix.url }}" | ./vegeta attack -name "$NAME" ${{ env.VEGETA_FLAGS }} > $REPORT +# kill %1 +# ./vegeta report -type=text $REPORT +# ./vegeta report -type=json $REPORT | jq --arg name "$NAME" -r -f scripts/ci/vegeta_report_to_csv.jq >> graph.csv + +# - name: Run Apache benchmark +# run: | +# NAME=$(apache2 -v | sed 's/.*: //' | sed 's/ .*//' | sed 's!/! !' | tr '[:upper:]' '[:lower:]') +# REPORT=report_apache.bin +# apache2 -D FOREGROUND -f `pwd`/benchmarks-setup/config/apache.conf & +# sleep 2 +# echo "GET ${{ matrix.url }}" | ./vegeta attack -name "$NAME" ${{ env.VEGETA_FLAGS }} > $REPORT +# kill %1 +# ./vegeta report -type=text $REPORT +# ./vegeta report -type=json $REPORT | jq --arg name "$NAME" -r -f scripts/ci/vegeta_report_to_csv.jq >> graph.csv + +# - name: Run lighttpd benchmark +# run: | +# NAME=$(lighttpd -v | sed 's/ .*//' | sed 's!/! !') +# REPORT=report_lighttpd.bin +# lighttpd -D -f `pwd`/benchmarks-setup/config/lighttpd.conf & +# sleep 2 +# URL="${{ matrix.url }}" +# if [[ $URL == *"_precompressed"* ]]; then +# # lighttpd does not really support pre-compressed files, request them explicitly +# URL="${{ matrix.url }}.gz" +# fi +# echo "GET $URL" | ./vegeta attack -name "$NAME" ${{ env.VEGETA_FLAGS }} > $REPORT +# kill %1 +# ./vegeta report -type=text $REPORT +# ./vegeta report -type=json $REPORT | jq --arg name "$NAME" -r -f scripts/ci/vegeta_report_to_csv.jq >> graph.csv + +# - name: Run nginx benchmark +# run: | +# NAME=$(nginx -v 2>&1 | sed 's/.*: //' | sed 's/ .*//' | sed 's!/! !') +# REPORT=report_nginx.bin +# nginx -c `pwd`/benchmarks-setup/config/nginx.conf & +# sleep 2 +# echo "GET ${{ matrix.url }}" | ./vegeta attack -name "$NAME" ${{ env.VEGETA_FLAGS }} > $REPORT +# kill %1 +# ./vegeta report -type=text $REPORT +# ./vegeta report -type=json $REPORT | jq --arg name "$NAME" -r -f scripts/ci/vegeta_report_to_csv.jq >> graph.csv + +# - name: Run caddy benchmark +# run: | +# NAME="caddy $(./caddy -v | sed 's/ .*//')" +# REPORT=report_caddy.bin +# ./caddy run -c `pwd`/benchmarks-setup/config/Caddyfile & +# sleep 2 +# echo "GET ${{ matrix.url }}" | ./vegeta attack -name "$NAME" ${{ env.VEGETA_FLAGS }} > $REPORT +# kill %1 +# ./vegeta report -type=text $REPORT +# ./vegeta report -type=json $REPORT | jq --arg name "$NAME" -r -f scripts/ci/vegeta_report_to_csv.jq >> graph.csv + +# - name: Set up Python +# uses: actions/setup-python@v5 +# with: +# python-version: '3.12' + +# - name: Install pipx +# run: pip install pipx + +# - name: Produce plot +# run: | +# ./vegeta plot --title "${{ matrix.title }}" report_*.bin > detailed_plot.html +# cat graph.csv +# cat graph.csv | sed -e 's/,/|/g' -e 's/"//g' -e 's/^/|/' -e 's/$/|/' -e '2 i |-|-|-|-|-|-|-|-|' >> $GITHUB_STEP_SUMMARY +# pipx run graph-cli --barh --bar-label --xlabel '' --ylabel 'Latency (ms)' --title "${{ matrix.title }}" --figsize 1200x800 --fontsize 10 --ytick-angle 45 --ytick-align top -o overview.png graph.csv + +# - name: Upload benchmark plots +# uses: actions/upload-artifact@v4 +# with: +# name: ${{ matrix.title }} +# path: | +# detailed_plot.html +# overview.png + +# merge-artifacts: +# name: merge-artifacts +# needs: benchmark +# runs-on: ubuntu-22.04 + +# steps: +# - name: Merge benchmark plots +# uses: actions/upload-artifact/merge@v4 +# with: +# name: Benchmark plots +# separate-directories: true +# delete-merged: true From 6a2a78d1efc2ec67b32b29dc081cc83b1336f993 Mon Sep 17 00:00:00 2001 From: "M.Amin Rayej" Date: Fri, 6 Sep 2024 03:23:29 +0330 Subject: [PATCH 8/8] disable code analyzer for now --- .github/workflows/devel.code-analyzer.yml | 116 +++++++++++----------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/.github/workflows/devel.code-analyzer.yml b/.github/workflows/devel.code-analyzer.yml index 5dff7539..3a08a783 100644 --- a/.github/workflows/devel.code-analyzer.yml +++ b/.github/workflows/devel.code-analyzer.yml @@ -1,64 +1,64 @@ -name: code-analyzer -on: - push: - branches: - - master - paths: - - .github/workflows/devel.yml - - .github/workflows/devel.code-analyzer.yml - - .cargo/config.toml - - Cargo.lock - - Cargo.toml - - src/** - - tests/** - merge_group: - branches: - - master - pull_request: - branches: - - master - paths: - - .github/workflows/devel.yml - - .github/workflows/devel.code-analyzer.yml - - .cargo/config.toml - - Cargo.lock - - Cargo.toml - - src/** - - tests/** - schedule: - - cron: '20 02 * * 1' # Runs at 02:20, only on Monday +# name: code-analyzer +# on: +# push: +# branches: +# - master +# paths: +# - .github/workflows/devel.yml +# - .github/workflows/devel.code-analyzer.yml +# - .cargo/config.toml +# - Cargo.lock +# - Cargo.toml +# - src/** +# - tests/** +# merge_group: +# branches: +# - master +# pull_request: +# branches: +# - master +# paths: +# - .github/workflows/devel.yml +# - .github/workflows/devel.code-analyzer.yml +# - .cargo/config.toml +# - Cargo.lock +# - Cargo.toml +# - src/** +# - tests/** +# schedule: +# - cron: '20 02 * * 1' # Runs at 02:20, only on Monday -jobs: - analyze: - name: analyze - runs-on: ubuntu-22.04 - permissions: - contents: read - security-events: write - actions: read +# jobs: +# analyze: +# name: analyze +# runs-on: ubuntu-22.04 +# permissions: +# contents: read +# security-events: write +# actions: read - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 1 +# steps: +# - name: Checkout repository +# uses: actions/checkout@v4 +# with: +# fetch-depth: 1 - - name: Install stable toolchain - uses: dtolnay/rust-toolchain@stable - with: - toolchain: stable - components: rustfmt, clippy +# - name: Install stable toolchain +# uses: dtolnay/rust-toolchain@stable +# with: +# toolchain: stable +# components: rustfmt, clippy - - name: Install crates - run: cargo install clippy-sarif sarif-fmt +# - name: Install crates +# run: cargo install clippy-sarif sarif-fmt - - name: Run clippy - continue-on-error: true - run: | - cargo clippy --all-features --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt +# - name: Run clippy +# continue-on-error: true +# run: | +# cargo clippy --all-features --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt - - name: Upload analysis results to GitHub - uses: github/codeql-action/upload-sarif@v2 - with: - sarif_file: rust-clippy-results.sarif - wait-for-processing: true +# - name: Upload analysis results to GitHub +# uses: github/codeql-action/upload-sarif@v2 +# with: +# sarif_file: rust-clippy-results.sarif +# wait-for-processing: true