From dee403731a749af9577c079bd937fcea7d0a4a0d Mon Sep 17 00:00:00 2001 From: Samir Talwar Date: Tue, 12 Mar 2024 10:38:02 +0100 Subject: [PATCH] Improvements to CI and the Justfile. (#119) In CI, I have added workflows and jobs to: * run `cargo machete` * ensure the lockfile doesn't change * share a Rust cache I've also aligned the justfile with CI, and fixed the `just dev` target. --- .github/workflows/build.yaml | 20 +++ .github/workflows/format.yaml | 22 +++ .github/workflows/lint.yaml | 43 ----- .github/workflows/machete.yaml | 28 +++ .github/workflows/test.yaml | 5 +- .gitignore | 3 + Cargo.lock | 317 +++------------------------------ flake.nix | 3 + justfile | 23 ++- rust-connector-sdk/Cargo.toml | 1 - 10 files changed, 124 insertions(+), 341 deletions(-) create mode 100644 .github/workflows/format.yaml delete mode 100644 .github/workflows/lint.yaml create mode 100644 .github/workflows/machete.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 63553c79..3d482398 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -18,7 +18,27 @@ jobs: rustup show - uses: Swatinem/rust-cache@v2 + with: + shared-key: "build" # share the cache across jobs - name: build run: | cargo build --release --all-targets --all-features + + # Sadly, `cargo build --locked` isn't enough to check that the lockfile + # is up to date, as it will happily run even if there are extra entries in + # there. + # + # It does, however, make sure that the file is not updated, which is quite + # unhelpful. + - name: ensure lockfile hasn't changed + run: | + if [[ -n "$(git status --porcelain Cargo.lock)" ]]; then + echo 'The Cargo.lock file was changed!' + git diff Cargo.lock + exit 1 + fi + + - name: clippy + run: | + cargo clippy --release --all-targets --all-features diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml new file mode 100644 index 00000000..59e52738 --- /dev/null +++ b/.github/workflows/format.yaml @@ -0,0 +1,22 @@ +name: format + +on: + push: + +jobs: + cargo-fmt: + name: check formatting with cargo fmt + runs-on: ubuntu-latest + env: + CARGO_NET_GIT_FETCH_WITH_CLI: "true" + RUSTFLAGS: "-D warnings" # fail on warnings + steps: + - uses: actions/checkout@v4 + + - name: install tools + run: | + rustup show + + - name: check formatting + run: | + cargo fmt --all --check diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml deleted file mode 100644 index ab0e2ec4..00000000 --- a/.github/workflows/lint.yaml +++ /dev/null @@ -1,43 +0,0 @@ -name: lint - -on: - push: - -jobs: - cargo-fmt: - name: check formatting with cargo fmt - runs-on: ubuntu-latest - env: - CARGO_NET_GIT_FETCH_WITH_CLI: "true" - RUSTFLAGS: "-D warnings" # fail on warnings - steps: - - uses: actions/checkout@v4 - - - name: install tools - run: | - rustup show - - - uses: Swatinem/rust-cache@v2 - - - name: check formatting - run: | - cargo fmt --all --check - - cargo-clippy: - name: lint with cargo clippy - runs-on: ubuntu-latest - env: - CARGO_NET_GIT_FETCH_WITH_CLI: "true" - RUSTFLAGS: "-D warnings" # fail on warnings - steps: - - uses: actions/checkout@v4 - - - name: install tools - run: | - rustup show - - - uses: Swatinem/rust-cache@v2 - - - name: clippy - run: | - cargo clippy diff --git a/.github/workflows/machete.yaml b/.github/workflows/machete.yaml new file mode 100644 index 00000000..c05dfa5e --- /dev/null +++ b/.github/workflows/machete.yaml @@ -0,0 +1,28 @@ +name: find unused dependencies + +on: + push: + +jobs: + cargo-machete: + name: find unused dependencies with cargo machete + runs-on: ubuntu-latest + env: + CARGO_NET_GIT_FETCH_WITH_CLI: "true" + RUSTFLAGS: "-D warnings" # fail on warnings + steps: + - uses: actions/checkout@v4 + + - name: install tools + run: | + rustup show + cargo install cargo-machete + + - uses: Swatinem/rust-cache@v2 + with: + shared-key: "build" # share the cache across jobs + save-if: false + + - name: find unused dependencies + run: | + cargo machete --with-metadata diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 65f111ac..1fcab186 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -18,6 +18,9 @@ jobs: rustup show - uses: Swatinem/rust-cache@v2 + with: + shared-key: "build" # share the cache across jobs + save-if: false - name: run tests - run: cargo test + run: cargo test --release --all-targets --all-features diff --git a/.gitignore b/.gitignore index 428674ea..f3d2a7fb 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ # direnv /.direnv + +# testing +/tmp/empty diff --git a/Cargo.lock b/Cargo.lock index 5fac5e9e..20ba852f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -76,7 +76,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" dependencies = [ - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -86,7 +86,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" dependencies = [ "anstyle", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -239,17 +239,6 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" -[[package]] -name = "bstr" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" -dependencies = [ - "lazy_static", - "memchr", - "regex-automata 0.1.10", -] - [[package]] name = "bumpalo" version = "3.14.0" @@ -287,7 +276,7 @@ dependencies = [ "iana-time-zone", "num-traits", "serde", - "windows-targets 0.48.5", + "windows-targets", ] [[package]] @@ -344,19 +333,7 @@ checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" dependencies = [ "is-terminal", "lazy_static", - "windows-sys 0.48.0", -] - -[[package]] -name = "console" -version = "0.15.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" -dependencies = [ - "encode_unicode", - "lazy_static", - "libc", - "windows-sys 0.45.0", + "windows-sys", ] [[package]] @@ -394,37 +371,14 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "darling" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" -dependencies = [ - "darling_core 0.14.4", - "darling_macro 0.14.4", -] - [[package]] name = "darling" version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" dependencies = [ - "darling_core 0.20.3", - "darling_macro 0.20.3", -] - -[[package]] -name = "darling_core" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "syn 1.0.109", + "darling_core", + "darling_macro", ] [[package]] @@ -441,24 +395,13 @@ dependencies = [ "syn 2.0.38", ] -[[package]] -name = "darling_macro" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" -dependencies = [ - "darling_core 0.14.4", - "quote", - "syn 1.0.109", -] - [[package]] name = "darling_macro" version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ - "darling_core 0.20.3", + "darling_core", "quote", "syn 2.0.38", ] @@ -484,12 +427,6 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" -[[package]] -name = "encode_unicode" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" - [[package]] name = "encoding_rs" version = "0.8.33" @@ -513,7 +450,7 @@ checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" dependencies = [ "errno-dragonfly", "libc", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -634,19 +571,6 @@ dependencies = [ "slab", ] -[[package]] -name = "gdc_rust_types" -version = "1.0.2" -source = "git+https://github.com/hasura/gdc_rust_types.git?rev=3273434#3273434068400f836cf12ea08c514505446821cb" -dependencies = [ - "indexmap 2.1.0", - "openapiv3", - "serde", - "serde-enum-str", - "serde_json", - "serde_with 3.3.0", -] - [[package]] name = "getrandom" version = "0.2.10" @@ -664,18 +588,6 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" -[[package]] -name = "goldenfile" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a67453a3b358bd8213aedafd4feed75eecab9fb04bed26ba6fdf94694be560" -dependencies = [ - "scopeguard", - "similar-asserts", - "tempfile", - "yansi", -] - [[package]] name = "h2" version = "0.3.21" @@ -889,7 +801,7 @@ checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi", "rustix", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -1004,7 +916,7 @@ checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", "wasi", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -1038,7 +950,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "serde_with 2.3.3", + "serde_with", "url", ] @@ -1052,10 +964,7 @@ dependencies = [ "axum-test-helper", "bytes", "clap", - "gdc_rust_types", - "goldenfile", "http", - "indexmap 2.1.0", "mime", "ndc-client", "ndc-test", @@ -1141,17 +1050,6 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" -[[package]] -name = "openapiv3" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75e56d5c441965b6425165b7e3223cc933ca469834f4a8b4786817a1f9dc4f13" -dependencies = [ - "indexmap 1.9.3", - "serde", - "serde_json", -] - [[package]] name = "openssl" version = "0.10.57" @@ -1335,7 +1233,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets 0.48.5", + "windows-targets", ] [[package]] @@ -1590,7 +1488,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -1611,7 +1509,7 @@ version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" dependencies = [ - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -1685,36 +1583,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde-attributes" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eb8ec7724e4e524b2492b510e66957fe1a2c76c26a6975ec80823f2439da685" -dependencies = [ - "darling_core 0.14.4", - "serde-rename-rule", - "syn 1.0.109", -] - -[[package]] -name = "serde-enum-str" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26416dc95fcd46b0e4b12a3758043a229a6914050aaec2e8191949753ed4e9aa" -dependencies = [ - "darling 0.14.4", - "proc-macro2", - "quote", - "serde-attributes", - "syn 1.0.109", -] - -[[package]] -name = "serde-rename-rule" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "794e44574226fc701e3be5c651feb7939038fc67fb73f6f4dd5c4ba90fd3be70" - [[package]] name = "serde_derive" version = "1.0.192" @@ -1783,24 +1651,7 @@ dependencies = [ "indexmap 1.9.3", "serde", "serde_json", - "serde_with_macros 2.3.3", - "time", -] - -[[package]] -name = "serde_with" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ca3b16a3d82c4088f343b7480a93550b3eabe1a358569c2dfe38bbcead07237" -dependencies = [ - "base64 0.21.5", - "chrono", - "hex", - "indexmap 1.9.3", - "indexmap 2.1.0", - "serde", - "serde_json", - "serde_with_macros 3.3.0", + "serde_with_macros", "time", ] @@ -1810,19 +1661,7 @@ version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" dependencies = [ - "darling 0.20.3", - "proc-macro2", - "quote", - "syn 2.0.38", -] - -[[package]] -name = "serde_with_macros" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e6be15c453eb305019bfa438b1593c731f36a289a7853f7707ee29e870b3b3c" -dependencies = [ - "darling 0.20.3", + "darling", "proc-macro2", "quote", "syn 2.0.38", @@ -1846,26 +1685,6 @@ dependencies = [ "libc", ] -[[package]] -name = "similar" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aeaf503862c419d66959f5d7ca015337d864e9c49485d771b732e2a20453597" -dependencies = [ - "bstr", - "unicode-segmentation", -] - -[[package]] -name = "similar-asserts" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e041bb827d1bfca18f213411d51b665309f1afb37a04a5d1464530e13779fc0f" -dependencies = [ - "console", - "similar", -] - [[package]] name = "slab" version = "0.4.9" @@ -1907,7 +1726,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -1975,7 +1794,7 @@ dependencies = [ "fastrand", "redox_syscall", "rustix", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -2067,7 +1886,7 @@ dependencies = [ "signal-hook-registry", "socket2 0.5.5", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -2329,12 +2148,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-segmentation" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" - [[package]] name = "url" version = "2.4.1" @@ -2508,16 +2321,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", + "windows-targets", ] [[package]] @@ -2526,22 +2330,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "windows-targets", ] [[package]] @@ -2550,93 +2339,51 @@ 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", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - [[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_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - [[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_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - [[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_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - [[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_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -2650,11 +2397,5 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ "cfg-if", - "windows-sys 0.48.0", + "windows-sys", ] - -[[package]] -name = "yansi" -version = "1.0.0-rc.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1367295b8f788d371ce2dbc842c7b709c73ee1364d30351dd300ec2203b12377" diff --git a/flake.nix b/flake.nix index cd48b27b..c9ba9e74 100644 --- a/flake.nix +++ b/flake.nix @@ -30,11 +30,14 @@ pkgs.cargo-edit pkgs.cargo-machete pkgs.cargo-nextest + pkgs.cargo-watch pkgs.clippy pkgs.rust-analyzer pkgs.rustPlatform.rustcSrc pkgs.rustc pkgs.rustfmt + + pkgs.just ]; buildInputs = pkgs.lib.optionals pkgs.stdenv.isDarwin [ diff --git a/justfile b/justfile index cdd09d29..ed40c3c5 100644 --- a/justfile +++ b/justfile @@ -1,23 +1,30 @@ +check: format-check build lint test + +build: + cargo build --all-targets --all-features + # re-build on code changes, and run the reference agent each time a build is # successful dev: + mkdir -p ./tmp/empty cargo watch \ -x test \ -x 'run --bin ndc_hub_example \ - -- serve --configuration <(echo 'null') \ + -- serve --configuration ./tmp/empty \ --otlp-endpoint http://localhost:4317' -# reformat everything format: cargo fmt --all -# is everything formatted? format-check: cargo fmt --all --check -# run `clippy` linter -lint *FLAGS: - cargo clippy {{FLAGS}} +lint: + cargo clippy --all-targets --all-features + cargo machete --with-metadata + +lint-apply: + cargo clippy --fix --all-targets --all-features -lint-apply *FLAGS: - cargo clippy --fix {{FLAGS}} +test: + cargo test --all-targets --all-features diff --git a/rust-connector-sdk/Cargo.toml b/rust-connector-sdk/Cargo.toml index ab2ff5fb..0579ddca 100644 --- a/rust-connector-sdk/Cargo.toml +++ b/rust-connector-sdk/Cargo.toml @@ -46,4 +46,3 @@ url = "2.4.1" [dev-dependencies] axum-test-helper = "0.3.0" -goldenfile = "^1.6.0"