From 775664bd30bd5f66a7566d3ff199facfc7c6a623 Mon Sep 17 00:00:00 2001 From: l3r8yJ Date: Fri, 14 Jun 2024 14:18:15 +0300 Subject: [PATCH 01/17] feat(multi-module): splitted to modules --- Cargo.toml | 27 +++++------------------ cli/Cargo.toml | 11 +++++++++ cli/src/main.rs | 3 +++ server/Cargo.toml | 24 ++++++++++++++++++++ {resources => server/resources}/home.json | 0 src/main.rs => server/src/lib.rs | 24 ++++++++++++-------- {src => server/src}/routes/home.rs | 0 {src => server/src}/routes/mod.rs | 0 {src => server/src}/routes/rs_err.rs | 0 {src => server/src}/xml/mod.rs | 0 {src => server/src}/xml/storage.rs | 0 11 files changed, 59 insertions(+), 30 deletions(-) create mode 100644 cli/Cargo.toml create mode 100644 cli/src/main.rs create mode 100644 server/Cargo.toml rename {resources => server/resources}/home.json (100%) rename src/main.rs => server/src/lib.rs (79%) rename {src => server/src}/routes/home.rs (100%) rename {src => server/src}/routes/mod.rs (100%) rename {src => server/src}/routes/rs_err.rs (100%) rename {src => server/src}/xml/mod.rs (100%) rename {src => server/src}/xml/storage.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index c23b6b20..cc7fb442 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,25 +19,10 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +[workspace] +members = [ + "server", + "cli", +] -[package] -name = "fakehub" -version = "0.0.0" -edition = "2021" -license = "MIT" -description = """ -GitHub API Server Stub. Fully functional fake version of a GitHub API that -supports all the features and works locally, with no connection to GitHub at -all. -""" -authors = ["Aliaksei BialĂ­auski ", "Ivanchuk Ivan "] - -[dependencies] -anyhow = "1.0.86" -serde = { version = "1.0.203", features = ["derive"] } -serde_json = "1.0.117" -tokio = { version = "1.0.0", features = ["rt", "rt-multi-thread", "macros", "fs"] } -axum = "0.7.5" -log = { version = "0.4.21", features = [] } -env_logger = "0.11.3" -tempdir = "0.3.7" +resolver = "1" diff --git a/cli/Cargo.toml b/cli/Cargo.toml new file mode 100644 index 00000000..1e410bf2 --- /dev/null +++ b/cli/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "cli" +version = "0.1.0" +edition = "2021" + +[[bin]] +name = "fakehub-cli" +path = "src/main.rs" + +[dependencies] +server = { path = "../server" } \ No newline at end of file diff --git a/cli/src/main.rs b/cli/src/main.rs new file mode 100644 index 00000000..e7a11a96 --- /dev/null +++ b/cli/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/server/Cargo.toml b/server/Cargo.toml new file mode 100644 index 00000000..be4c1443 --- /dev/null +++ b/server/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "fakehub" +version = "0.0.0" +edition = "2021" +license = "MIT" +description = """ +GitHub API Server Stub. Fully functional fake version of a GitHub API that +supports all the features and works locally, with no connection to GitHub at +all. +""" +authors = ["Aliaksei BialĂ­auski ", "Ivanchuk Ivan "] + +[lib] +path = "src/lib.rs" + +[dependencies] +anyhow = "1.0.86" +serde = { version = "1.0.203", features = ["derive"] } +serde_json = "1.0.117" +tokio = { version = "1.0.0", features = ["rt", "rt-multi-thread", "macros", "fs"] } +axum = "0.7.5" +log = { version = "0.4.21", features = [] } +env_logger = "0.11.3" +tempdir = "0.3.7" diff --git a/resources/home.json b/server/resources/home.json similarity index 100% rename from resources/home.json rename to server/resources/home.json diff --git a/src/main.rs b/server/src/lib.rs similarity index 79% rename from src/main.rs rename to server/src/lib.rs index 50bb2df1..1f079567 100644 --- a/src/main.rs +++ b/server/src/lib.rs @@ -1,3 +1,4 @@ +use axum::Router; // The MIT License (MIT) // // Copyright (c) 2024 Aliaksei Bialiauski @@ -20,16 +21,21 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. use axum::routing::get; -use axum::Router; -mod routes; -mod xml; + use crate::routes::home; use crate::xml::storage::touch_storage; -#[tokio::main] -async fn main() { - touch_storage(Some("fakehub.xml")); - let app = Router::new().route("/", get(home::home)); - let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap(); - axum::serve(listener, app).await.unwrap(); +mod routes; +mod xml; + +#[derive(Default)] +pub struct Server {} + +impl Server { + pub async fn start() { + touch_storage(Some("fakehub.xml")); + let app = Router::new().route("/", get(home::home)); + let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap(); + axum::serve(listener, app).await.unwrap(); + } } diff --git a/src/routes/home.rs b/server/src/routes/home.rs similarity index 100% rename from src/routes/home.rs rename to server/src/routes/home.rs diff --git a/src/routes/mod.rs b/server/src/routes/mod.rs similarity index 100% rename from src/routes/mod.rs rename to server/src/routes/mod.rs diff --git a/src/routes/rs_err.rs b/server/src/routes/rs_err.rs similarity index 100% rename from src/routes/rs_err.rs rename to server/src/routes/rs_err.rs diff --git a/src/xml/mod.rs b/server/src/xml/mod.rs similarity index 100% rename from src/xml/mod.rs rename to server/src/xml/mod.rs diff --git a/src/xml/storage.rs b/server/src/xml/storage.rs similarity index 100% rename from src/xml/storage.rs rename to server/src/xml/storage.rs From ebf9f1011e9e14098a2b82799e5c115d6a4c3ad0 Mon Sep 17 00:00:00 2001 From: l3r8yJ Date: Sat, 15 Jun 2024 04:50:36 +0300 Subject: [PATCH 02/17] feat(multi-module): fixes --- cli/Cargo.toml | 4 +++- cli/src/main.rs | 8 ++++++-- server/Cargo.toml | 2 +- server/src/lib.rs | 36 +++++++++++++++++++++++++++++++----- 4 files changed, 41 insertions(+), 9 deletions(-) diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 1e410bf2..8e2c2cbb 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -8,4 +8,6 @@ name = "fakehub-cli" path = "src/main.rs" [dependencies] -server = { path = "../server" } \ No newline at end of file +clap = "4.5.7" +server = { path = "../server" } +tokio = { version = "1.0.0", features = ["rt", "rt-multi-thread", "macros"] } \ No newline at end of file diff --git a/cli/src/main.rs b/cli/src/main.rs index e7a11a96..b62c0310 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -1,3 +1,7 @@ -fn main() { - println!("Hello, world!"); +use server::Server; + +#[tokio::main] +async fn main() { + let server = Server::new(3000); + server.start().await.expect("Can't start the server"); } diff --git a/server/Cargo.toml b/server/Cargo.toml index be4c1443..b4bdd3c5 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "fakehub" +name = "server" version = "0.0.0" edition = "2021" license = "MIT" diff --git a/server/src/lib.rs b/server/src/lib.rs index 1f079567..768e10d2 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -21,6 +21,7 @@ use axum::Router; // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. use axum::routing::get; +use tokio::net::TcpListener; use crate::routes::home; use crate::xml::storage::touch_storage; @@ -29,13 +30,38 @@ mod routes; mod xml; #[derive(Default)] -pub struct Server {} +pub struct Server { + port: usize, +} + +impl Server { + pub fn new(port: usize) -> Server { + Server { port } + } +} impl Server { - pub async fn start() { + pub async fn start(self) -> anyhow::Result<()>{ touch_storage(Some("fakehub.xml")); - let app = Router::new().route("/", get(home::home)); - let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap(); - axum::serve(listener, app).await.unwrap(); + let app: Router = Router::new().route("/", get(home::home)); + let addr: String = format!("0.0.0.0:{}", self.port); + let started: std::io::Result = TcpListener::bind(addr.clone()).await; + match started { + Ok(listener) => axum::serve(listener, app).await?, + Err(err) => { + panic!("Can't bind address {}: '{}'", addr.clone(), err) + } + }; + Ok(()) + } +} + +mod tests { + + #[test] + fn creates_the_server() -> anyhow::Result<()> { + let server = crate::Server::new(1234); + assert_eq!(server.port, 1234); + Ok(()) } } From 5baeb45cd876be349a48dd920b0547da5fa2ff50 Mon Sep 17 00:00:00 2001 From: l3r8yJ Date: Sat, 15 Jun 2024 04:53:43 +0300 Subject: [PATCH 03/17] chore(#13): add license --- cli/Cargo.toml | 21 +++++++++++++++++++++ cli/src/main.rs | 21 +++++++++++++++++++++ server/Cargo.toml | 21 +++++++++++++++++++++ server/src/lib.rs | 4 ++-- 4 files changed, 65 insertions(+), 2 deletions(-) diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 8e2c2cbb..d15c28c9 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,3 +1,24 @@ +# The MIT License (MIT) +# +# Copyright (c) 2024 Aliaksei Bialiauski +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. [package] name = "cli" version = "0.1.0" diff --git a/cli/src/main.rs b/cli/src/main.rs index b62c0310..0fbba553 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -1,3 +1,24 @@ +// The MIT License (MIT) +// +// Copyright (c) 2024 Aliaksei Bialiauski +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. use server::Server; #[tokio::main] diff --git a/server/Cargo.toml b/server/Cargo.toml index b4bdd3c5..e9d6b4b1 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -1,3 +1,24 @@ +# The MIT License (MIT) +# +# Copyright (c) 2024 Aliaksei Bialiauski +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. [package] name = "server" version = "0.0.0" diff --git a/server/src/lib.rs b/server/src/lib.rs index 768e10d2..352958ba 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -1,4 +1,3 @@ -use axum::Router; // The MIT License (MIT) // // Copyright (c) 2024 Aliaksei Bialiauski @@ -21,6 +20,7 @@ use axum::Router; // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. use axum::routing::get; +use axum::Router; use tokio::net::TcpListener; use crate::routes::home; @@ -41,7 +41,7 @@ impl Server { } impl Server { - pub async fn start(self) -> anyhow::Result<()>{ + pub async fn start(self) -> anyhow::Result<()> { touch_storage(Some("fakehub.xml")); let app: Router = Router::new().route("/", get(home::home)); let addr: String = format!("0.0.0.0:{}", self.port); From 496125badfa9f2e6b8c50d63c32e44993a236127 Mon Sep 17 00:00:00 2001 From: l3r8yJ Date: Sat, 22 Jun 2024 18:12:45 +0300 Subject: [PATCH 04/17] chore(#13): some light fixes --- clippy.toml => .clippy.toml | 2 +- Cargo.toml | 1 - server/src/lib.rs | 5 ++++- 3 files changed, 5 insertions(+), 3 deletions(-) rename clippy.toml => .clippy.toml (98%) diff --git a/clippy.toml b/.clippy.toml similarity index 98% rename from clippy.toml rename to .clippy.toml index 1351e239..df7de270 100644 --- a/clippy.toml +++ b/.clippy.toml @@ -18,4 +18,4 @@ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. +# SOFTWARE. \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index cc7fb442..7a106f78 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,5 +24,4 @@ members = [ "server", "cli", ] - resolver = "1" diff --git a/server/src/lib.rs b/server/src/lib.rs index 352958ba..f3d1545f 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -19,6 +19,8 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. +use std::io; + use axum::routing::get; use axum::Router; use tokio::net::TcpListener; @@ -45,7 +47,7 @@ impl Server { touch_storage(Some("fakehub.xml")); let app: Router = Router::new().route("/", get(home::home)); let addr: String = format!("0.0.0.0:{}", self.port); - let started: std::io::Result = TcpListener::bind(addr.clone()).await; + let started: io::Result = TcpListener::bind(addr.clone()).await; match started { Ok(listener) => axum::serve(listener, app).await?, Err(err) => { @@ -56,6 +58,7 @@ impl Server { } } +#[cfg(test)] mod tests { #[test] From e444f343b83a59f3fb4b5d5042b40ebc7cae030f Mon Sep 17 00:00:00 2001 From: l3r8yJ Date: Sat, 22 Jun 2024 19:28:20 +0300 Subject: [PATCH 05/17] feat(#13): add clap, port argument --- cli/Cargo.toml | 11 ++++++--- cli/src/args.rs | 12 +++++++++ cli/src/main.rs | 51 +++++++++++++++++++-------------------- server/src/lib.rs | 6 +++-- server/src/xml/storage.rs | 5 ++-- 5 files changed, 52 insertions(+), 33 deletions(-) create mode 100644 cli/src/args.rs diff --git a/cli/Cargo.toml b/cli/Cargo.toml index d15c28c9..1208f733 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -25,10 +25,15 @@ version = "0.1.0" edition = "2021" [[bin]] -name = "fakehub-cli" +name = "cli" path = "src/main.rs" +[dev-dependencies] +assert_cmd = "2.0.14" + [dependencies] -clap = "4.5.7" +anyhow = "1.0.86" +clap = { version = "4.5.7", features = ["derive"] } server = { path = "../server" } -tokio = { version = "1.0.0", features = ["rt", "rt-multi-thread", "macros"] } \ No newline at end of file +tokio = { version = "1.0.0", features = ["rt", "rt-multi-thread", "macros"] } +log = "0.4.21" diff --git a/cli/src/args.rs b/cli/src/args.rs new file mode 100644 index 00000000..41d84801 --- /dev/null +++ b/cli/src/args.rs @@ -0,0 +1,12 @@ +use clap::Parser; + +// @todo #13:15min Handle port argument +// We should process the port argument and +// pass it to the server on `start` command. +// Start command should be added also with clap +#[derive(Parser, Debug)] +pub(crate) struct Args { + /// The port to run + #[arg(short, long, default_value_t = 3000)] + pub(crate) port: usize, +} diff --git a/cli/src/main.rs b/cli/src/main.rs index 0fbba553..d768c3df 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -1,28 +1,27 @@ -// The MIT License (MIT) -// -// Copyright (c) 2024 Aliaksei Bialiauski -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -use server::Server; +use clap::Parser; -#[tokio::main] -async fn main() { - let server = Server::new(3000); - server.start().await.expect("Can't start the server"); +use crate::args::Args; + +mod args; + +fn main() { + let _ = Args::parse(); +} + +#[cfg(test)] +mod tests { + use std::str; + + use anyhow::Result; + use assert_cmd::Command; + + #[test] + fn should_output_help() -> Result<()> { + let assertion = Command::cargo_bin("cli")?.arg("--help").assert(); + let bytes = assertion.get_output().stdout.as_slice(); + let output = str::from_utf8(bytes)?; + assert!(output.contains("The port to run")); + assert!(output.contains("3000")); + Ok(()) + } } diff --git a/server/src/lib.rs b/server/src/lib.rs index f3d1545f..5cf132ee 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -21,6 +21,7 @@ // SOFTWARE. use std::io; +use anyhow::Result; use axum::routing::get; use axum::Router; use tokio::net::TcpListener; @@ -43,7 +44,7 @@ impl Server { } impl Server { - pub async fn start(self) -> anyhow::Result<()> { + pub async fn start(self) -> Result<()> { touch_storage(Some("fakehub.xml")); let app: Router = Router::new().route("/", get(home::home)); let addr: String = format!("0.0.0.0:{}", self.port); @@ -60,9 +61,10 @@ impl Server { #[cfg(test)] mod tests { + use anyhow::Result; #[test] - fn creates_the_server() -> anyhow::Result<()> { + fn creates_the_server() -> Result<()> { let server = crate::Server::new(1234); assert_eq!(server.port, 1234); Ok(()) diff --git a/server/src/xml/storage.rs b/server/src/xml/storage.rs index 1d7cff2f..165c57ff 100644 --- a/server/src/xml/storage.rs +++ b/server/src/xml/storage.rs @@ -39,12 +39,13 @@ pub fn touch_storage(path: Option<&str>) -> File { #[cfg(test)] mod tests { + use anyhow::Result; use tempdir::TempDir; use crate::xml::storage::touch_storage; #[test] - fn creates_xml_storage() -> anyhow::Result<()> { + fn creates_xml_storage() -> Result<()> { let temp = TempDir::new("temp")?; let path = temp.path().join("fakehub.xml"); let storage = path.to_str(); @@ -58,7 +59,7 @@ mod tests { } #[test] - fn creates_xml_storage_with_different_name() -> anyhow::Result<()> { + fn creates_xml_storage_with_different_name() -> Result<()> { let temp = TempDir::new("temp")?; let path = temp.path().join("test.xml"); let storage = path.to_str(); From cd00e812f6c7520fb28b89207c91a850dbc2d87f Mon Sep 17 00:00:00 2001 From: l3r8yJ Date: Sat, 22 Jun 2024 19:29:41 +0300 Subject: [PATCH 06/17] chore(#13): license --- cli/src/args.rs | 21 +++++++++++++++++++++ cli/src/main.rs | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/cli/src/args.rs b/cli/src/args.rs index 41d84801..f318fc80 100644 --- a/cli/src/args.rs +++ b/cli/src/args.rs @@ -1,3 +1,24 @@ +// The MIT License (MIT) +// +// Copyright (c) 2024 Aliaksei Bialiauski +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. use clap::Parser; // @todo #13:15min Handle port argument diff --git a/cli/src/main.rs b/cli/src/main.rs index d768c3df..c7e08c58 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -1,3 +1,24 @@ +// The MIT License (MIT) +// +// Copyright (c) 2024 Aliaksei Bialiauski +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. use clap::Parser; use crate::args::Args; From b3f81f4263860ffad6776318c1ef9c4d8d676314 Mon Sep 17 00:00:00 2001 From: l3r8yJ Date: Sat, 22 Jun 2024 19:43:51 +0300 Subject: [PATCH 07/17] feat(#13): separate tests module --- .github/workflows/cargo.yml | 15 +++++++++------ Cargo.toml | 1 + cli/Cargo.toml | 3 --- cli/src/main.rs | 18 ------------------ tests/Cargo.toml | 11 +++++++++++ tests/src/lib.rs | 17 +++++++++++++++++ 6 files changed, 38 insertions(+), 27 deletions(-) create mode 100644 tests/Cargo.toml create mode 100644 tests/src/lib.rs diff --git a/.github/workflows/cargo.yml b/.github/workflows/cargo.yml index 0667a239..1a18a971 100644 --- a/.github/workflows/cargo.yml +++ b/.github/workflows/cargo.yml @@ -34,6 +34,11 @@ concurrency: env: RUSTFLAGS: "-Dwarnings" jobs: + clippy: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - run: cargo clippy --all-targets --all-features build: strategy: fail-fast: false @@ -42,11 +47,9 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 + - run: cargo clean + - run: cargo build - run: cargo test + - run: cargo build --release - run: cargo test --release - - run: cargo fmt --check - clippy: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - run: cargo clippy --all-targets --all-features + - run: cargo fmt --check \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 7a106f78..2fb9d4a0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,5 +23,6 @@ members = [ "server", "cli", + "tests", ] resolver = "1" diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 1208f733..a52014f0 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -28,9 +28,6 @@ edition = "2021" name = "cli" path = "src/main.rs" -[dev-dependencies] -assert_cmd = "2.0.14" - [dependencies] anyhow = "1.0.86" clap = { version = "4.5.7", features = ["derive"] } diff --git a/cli/src/main.rs b/cli/src/main.rs index c7e08c58..73b8ccc4 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -28,21 +28,3 @@ mod args; fn main() { let _ = Args::parse(); } - -#[cfg(test)] -mod tests { - use std::str; - - use anyhow::Result; - use assert_cmd::Command; - - #[test] - fn should_output_help() -> Result<()> { - let assertion = Command::cargo_bin("cli")?.arg("--help").assert(); - let bytes = assertion.get_output().stdout.as_slice(); - let output = str::from_utf8(bytes)?; - assert!(output.contains("The port to run")); - assert!(output.contains("3000")); - Ok(()) - } -} diff --git a/tests/Cargo.toml b/tests/Cargo.toml new file mode 100644 index 00000000..5e282bac --- /dev/null +++ b/tests/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "tests" +version = "0.1.0" +edition = "2021" + +[dependencies] +anyhow = "1.0.86" + +[dev-dependencies] +assert_cmd = "2.0.14" +cli = { path = "../cli" } diff --git a/tests/src/lib.rs b/tests/src/lib.rs new file mode 100644 index 00000000..a84d70df --- /dev/null +++ b/tests/src/lib.rs @@ -0,0 +1,17 @@ +#[cfg(test)] +mod tests { + use std::str; + + use anyhow::Result; + use assert_cmd::Command; + + #[test] + fn should_output_help() -> Result<()> { + let assertion = Command::cargo_bin("cli")?.arg("--help").assert(); + let bytes = assertion.get_output().stdout.as_slice(); + let output = str::from_utf8(bytes)?; + assert!(output.contains("The port to run")); + assert!(output.contains("3000")); + Ok(()) + } +} From ae2504a40efa8b929d9d7fcca22b52bb1d77c80d Mon Sep 17 00:00:00 2001 From: l3r8yJ Date: Sat, 22 Jun 2024 19:44:26 +0300 Subject: [PATCH 08/17] chore(#13): fmt check --- .github/workflows/cargo.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cargo.yml b/.github/workflows/cargo.yml index 1a18a971..41babd14 100644 --- a/.github/workflows/cargo.yml +++ b/.github/workflows/cargo.yml @@ -39,6 +39,7 @@ jobs: steps: - uses: actions/checkout@v4 - run: cargo clippy --all-targets --all-features + - run: cargo fmt --check build: strategy: fail-fast: false From b135bff8dddfe406ce6b774dad3fb4e0415912d3 Mon Sep 17 00:00:00 2001 From: l3r8yJ Date: Sat, 22 Jun 2024 19:45:41 +0300 Subject: [PATCH 09/17] chore(#13): license --- tests/Cargo.toml | 21 +++++++++++++++++++++ tests/src/lib.rs | 22 ++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/tests/Cargo.toml b/tests/Cargo.toml index 5e282bac..8c05668a 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -1,3 +1,24 @@ +# The MIT License (MIT) +# +# Copyright (c) 2024 Aliaksei Bialiauski +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. [package] name = "tests" version = "0.1.0" diff --git a/tests/src/lib.rs b/tests/src/lib.rs index a84d70df..f075f777 100644 --- a/tests/src/lib.rs +++ b/tests/src/lib.rs @@ -1,3 +1,25 @@ +// The MIT License (MIT) +// +// Copyright (c) 2024 Aliaksei Bialiauski +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + #[cfg(test)] mod tests { use std::str; From 1e0200c1118fe4dd4ed4047da367bcd0caeb1198 Mon Sep 17 00:00:00 2001 From: l3r8yJ Date: Sat, 22 Jun 2024 19:50:59 +0300 Subject: [PATCH 10/17] chore(#13): CI fixes --- .github/workflows/cargo.yml | 2 +- .github/workflows/codecov.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cargo.yml b/.github/workflows/cargo.yml index 41babd14..9a4531e0 100644 --- a/.github/workflows/cargo.yml +++ b/.github/workflows/cargo.yml @@ -53,4 +53,4 @@ jobs: - run: cargo test - run: cargo build --release - run: cargo test --release - - run: cargo fmt --check \ No newline at end of file + - run: cargo fmt --check diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index e36d4b4b..3d9820f3 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -34,6 +34,7 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions-rs/tarpaulin@v0.1 + - run: cargo build with: version: '0.22.0' args: '--all-features -- --test-threads 1' From d0c743310cc9a8a6ea11432696244f6622bc1b91 Mon Sep 17 00:00:00 2001 From: l3r8yJ Date: Sat, 22 Jun 2024 19:54:06 +0300 Subject: [PATCH 11/17] chore(#13): CI fixes --- .github/workflows/codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 3d9820f3..386d9964 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -33,8 +33,8 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - uses: actions-rs/tarpaulin@v0.1 - run: cargo build + - uses: actions-rs/tarpaulin@v0.1 with: version: '0.22.0' args: '--all-features -- --test-threads 1' From bebefda8e7b02d67362527897b413b4c86212c02 Mon Sep 17 00:00:00 2001 From: l3r8yJ Date: Sun, 23 Jun 2024 18:31:58 +0300 Subject: [PATCH 12/17] refactor(#13): changed module structure --- .github/workflows/cargo.yml | 4 ++-- Cargo.toml | 1 - README.md | 2 +- cli/Cargo.toml | 3 +++ cli/tests/integration_test.rs | 15 +++++++++++++ tests/src/lib.rs => cli/tests/mod.rs | 19 +---------------- server/src/xml/storage.rs | 2 +- tests/Cargo.toml | 32 ---------------------------- 8 files changed, 23 insertions(+), 55 deletions(-) create mode 100644 cli/tests/integration_test.rs rename tests/src/lib.rs => cli/tests/mod.rs (71%) delete mode 100644 tests/Cargo.toml diff --git a/.github/workflows/cargo.yml b/.github/workflows/cargo.yml index 9a4531e0..139bbcf2 100644 --- a/.github/workflows/cargo.yml +++ b/.github/workflows/cargo.yml @@ -50,7 +50,7 @@ jobs: - uses: actions/checkout@v4 - run: cargo clean - run: cargo build - - run: cargo test + - run: cargo tests - run: cargo build --release - - run: cargo test --release + - run: cargo tests --release - run: cargo fmt --check diff --git a/Cargo.toml b/Cargo.toml index 2fb9d4a0..7a106f78 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,6 +23,5 @@ members = [ "server", "cli", - "tests", ] resolver = "1" diff --git a/README.md b/README.md index 6d30af2d..0fcd0287 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ provided they don't violate our quality standards. To avoid frustration, before sending us your pull request please run full cargo build: ```bash -cargo test +cargo tests ``` You will need [Rust] installed on your system. diff --git a/cli/Cargo.toml b/cli/Cargo.toml index a52014f0..1208f733 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -28,6 +28,9 @@ edition = "2021" name = "cli" path = "src/main.rs" +[dev-dependencies] +assert_cmd = "2.0.14" + [dependencies] anyhow = "1.0.86" clap = { version = "4.5.7", features = ["derive"] } diff --git a/cli/tests/integration_test.rs b/cli/tests/integration_test.rs new file mode 100644 index 00000000..7f3966e1 --- /dev/null +++ b/cli/tests/integration_test.rs @@ -0,0 +1,15 @@ +use std::str; + +use anyhow::Result; +use assert_cmd::Command; + +#[test] +fn should_output_help() -> Result<()> { + env!("CARGO_BIN_EXE_cli"); + let assertion = Command::cargo_bin("cli")?.arg("--help").assert(); + let bytes = assertion.get_output().stdout.as_slice(); + let output = str::from_utf8(bytes)?; + assert!(output.contains("The port to run")); + assert!(output.contains("3000")); + Ok(()) +} diff --git a/tests/src/lib.rs b/cli/tests/mod.rs similarity index 71% rename from tests/src/lib.rs rename to cli/tests/mod.rs index f075f777..7543e5da 100644 --- a/tests/src/lib.rs +++ b/cli/tests/mod.rs @@ -19,21 +19,4 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. - -#[cfg(test)] -mod tests { - use std::str; - - use anyhow::Result; - use assert_cmd::Command; - - #[test] - fn should_output_help() -> Result<()> { - let assertion = Command::cargo_bin("cli")?.arg("--help").assert(); - let bytes = assertion.get_output().stdout.as_slice(); - let output = str::from_utf8(bytes)?; - assert!(output.contains("The port to run")); - assert!(output.contains("3000")); - Ok(()) - } -} +mod integration_test; \ No newline at end of file diff --git a/server/src/xml/storage.rs b/server/src/xml/storage.rs index 165c57ff..ebbbebd9 100644 --- a/server/src/xml/storage.rs +++ b/server/src/xml/storage.rs @@ -61,7 +61,7 @@ mod tests { #[test] fn creates_xml_storage_with_different_name() -> Result<()> { let temp = TempDir::new("temp")?; - let path = temp.path().join("test.xml"); + let path = temp.path().join("tests.xml"); let storage = path.to_str(); touch_storage(storage); assert!( diff --git a/tests/Cargo.toml b/tests/Cargo.toml deleted file mode 100644 index 8c05668a..00000000 --- a/tests/Cargo.toml +++ /dev/null @@ -1,32 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2024 Aliaksei Bialiauski -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -[package] -name = "tests" -version = "0.1.0" -edition = "2021" - -[dependencies] -anyhow = "1.0.86" - -[dev-dependencies] -assert_cmd = "2.0.14" -cli = { path = "../cli" } From fb75c640777eeea2480af0f2110795be7fe693b1 Mon Sep 17 00:00:00 2001 From: l3r8yJ Date: Sun, 23 Jun 2024 18:32:32 +0300 Subject: [PATCH 13/17] chore(#13): lint --- cli/tests/integration_test.rs | 21 +++++++++++++++++++++ cli/tests/mod.rs | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/cli/tests/integration_test.rs b/cli/tests/integration_test.rs index 7f3966e1..5ec3e2ab 100644 --- a/cli/tests/integration_test.rs +++ b/cli/tests/integration_test.rs @@ -1,3 +1,24 @@ +// The MIT License (MIT) +// +// Copyright (c) 2024 Aliaksei Bialiauski +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. use std::str; use anyhow::Result; diff --git a/cli/tests/mod.rs b/cli/tests/mod.rs index 7543e5da..42e5db33 100644 --- a/cli/tests/mod.rs +++ b/cli/tests/mod.rs @@ -19,4 +19,4 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -mod integration_test; \ No newline at end of file +mod integration_test; From 0d149dc51ef21b2dc2adc11e0856d813cd3bbf7d Mon Sep 17 00:00:00 2001 From: l3r8yJ Date: Sun, 23 Jun 2024 18:34:39 +0300 Subject: [PATCH 14/17] chore(#13): lint --- .github/workflows/cargo.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cargo.yml b/.github/workflows/cargo.yml index 139bbcf2..9a4531e0 100644 --- a/.github/workflows/cargo.yml +++ b/.github/workflows/cargo.yml @@ -50,7 +50,7 @@ jobs: - uses: actions/checkout@v4 - run: cargo clean - run: cargo build - - run: cargo tests + - run: cargo test - run: cargo build --release - - run: cargo tests --release + - run: cargo test --release - run: cargo fmt --check From 2e3d655abc115dddf0cb5451e23c2d38b0e10a55 Mon Sep 17 00:00:00 2001 From: l3r8yJ Date: Sun, 23 Jun 2024 18:35:15 +0300 Subject: [PATCH 15/17] chore(#13): readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0fcd0287..6d30af2d 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ provided they don't violate our quality standards. To avoid frustration, before sending us your pull request please run full cargo build: ```bash -cargo tests +cargo test ``` You will need [Rust] installed on your system. From c3828fa7463aa9882c9387c9d382f09486a03c67 Mon Sep 17 00:00:00 2001 From: l3r8yJ Date: Sun, 23 Jun 2024 18:37:07 +0300 Subject: [PATCH 16/17] chore(#13): tests to test --- server/src/xml/storage.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/xml/storage.rs b/server/src/xml/storage.rs index ebbbebd9..165c57ff 100644 --- a/server/src/xml/storage.rs +++ b/server/src/xml/storage.rs @@ -61,7 +61,7 @@ mod tests { #[test] fn creates_xml_storage_with_different_name() -> Result<()> { let temp = TempDir::new("temp")?; - let path = temp.path().join("tests.xml"); + let path = temp.path().join("test.xml"); let storage = path.to_str(); touch_storage(storage); assert!( From 2c673faba0923185a1d053f6676ab96e39a6c813 Mon Sep 17 00:00:00 2001 From: l3r8yJ Date: Sun, 23 Jun 2024 19:04:44 +0300 Subject: [PATCH 17/17] ci(#13): remove redundant steps --- .github/workflows/cargo.yml | 3 --- .github/workflows/codecov.yml | 1 - 2 files changed, 4 deletions(-) diff --git a/.github/workflows/cargo.yml b/.github/workflows/cargo.yml index 9a4531e0..8b66c443 100644 --- a/.github/workflows/cargo.yml +++ b/.github/workflows/cargo.yml @@ -49,8 +49,5 @@ jobs: steps: - uses: actions/checkout@v4 - run: cargo clean - - run: cargo build - run: cargo test - - run: cargo build --release - - run: cargo test --release - run: cargo fmt --check diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 386d9964..e36d4b4b 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -33,7 +33,6 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - run: cargo build - uses: actions-rs/tarpaulin@v0.1 with: version: '0.22.0'