diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 277fcada..ef99be45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,6 +90,16 @@ jobs: - name: Version features run: cargo +1.60.0 build --manifest-path tests/smoke-test/Cargo.toml + examples: + name: Tests / Examples + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab + + - name: Examples + run: cargo test --manifest-path examples/Cargo.toml + wasm_bindgen: name: Tests / WebAssembly (wasm-bindgen) runs-on: ubuntu-latest diff --git a/Cargo.toml b/Cargo.toml index 3cdc6111..d64d7f2d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,8 +14,11 @@ categories = [ description = "A library to generate and parse UUIDs." documentation = "https://docs.rs/uuid" edition = "2018" -exclude = [ - ".github/**" +include = [ + "src", + "README.md", + "LICENSE-APACHE", + "LICENSE-MIT", ] keywords = [ "guid", @@ -190,12 +193,9 @@ version = "1.0.52" [dev-dependencies.rustversion] version = "1" -[target.'cfg(windows)'.dev-dependencies.windows-sys] -version = "0.48.0" -features = ["Win32_System_Com"] - [workspace] members = [ "macros", + "examples", "tests/smoke-test", ] diff --git a/examples/Cargo.toml b/examples/Cargo.toml new file mode 100644 index 00000000..1da77e78 --- /dev/null +++ b/examples/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "uuid-examples" +version = "0.0.0" +publish = false +edition = "2018" + +[[example]] +name = "random_uuid" +path = "src/random_uuid.rs" + +[[example]] +name = "sortable_uuid" +path = "src/sortable_uuid.rs" + +[[example]] +name = "uuid_macro" +path = "src/uuid_macro.rs" + +[[example]] +name = "windows_guid" +path = "src/windows_guid.rs" + +[dependencies.uuid] +path = "../" +features = ["v1", "v3", "v4", "v5", "v6", "v7", "v8"] + +[target.'cfg(windows)'.dev-dependencies.windows-sys] +version = "0.48.0" +features = ["Win32_System_Com"] diff --git a/examples/random_uuid.rs b/examples/src/random_uuid.rs similarity index 80% rename from examples/random_uuid.rs rename to examples/src/random_uuid.rs index ec88c058..d36d3806 100644 --- a/examples/random_uuid.rs +++ b/examples/src/random_uuid.rs @@ -2,7 +2,6 @@ //! //! If you enable the `v4` feature you can generate random UUIDs. -#[cfg(feature = "v4")] fn main() { use uuid::Uuid; @@ -12,6 +11,3 @@ fn main() { println!("{}", uuid); } - -#[cfg(not(feature = "v4"))] -fn main() {} diff --git a/examples/sortable_uuid.rs b/examples/src/sortable_uuid.rs similarity index 80% rename from examples/sortable_uuid.rs rename to examples/src/sortable_uuid.rs index fd4b56f3..f74f5d61 100644 --- a/examples/sortable_uuid.rs +++ b/examples/src/sortable_uuid.rs @@ -2,7 +2,6 @@ //! //! If you enable the `v7` feature you can generate sortable UUIDs. -#[cfg(feature = "v7")] fn main() { use uuid::Uuid; @@ -12,6 +11,3 @@ fn main() { println!("{}", uuid); } - -#[cfg(not(feature = "v7"))] -fn main() {} diff --git a/examples/uuid_macro.rs b/examples/src/uuid_macro.rs similarity index 89% rename from examples/uuid_macro.rs rename to examples/src/uuid_macro.rs index c4ff0484..f2a49a8d 100644 --- a/examples/uuid_macro.rs +++ b/examples/src/uuid_macro.rs @@ -7,13 +7,10 @@ //! If you enable the `macro-diagnostics` feature, you can see much better //! error messages. -#[test] -fn parse_uuid_at_compile_time() { +fn main() { use uuid::uuid; let uuid = uuid!("67e55044-10b1-426f-9247-bb680e5fe0c8"); assert_eq!(Some(uuid::Version::Random), uuid.get_version()); } - -fn main() {} diff --git a/examples/windows_guid.rs b/examples/src/windows_guid.rs similarity index 100% rename from examples/windows_guid.rs rename to examples/src/windows_guid.rs