From 88f8f93d89f1a5af3b84337db9672b99f567d62b Mon Sep 17 00:00:00 2001 From: Alois Date: Sun, 28 Jun 2026 17:31:04 +0200 Subject: [PATCH] (fix): some ci stuff --- .forgejo/workflows/ci.yml | 149 ++++++++++++++------------------------ Cargo.toml | 14 ++-- client/Cargo.toml | 8 +- codec/Cargo.toml | 6 +- example/client/Cargo.toml | 2 +- example/server/Cargo.toml | 2 +- flake.nix | 3 +- host/Cargo.toml | 8 +- transport/Cargo.toml | 4 +- wasm/Cargo.toml | 8 +- 10 files changed, 83 insertions(+), 121 deletions(-) diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index ff522b9..4659f4f 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -8,6 +8,8 @@ on: env: CARGO_TERM_COLOR: always + NIX_CONFIG: experimental-features = nix-command flakes + jobs: fmt: name: rustfmt @@ -15,17 +17,15 @@ jobs: steps: - uses: https://data.forgejo.org/actions/checkout@v4 - - name: Install system dependencies - run: apt-get update && apt-get install -y --no-install-recommends ca-certificates curl build-essential pkg-config libssl-dev - - - name: Install Rust + - name: Install Nix run: | - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --component rustfmt + apt-get update && apt-get install -y --no-install-recommends ca-certificates curl xz-utils + curl -L https://nixos.org/nix/install | sh -s -- --daemon - name: Check formatting run: | - export PATH="$HOME/.cargo/bin:$PATH" - cargo fmt --all --check + . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh + nix develop --command cargo fmt --all --check clippy: name: clippy @@ -33,18 +33,15 @@ jobs: steps: - uses: https://data.forgejo.org/actions/checkout@v4 - - name: Install system dependencies - run: apt-get update && apt-get install -y --no-install-recommends ca-certificates curl build-essential pkg-config libssl-dev - - - name: Install Rust + - name: Install Nix run: | - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --component clippy + apt-get update && apt-get install -y --no-install-recommends ca-certificates curl xz-utils + curl -L https://nixos.org/nix/install | sh -s -- --daemon - name: Run clippy run: | - export PATH="$HOME/.cargo/bin:$PATH" - export MTP_TYPE_MAPS="$PWD/example/type-maps.yaml" - cargo clippy --workspace --exclude mtp-wasm --all-targets --all-features -- -D warnings -W unreachable-pub + . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh + nix develop --command mtp-clippy test: name: test @@ -52,18 +49,15 @@ jobs: steps: - uses: https://data.forgejo.org/actions/checkout@v4 - - name: Install system dependencies - run: apt-get update && apt-get install -y --no-install-recommends ca-certificates curl build-essential pkg-config libssl-dev - - - name: Install Rust + - name: Install Nix run: | - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal + apt-get update && apt-get install -y --no-install-recommends ca-certificates curl xz-utils + curl -L https://nixos.org/nix/install | sh -s -- --daemon - name: Run tests run: | - export PATH="$HOME/.cargo/bin:$PATH" - export MTP_TYPE_MAPS="$PWD/example/type-maps.yaml" - cargo test --workspace --exclude mtp-wasm --all-features + . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh + nix develop --command bash -lc 'cargo test --workspace --exclude mtp-wasm --all-features' wasm: name: wasm build @@ -71,18 +65,15 @@ jobs: steps: - uses: https://data.forgejo.org/actions/checkout@v4 - - name: Install system dependencies - run: apt-get update && apt-get install -y --no-install-recommends ca-certificates curl build-essential pkg-config libssl-dev lld - - - name: Install Rust + - name: Install Nix run: | - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --target wasm32-unknown-unknown + apt-get update && apt-get install -y --no-install-recommends ca-certificates curl xz-utils + curl -L https://nixos.org/nix/install | sh -s -- --daemon - name: Build wasm crate run: | - export PATH="$HOME/.cargo/bin:$PATH" - export MTP_TYPE_MAPS="$PWD/example/type-maps.yaml" - cargo build -p mtp-wasm --target wasm32-unknown-unknown + . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh + nix develop --command bash -lc 'cargo build -p mtp-wasm --target wasm32-unknown-unknown' env: RUSTFLAGS: --cfg web_sys_unstable_apis @@ -92,19 +83,16 @@ jobs: steps: - uses: https://data.forgejo.org/actions/checkout@v4 - - name: Install system dependencies - run: apt-get update && apt-get install -y --no-install-recommends ca-certificates curl build-essential pkg-config libssl-dev - - - name: Install Rust + - name: Install Nix run: | - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal + apt-get update && apt-get install -y --no-install-recommends ca-certificates curl xz-utils + curl -L https://nixos.org/nix/install | sh -s -- --daemon - name: Check example usage workspace working-directory: example run: | - export PATH="$HOME/.cargo/bin:$PATH" - export MTP_TYPE_MAPS="$PWD/type-maps.yaml" - cargo check --workspace --all-targets --all-features + . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh + nix develop .. --command bash -lc 'export MTP_TYPE_MAPS="$PWD/type-maps.yaml"; cargo check --workspace --all-targets --all-features' deny: name: cargo-deny @@ -112,22 +100,15 @@ jobs: steps: - uses: https://data.forgejo.org/actions/checkout@v4 - - name: Install system dependencies - run: apt-get update && apt-get install -y --no-install-recommends ca-certificates curl build-essential pkg-config libssl-dev - - - name: Install Rust + - name: Install Nix run: | - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal - - - name: Install cargo-deny - run: | - export PATH="$HOME/.cargo/bin:$PATH" - cargo install cargo-deny --locked + apt-get update && apt-get install -y --no-install-recommends ca-certificates curl xz-utils + curl -L https://nixos.org/nix/install | sh -s -- --daemon - name: Run cargo-deny run: | - export PATH="$HOME/.cargo/bin:$PATH" - cargo deny check + . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh + nix develop --command cargo deny check advisories bans sources machete: name: cargo-machete @@ -135,22 +116,15 @@ jobs: steps: - uses: https://data.forgejo.org/actions/checkout@v4 - - name: Install system dependencies - run: apt-get update && apt-get install -y --no-install-recommends ca-certificates curl build-essential pkg-config libssl-dev - - - name: Install Rust + - name: Install Nix run: | - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal - - - name: Install cargo-machete - run: | - export PATH="$HOME/.cargo/bin:$PATH" - cargo install cargo-machete --locked + apt-get update && apt-get install -y --no-install-recommends ca-certificates curl xz-utils + curl -L https://nixos.org/nix/install | sh -s -- --daemon - name: Run cargo-machete run: | - export PATH="$HOME/.cargo/bin:$PATH" - cargo machete + . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh + nix develop --command mtp-machete duplicates: name: duplicate code @@ -158,22 +132,20 @@ jobs: steps: - uses: https://data.forgejo.org/actions/checkout@v4 - - name: Install system dependencies - run: apt-get update && apt-get install -y --no-install-recommends ca-certificates curl unzip nodejs - - - name: Install pnpm + - name: Install Nix run: | - curl -fsSL https://get.pnpm.io/install.sh | SHELL=/bin/sh sh - + apt-get update && apt-get install -y --no-install-recommends ca-certificates curl xz-utils + curl -L https://nixos.org/nix/install | sh -s -- --daemon - name: Install dependencies run: | - export PATH="$HOME/.local/share/pnpm:$PATH" - pnpm install --frozen-lockfile + . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh + nix develop --command pnpm install --frozen-lockfile - name: Run duplicate detector run: | - export PATH="$HOME/.local/share/pnpm:$PATH" - pnpm run dup + . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh + nix develop --command pnpm run dup web-client: name: web client @@ -181,42 +153,31 @@ jobs: steps: - uses: https://data.forgejo.org/actions/checkout@v4 - - name: Install system dependencies - run: apt-get update && apt-get install -y --no-install-recommends ca-certificates curl unzip nodejs build-essential pkg-config libssl-dev lld - - - name: Install Rust + - name: Install Nix run: | - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --target wasm32-unknown-unknown - - - name: Install wasm-pack - run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + apt-get update && apt-get install -y --no-install-recommends ca-certificates curl xz-utils + curl -L https://nixos.org/nix/install | sh -s -- --daemon - name: Build wasm package run: | - export PATH="$HOME/.cargo/bin:$PATH" - export MTP_TYPE_MAPS="$PWD/example/type-maps.yaml" - wasm-pack build wasm --target web + . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh + nix develop --command wasm-pack build wasm --target web env: RUSTFLAGS: --cfg web_sys_unstable_apis - - name: Install pnpm - run: | - curl -fsSL https://get.pnpm.io/install.sh | SHELL=/bin/sh sh - - - name: Install dependencies run: | - export PATH="$HOME/.local/share/pnpm:$PATH" - pnpm install --frozen-lockfile + . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh + nix develop --command pnpm install --frozen-lockfile - name: Build TypeScript package run: | - export PATH="$HOME/.cargo/bin:$HOME/.local/share/pnpm:$PATH" - export MTP_TYPE_MAPS="$PWD/example/type-maps.yaml" - pnpm run build + . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh + nix develop --command pnpm run build env: RUSTFLAGS: --cfg web_sys_unstable_apis - name: Build web client run: | - export PATH="$HOME/.local/share/pnpm:$PATH" - pnpm --filter mtp-web-client run build + . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh + nix develop --command pnpm --filter mtp-web-client run build diff --git a/Cargo.toml b/Cargo.toml index 4c67127..bf82e29 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,18 +46,18 @@ edition = "2024" [dependencies] # --- always-on core --- -mtp-common = { path = "common" } -mtp-type-map = { path = "type-map" } -mtp-codec = { path = "codec" } -mtp-transport = { path = "transport" } +mtp-common = { version = "0.1.0", path = "common" } +mtp-type-map = { version = "0.1.0", path = "type-map" } +mtp-codec = { version = "0.1.0", path = "codec" } +mtp-transport = { version = "0.1.0", path = "transport" } # --- optional, behind features --- -mtp-crypto = { path = "crypto", optional = true, features = [ +mtp-crypto = { version = "0.1.0", path = "crypto", optional = true, features = [ "serde", "mlkem-tls", ] } -mtp-host = { path = "host", optional = true } -mtp-client = { path = "client", optional = true } +mtp-host = { version = "0.1.0", path = "host", optional = true } +mtp-client = { version = "0.1.0", path = "client", optional = true } [features] default = [] diff --git a/client/Cargo.toml b/client/Cargo.toml index df69b8c..94f8fa2 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -4,10 +4,10 @@ version = "0.1.0" edition = "2024" [dependencies] -mtp-common = { path = "../common" } -mtp-codec = { path = "../codec" } -mtp-transport = { path = "../transport" } -mtp-crypto = { path = "../crypto", optional = true } +mtp-common = { version = "0.1.0", path = "../common" } +mtp-codec = { version = "0.1.0", path = "../codec" } +mtp-transport = { version = "0.1.0", path = "../transport" } +mtp-crypto = { version = "0.1.0", path = "../crypto", optional = true } rand = "0.8" tokio = { version = "1", features = ["time"] } diff --git a/codec/Cargo.toml b/codec/Cargo.toml index 6dc27bd..51a5cde 100644 --- a/codec/Cargo.toml +++ b/codec/Cargo.toml @@ -4,9 +4,9 @@ version = "0.1.0" edition = "2024" [dependencies] -mtp-type-map = { path = "../type-map" } -mtp-common = { path = "../common" } -mtp-crypto = { path = "../crypto", optional = true } +mtp-type-map = { version = "0.1.0", path = "../type-map" } +mtp-common = { version = "0.1.0", path = "../common" } +mtp-crypto = { version = "0.1.0", path = "../crypto", optional = true } base64 = "0.22" byteorder = "1.5" rand = { version = "0.8", features = ["std", "std_rng"] } diff --git a/example/client/Cargo.toml b/example/client/Cargo.toml index b2c8193..2e0556b 100644 --- a/example/client/Cargo.toml +++ b/example/client/Cargo.toml @@ -8,7 +8,7 @@ name = "client" path = "src/main.rs" [dependencies] -mtp = { path = "../../", features = ["client", "crypto"] } +mtp = { version = "0.1.0", path = "../../", features = ["client", "crypto"] } tokio = { version = "1", features = ["full"] } serde_json = "1" hex = "0.4" diff --git a/example/server/Cargo.toml b/example/server/Cargo.toml index 7a12004..cf87364 100644 --- a/example/server/Cargo.toml +++ b/example/server/Cargo.toml @@ -8,7 +8,7 @@ name = "server" path = "src/main.rs" [dependencies] -mtp = { path = "../../", features = ["crypto", "host"] } +mtp = { version = "0.1.0", path = "../../", features = ["crypto", "host"] } rcgen = "0.14" tokio = { version = "1", features = ["full"] } serde_json = { version = "1" } diff --git a/flake.nix b/flake.nix index cd24a7e..0e6e463 100644 --- a/flake.nix +++ b/flake.nix @@ -46,7 +46,7 @@ buildAll = pkgs.writeShellApplication { name = "mtp-build-all"; - runtimeInputs = [rustToolchain pkgs.wasm-pack pkgs.pnpm pkgs.coreutils clippyCheck macheteCheck]; + runtimeInputs = [rustToolchain pkgs.cargo-deny pkgs.wasm-pack pkgs.pnpm pkgs.coreutils clippyCheck macheteCheck]; text = '' export MTP_TYPE_MAPS="''${MTP_TYPE_MAPS:-$PWD/example/type-maps.yaml}" @@ -78,6 +78,7 @@ buildInputs = with pkgs; [ rustToolchain + cargo-deny cargo-machete wasm-pack pnpm diff --git a/host/Cargo.toml b/host/Cargo.toml index 5c7ab76..ea4e661 100644 --- a/host/Cargo.toml +++ b/host/Cargo.toml @@ -4,10 +4,10 @@ version = "0.1.0" edition = "2024" [dependencies] -mtp-common = { path = "../common" } -mtp-codec = { path = "../codec", features = ["registry"] } -mtp-transport = { path = "../transport", features = ["host"] } -mtp-crypto = { path = "../crypto", optional = true } +mtp-common = { version = "0.1.0", path = "../common" } +mtp-codec = { version = "0.1.0", path = "../codec", features = ["registry"] } +mtp-transport = { version = "0.1.0", path = "../transport", features = ["host"] } +mtp-crypto = { version = "0.1.0", path = "../crypto", optional = true } rand = "0.8" tokio = { version = "1", features = ["time"] } diff --git a/transport/Cargo.toml b/transport/Cargo.toml index 7a60a2a..0af879a 100644 --- a/transport/Cargo.toml +++ b/transport/Cargo.toml @@ -4,8 +4,8 @@ version = "0.1.0" edition = "2024" [dependencies] -mtp-codec = { path = "../codec" } -mtp-common = { path = "../common" } +mtp-codec = { version = "0.1.0", path = "../codec" } +mtp-common = { version = "0.1.0", path = "../common" } wtransport = { version = "0.7.1", default-features = false, features = [ "aws-lc-rs", "quinn", diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index bdc68aa..b3aa3e2 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -21,10 +21,10 @@ hex = "0.4" getrandom = { version = "0.4", features = ["wasm_js"] } getrandom-v02 = { package = "getrandom", version = "0.2", features = ["js"] } -mtp-common = { path = "../common" } -mtp-type-map = { path = "../type-map" } -mtp-codec = { path = "../codec", features = ["crypto"] } -mtp-crypto = { path = "../crypto", features = ["wasm"] } +mtp-common = { version = "0.1.0", path = "../common" } +mtp-type-map = { version = "0.1.0", path = "../type-map" } +mtp-codec = { version = "0.1.0", path = "../codec", features = ["crypto"] } +mtp-crypto = { version = "0.1.0", path = "../crypto", features = ["wasm"] } [dev-dependencies] wasm-bindgen-test = "0.3"