From b10c9f5d9d359d46ea3782bc7534d344be7c3f43 Mon Sep 17 00:00:00 2001 From: Joseph <61999200+josephleee@users.noreply.github.com> Date: Thu, 30 Oct 2025 16:12:39 +0900 Subject: [PATCH 1/3] Update README.md KaraKeep url is deprecated. link to origin github url --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e393d4f..94f0aec 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Traditional tools like Logseq and Obsidian are excellent, but the manual linking So I built Minne to offer the best of both worlds: effortless content capture with AI-assisted relationship discovery, but with the flexibility to manually curate, edit, or override any connections. You can let AI handle the heavy lifting of extracting entities and finding relationships, take full control yourself, or use a hybrid approach where AI suggests connections that you can approve or modify. -While developing Minne, I discovered [KaraKeep](https://karakeep.com/) (formerly Hoarder), which is an excellent application in a similar space – you probably want to check it out! However, if you're interested in a PKM that offers both intelligent automation and manual curation, with the ability to chat with your knowledge base, then Minne might be worth testing. +While developing Minne, I discovered [KaraKeep](https://github.com/karakeep-app/karakeep) (formerly Hoarder), which is an excellent application in a similar space – you probably want to check it out! However, if you're interested in a PKM that offers both intelligent automation and manual curation, with the ability to chat with your knowledge base, then Minne might be worth testing. ## Table of Contents From b0deabaf3f541d986500dedcd8498ca9b15471dd Mon Sep 17 00:00:00 2001 From: Per Stark Date: Wed, 29 Oct 2025 12:06:31 +0100 Subject: [PATCH 2/3] release: 0.2.6 --- .github/build-setup.yml | 49 +++++++++++++++ CHANGELOG.md | 2 + Cargo.lock | 103 +++++--------------------------- Cargo.toml | 3 +- Dockerfile | 2 +- common/src/utils/config.rs | 33 ++++++++++ devenv.lock | 88 ++++++++++++++++++++++++--- devenv.nix | 10 ++++ devenv.yaml | 18 +++--- dist-workspace.toml | 5 +- docker-compose.yml | 2 - flake.lock | 6 +- flake.nix | 119 +++++++++++++++++++------------------ main/Cargo.toml | 2 +- 14 files changed, 267 insertions(+), 175 deletions(-) create mode 100644 .github/build-setup.yml diff --git a/.github/build-setup.yml b/.github/build-setup.yml new file mode 100644 index 0000000..c6aa02f --- /dev/null +++ b/.github/build-setup.yml @@ -0,0 +1,49 @@ +- name: Prepare lib dir + run: mkdir -p lib + +# Linux +- name: Fetch ONNX Runtime (Linux) + if: runner.os == 'Linux' + env: + ORT_VER: 1.22.0 + run: | + set -euo pipefail + ARCH="$(uname -m)" + case "$ARCH" in + x86_64) URL="https://github.com/microsoft/onnxruntime/releases/download/v${ORT_VER}/onnxruntime-linux-x64-${ORT_VER}.tgz" ;; + aarch64) URL="https://github.com/microsoft/onnxruntime/releases/download/v${ORT_VER}/onnxruntime-linux-aarch64-${ORT_VER}.tgz" ;; + *) echo "Unsupported arch $ARCH"; exit 1 ;; + esac + curl -fsSL -o ort.tgz "$URL" + tar -xzf ort.tgz + cp -v onnxruntime-*/lib/libonnxruntime.so* lib/ + +# macOS +- name: Fetch ONNX Runtime (macOS) + if: runner.os == 'macOS' + env: + ORT_VER: 1.22.0 + run: | + set -euo pipefail + curl -fsSL -o ort.tgz "https://github.com/microsoft/onnxruntime/releases/download/v${ORT_VER}/onnxruntime-osx-universal2-${ORT_VER}.tgz" + tar -xzf ort.tgz + # copy the main dylib; rename to stable name if needed + cp -v onnxruntime-*/lib/libonnxruntime*.dylib lib/ + # optional: ensure a stable name + if [ ! -f lib/libonnxruntime.dylib ]; then + cp -v lib/libonnxruntime*.dylib lib/libonnxruntime.dylib + fi + +# Windows +- name: Fetch ONNX Runtime (Windows) + if: runner.os == 'Windows' + shell: pwsh + env: + ORT_VER: 1.22.0 + run: | + $url = "https://github.com/microsoft/onnxruntime/releases/download/v$env:ORT_VER/onnxruntime-win-x64-$env:ORT_VER.zip" + Invoke-WebRequest $url -OutFile ort.zip + Expand-Archive ort.zip -DestinationPath ort + $dll = Get-ChildItem -Recurse -Path ort -Filter onnxruntime.dll | Select-Object -First 1 + Copy-Item $dll.FullName lib\onnxruntime.dll + diff --git a/CHANGELOG.md b/CHANGELOG.md index 30ecd6e..922aa51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog ## Unreleased + +## Version 0.2.6 (2025-10-29) - Added an opt-in FastEmbed-based reranking stage behind `reranking_enabled`. It improves retrieval accuracy by re-scoring hybrid results. ## Version 0.2.5 (2025-10-24) diff --git a/Cargo.lock b/Cargo.lock index 515a3c0..30dedd1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -574,7 +574,7 @@ dependencies = [ "quote", "serde", "serde_json", - "ureq 2.12.1", + "ureq", ] [[package]] @@ -1811,16 +1811,6 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" -[[package]] -name = "der" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" -dependencies = [ - "pem-rfc7468", - "zeroize", -] - [[package]] name = "deranged" version = "0.4.0" @@ -1938,7 +1928,7 @@ dependencies = [ "libc", "option-ext", "redox_users 0.5.2", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -2768,7 +2758,7 @@ dependencies = [ "serde", "serde_json", "thiserror 2.0.12", - "ureq 2.12.1", + "ureq", "windows-sys 0.60.2", ] @@ -3547,6 +3537,16 @@ dependencies = [ "cc", ] +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link 0.2.1", +] + [[package]] name = "libm" version = "0.2.13" @@ -3697,7 +3697,7 @@ checksum = "670fdfda89751bc4a84ac13eaa63e205cf0fd22b4c9a5fbfa085b63c1f1d3a30" [[package]] name = "main" -version = "0.2.5" +version = "0.2.6" dependencies = [ "anyhow", "api-router", @@ -4402,6 +4402,7 @@ version = "2.0.0-rc.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fa7e49bd669d32d7bc2a15ec540a527e7764aec722a45467814005725bcd721" dependencies = [ + "libloading", "ndarray 0.16.1", "ort-sys", "smallvec 2.0.0-alpha.10", @@ -4414,11 +4415,7 @@ version = "2.0.0-rc.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2aba9f5c7c479925205799216e7e5d07cc1d4fa76ea8058c60a9a30f6a4e890" dependencies = [ - "flate2", "pkg-config", - "sha2", - "tar", - "ureq 3.1.2", ] [[package]] @@ -4539,15 +4536,6 @@ dependencies = [ "serde", ] -[[package]] -name = "pem-rfc7468" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" -dependencies = [ - "base64ct", -] - [[package]] name = "percent-encoding" version = "2.3.1" @@ -6549,17 +6537,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" -[[package]] -name = "tar" -version = "0.4.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d863878d212c87a19c1a610eb53bb01fe12951c0501cf5a0d65f724914a667a" -dependencies = [ - "filetime", - "libc", - "xattr", -] - [[package]] name = "target-lexicon" version = "0.12.16" @@ -7312,37 +7289,6 @@ dependencies = [ "webpki-roots", ] -[[package]] -name = "ureq" -version = "3.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99ba1025f18a4a3fc3e9b48c868e9beb4f24f4b4b1a325bada26bd4119f46537" -dependencies = [ - "base64 0.22.1", - "der", - "log", - "native-tls", - "percent-encoding", - "rustls-pemfile", - "rustls-pki-types", - "socks", - "ureq-proto", - "utf-8", - "webpki-root-certs", -] - -[[package]] -name = "ureq-proto" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b4531c118335662134346048ddb0e54cc86bd7e81866757873055f0e38f5d2" -dependencies = [ - "base64 0.22.1", - "http", - "httparse", - "log", -] - [[package]] name = "url" version = "2.5.4" @@ -7613,15 +7559,6 @@ dependencies = [ "string_cache_codegen", ] -[[package]] -name = "webpki-root-certs" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d651ec480de84b762e7be71e6efa7461699c19d9e2c272c8d93455f567786e" -dependencies = [ - "rustls-pki-types", -] - [[package]] name = "webpki-roots" version = "0.26.10" @@ -8048,16 +7985,6 @@ dependencies = [ "tap", ] -[[package]] -name = "xattr" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156" -dependencies = [ - "libc", - "rustix", -] - [[package]] name = "xml-rs" version = "0.8.26" diff --git a/Cargo.toml b/Cargo.toml index 66a09e7..6a8e1ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,8 +56,7 @@ base64 = "0.22.1" object_store = { version = "0.11.2" } bytes = "1.7.1" state-machines = "0.2.0" -fastembed = "5.2.0" -ort = { version = "=2.0.0-rc.8", default-features = false, features = ["load-dynamic"] } +fastembed = { version = "5.2.0", default-features = false, features = ["hf-hub-native-tls", "ort-load-dynamic"] } [profile.dist] inherits = "release" diff --git a/Dockerfile b/Dockerfile index c7ee56d..ae9d11f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,7 +31,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* # ONNX Runtime (CPU). Change if you bump ort. -ARG ORT_VERSION=1.21.0 +ARG ORT_VERSION=1.22.0 RUN mkdir -p /opt/onnxruntime && \ curl -fsSL -o /tmp/ort.tgz \ "https://github.com/microsoft/onnxruntime/releases/download/v${ORT_VERSION}/onnxruntime-linux-x64-${ORT_VERSION}.tgz" && \ diff --git a/common/src/utils/config.rs b/common/src/utils/config.rs index 51c21bf..0aa79d4 100644 --- a/common/src/utils/config.rs +++ b/common/src/utils/config.rs @@ -1,5 +1,6 @@ use config::{Config, ConfigError, Environment, File}; use serde::Deserialize; +use std::env; #[derive(Clone, Deserialize, Debug)] #[serde(rename_all = "lowercase")] @@ -66,6 +67,36 @@ fn default_reranking_enabled() -> bool { false } +pub fn ensure_ort_path() { + if env::var_os("ORT_DYLIB_PATH").is_some() { + return; + } + if let Ok(mut exe) = env::current_exe() { + exe.pop(); + + if cfg!(target_os = "windows") { + for p in [ + exe.join("onnxruntime.dll"), + exe.join("lib").join("onnxruntime.dll"), + ] { + if p.exists() { + env::set_var("ORT_DYLIB_PATH", p); + return; + } + } + } + let name = if cfg!(target_os = "macos") { + "libonnxruntime.dylib" + } else { + "libonnxruntime.so" + }; + let p = exe.join("lib").join(name); + if p.exists() { + env::set_var("ORT_DYLIB_PATH", p); + } + } +} + impl Default for AppConfig { fn default() -> Self { Self { @@ -90,6 +121,8 @@ impl Default for AppConfig { } pub fn get_config() -> Result { + ensure_ort_path(); + let config = Config::builder() .add_source(File::with_name("config").required(false)) .add_source(Environment::default()) diff --git a/devenv.lock b/devenv.lock index 77380f9..4862f1b 100644 --- a/devenv.lock +++ b/devenv.lock @@ -3,10 +3,10 @@ "devenv": { "locked": { "dir": "src/modules", - "lastModified": 1746681099, + "lastModified": 1761839147, "owner": "cachix", "repo": "devenv", - "rev": "a7f2ea275621391209fd702f5ddced32dd56a4e2", + "rev": "bb7849648b68035f6b910120252c22b28195cf54", "type": "github" }, "original": { @@ -16,13 +16,31 @@ "type": "github" } }, + "fenix": { + "inputs": { + "nixpkgs": "nixpkgs", + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1761893049, + "owner": "nix-community", + "repo": "fenix", + "rev": "c2ac9a5c0d6d16630c3b225b874bd14528d1abe6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { - "lastModified": 1733328505, + "lastModified": 1761588595, "owner": "edolstra", "repo": "flake-compat", - "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "rev": "f387cd2afec9419c8ee37694406ca490c3f34ee5", "type": "github" }, "original": { @@ -40,10 +58,10 @@ ] }, "locked": { - "lastModified": 1746537231, + "lastModified": 1760663237, "owner": "cachix", "repo": "git-hooks.nix", - "rev": "fa466640195d38ec97cf0493d6d6882bc4d14969", + "rev": "ca5b894d3e3e151ffc1db040b6ce4dcc75d31c37", "type": "github" }, "original": { @@ -74,10 +92,25 @@ }, "nixpkgs": { "locked": { - "lastModified": 1746576598, + "lastModified": 1761672384, "owner": "nixos", "repo": "nixpkgs", - "rev": "b3582c75c7f21ce0b429898980eddbbf05c68e55", + "rev": "08dacfca559e1d7da38f3cf05f1f45ee9bfd213c", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1761880412, + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a7fc11be66bdfb5cdde611ee5ce381c183da8386", "type": "github" }, "original": { @@ -90,11 +123,48 @@ "root": { "inputs": { "devenv": "devenv", + "fenix": "fenix", "git-hooks": "git-hooks", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "pre-commit-hooks": [ "git-hooks" + ], + "rust-overlay": "rust-overlay" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1761849405, + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "f7de8ae045a5fe80f1203c5a1c3015b05f7c3550", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" ] + }, + "locked": { + "lastModified": 1761878277, + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "6604534e44090c917db714faa58d47861657690c", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" } } }, diff --git a/devenv.nix b/devenv.nix index 719b169..d61a2c9 100644 --- a/devenv.nix +++ b/devenv.nix @@ -11,14 +11,24 @@ pkgs.openssl pkgs.nodejs pkgs.vscode-langservers-extracted + pkgs.cargo-dist + pkgs.cargo-xwin + pkgs.clang + pkgs.onnxruntime ]; languages.rust = { enable = true; components = ["rustc" "clippy" "rustfmt" "cargo" "rust-analyzer"]; + channel = "nightly"; + targets = ["x86_64-unknown-linux-gnu" "x86_64-pc-windows-msvc"]; mold.enable = true; }; + env = { + ORT_DYLIB_PATH = "${pkgs.onnxruntime}/lib/libonnxruntime.so"; + }; + processes = { surreal_db.exec = "docker run --rm --pull always -p 8000:8000 --net=host --user $(id -u) -v $(pwd)/database:/database surrealdb/surrealdb:latest-dev start rocksdb:/database/database.db --user root_user --pass root_password"; }; diff --git a/devenv.yaml b/devenv.yaml index f06d9d4..84838c2 100644 --- a/devenv.yaml +++ b/devenv.yaml @@ -1,15 +1,11 @@ -# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json inputs: + fenix: + url: github:nix-community/fenix nixpkgs: url: github:nixos/nixpkgs/nixpkgs-unstable - -# If you're using non-OSS software, you can set allowUnfree to true. + rust-overlay: + url: github:oxalica/rust-overlay + inputs: + nixpkgs: + follows: nixpkgs allowUnfree: true - -# If you're willing to use a package that's vulnerable -# permittedInsecurePackages: -# - "openssl-1.1.1w" - -# If you have more than one devenv you can merge them -#imports: -# - ./backend diff --git a/dist-workspace.toml b/dist-workspace.toml index fed452b..106b44f 100644 --- a/dist-workspace.toml +++ b/dist-workspace.toml @@ -4,9 +4,12 @@ members = ["cargo:."] # Config for 'dist' [dist] # The preferred dist version to use in CI (Cargo.toml SemVer syntax) -cargo-dist-version = "0.28.0" +cargo-dist-version = "0.30.0" # CI backends to support ci = "github" +# Extra static files to include in each App (path relative to this Cargo.toml's dir) +include = [] +github-build-setup = "../build-setup.yml" # The installers to generate for each app installers = [] # Target platforms to build apps for (Rust target-triple syntax) diff --git a/docker-compose.yml b/docker-compose.yml index 79cf8b4..3d9b75f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: '3.8' - services: minne: build: . diff --git a/flake.lock b/flake.lock index 5cd5259..13ef3ca 100644 --- a/flake.lock +++ b/flake.lock @@ -35,11 +35,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1746232882, - "narHash": "sha256-MHmBH2rS8KkRRdoU/feC/dKbdlMkcNkB5mwkuipVHeQ=", + "lastModified": 1761672384, + "narHash": "sha256-o9KF3DJL7g7iYMZq9SWgfS1BFlNbsm6xplRjVlOCkXI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7a2622e2c0dbad5c4493cb268aba12896e28b008", + "rev": "08dacfca559e1d7da38f3cf05f1f45ee9bfd213c", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 1a2dd86..82292a2 100644 --- a/flake.nix +++ b/flake.nix @@ -13,69 +13,74 @@ flake-utils, crane, }: - flake-utils.lib.eachDefaultSystem ( - system: let - pkgs = nixpkgs.legacyPackages.${system}; - craneLib = crane.mkLib pkgs; + flake-utils.lib.eachDefaultSystem (system: let + pkgs = nixpkgs.legacyPackages.${system}; + lib = pkgs.lib; + craneLib = crane.mkLib pkgs; + libExt = + if pkgs.stdenv.isDarwin + then "dylib" + else "so"; + minne-pkg = craneLib.buildPackage { + src = lib.cleanSourceWith { + src = ./.; + filter = let + extraPaths = [ + (toString ./common/migrations) + (toString ./common/schemas) + (toString ./html-router/templates) + (toString ./html-router/assets) + ]; + in + path: type: let + p = toString path; + in + craneLib.filterCargoSources path type + || lib.any (x: lib.hasPrefix x p) extraPaths; + }; - minne-pkg = craneLib.buildPackage { - src = craneLib.cleanCargoSource ./.; - pname = "minne"; - version = "0.1.0"; + pname = "minne"; + version = "0.2.6"; + doCheck = false; - doCheck = false; + nativeBuildInputs = [pkgs.pkg-config pkgs.rustfmt pkgs.makeWrapper]; + buildInputs = [pkgs.openssl pkgs.chromium pkgs.onnxruntime]; - nativeBuildInputs = [ - pkgs.pkg-config - pkgs.rustfmt - pkgs.makeWrapper - ]; - - buildInputs = [ - pkgs.openssl - pkgs.chromium - pkgs.onnxruntime - ]; - - ORT_STRATEGY = "system"; - ORT_LIB_LOCATION = "${pkgs.onnxruntime}/lib"; - ORT_SKIP_DOWNLOAD = "1"; - - postInstall = '' - wrapProgram $out/bin/main \ - --set CHROME ${pkgs.chromium}/bin/chromium \ - --set ORT_DYLIB_PATH ${pkgs.onnxruntime}/lib/libonnxruntime.so - if [ -f $out/bin/worker ]; then - wrapProgram $out/bin/worker \ + postInstall = '' + wrapProgram $out/bin/main \ + --set CHROME ${pkgs.chromium}/bin/chromium \ + --set ORT_DYLIB_PATH ${pkgs.onnxruntime}/lib/libonnxruntime.${libExt} + for b in worker server; do + if [ -x "$out/bin/$b" ]; then + wrapProgram $out/bin/$b \ --set CHROME ${pkgs.chromium}/bin/chromium \ - --set ORT_DYLIB_PATH ${pkgs.onnxruntime}/lib/libonnxruntime.so + --set ORT_DYLIB_PATH ${pkgs.onnxruntime}/lib/libonnxruntime.${libExt} fi - if [ -f $out/bin/server]; then - wrapProgram $out/bin/server\ - --set ORT_DYLIB_PATH ${pkgs.onnxruntime}/lib/libonnxruntime.so - fi - ''; + done + ''; + }; + in { + packages = { + minne-pkg = minne-pkg; + default = minne-pkg; + }; + apps = { + main = flake-utils.lib.mkApp { + drv = minne-pkg; + name = "main"; }; - in { - packages = { - default = self.packages.${system}.minne-pkg; + worker = flake-utils.lib.mkApp { + drv = minne-pkg; + name = "worker"; }; - - apps = { - main = flake-utils.lib.mkApp { - drv = minne-pkg; - name = "main"; - }; - worker = flake-utils.lib.mkApp { - drv = minne-pkg; - name = "worker"; - }; - server = flake-utils.lib.mkApp { - drv = minne-pkg; - name = "server"; - }; - default = self.apps.${system}.main; + server = flake-utils.lib.mkApp { + drv = minne-pkg; + name = "server"; }; - } - ); + default = flake-utils.lib.mkApp { + drv = minne-pkg; + name = "main"; + }; + }; + }); } diff --git a/main/Cargo.toml b/main/Cargo.toml index d06f430..87a0fb6 100644 --- a/main/Cargo.toml +++ b/main/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "main" -version = "0.2.5" +version = "0.2.6" edition = "2021" repository = "https://github.com/perstarkse/minne" license = "AGPL-3.0-or-later" From ac22098d0d479ccdd6d539b97c647933d1a848ab Mon Sep 17 00:00:00 2001 From: Per Stark Date: Sat, 1 Nov 2025 10:43:46 +0100 Subject: [PATCH 3/3] release: 0.2.6 dist update fix new workflow fix mkdir moved to dist fix only dir dont verify sha files fix verify ci part fix no checking anymore --- .github/workflows/release.yml | 242 +++++++++++++++++----------------- dist-workspace.toml | 3 +- 2 files changed, 122 insertions(+), 123 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b8736d5..1df6944 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,44 +1,8 @@ -# This file was autogenerated by dist: https://opensource.axo.dev/cargo-dist/ -# -# Copyright 2022-2024, axodotdev -# SPDX-License-Identifier: MIT or Apache-2.0 -# -# CI that: -# -# * checks for a Git Tag that looks like a release -# * builds artifacts with dist (archives, installers, hashes) -# * uploads those artifacts to temporary workflow zip -# * on success, uploads the artifacts to a GitHub Release -# -# Note that the GitHub Release will be created with a generated -# title/body based on your changelogs. - name: Release permissions: - "contents": "write" - "packages": "write" + contents: write + packages: write -# This task will run whenever you push a git tag that looks like a version -# like "1.0.0", "v0.1.0-prerelease.1", "my-app/0.1.0", "releases/v1.0.0", etc. -# Various formats will be parsed into a VERSION and an optional PACKAGE_NAME, where -# PACKAGE_NAME must be the name of a Cargo package in your workspace, and VERSION -# must be a Cargo-style SemVer Version (must have at least major.minor.patch). -# -# If PACKAGE_NAME is specified, then the announcement will be for that -# package (erroring out if it doesn't have the given version or isn't dist-able). -# -# If PACKAGE_NAME isn't specified, then the announcement will be for all -# (dist-able) packages in the workspace with that version (this mode is -# intended for workspaces with only one dist-able package, or with all dist-able -# packages versioned/released in lockstep). -# -# If you push multiple tags at once, separate instances of this workflow will -# spin up, creating an independent announcement for each one. However, GitHub -# will hard limit this to 3 tags per commit, as it will assume more tags is a -# mistake. -# -# If there's a prerelease-style suffix to the version, then the release(s) -# will be marked as a prerelease. on: pull_request: push: @@ -46,9 +10,8 @@ on: - '**[0-9]+.[0-9]+.[0-9]+*' jobs: - # Run 'dist plan' (or host) to determine what tasks we need to do plan: - runs-on: "ubuntu-22.04" + runs-on: ubuntu-22.04 outputs: val: ${{ steps.plan.outputs.manifest }} tag: ${{ !github.event.pull_request && github.ref_name || '' }} @@ -60,52 +23,36 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install dist - # we specify bash to get pipefail; it guards against the `curl` command - # failing. otherwise `sh` won't catch that `curl` returned non-0 shell: bash - run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.28.0/cargo-dist-installer.sh | sh" + run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.30.0/cargo-dist-installer.sh | sh" + - name: Cache dist uses: actions/upload-artifact@v4 with: name: cargo-dist-cache path: ~/.cargo/bin/dist - # sure would be cool if github gave us proper conditionals... - # so here's a doubly-nested ternary-via-truthiness to try to provide the best possible - # functionality based on whether this is a pull_request, and whether it's from a fork. - # (PRs run on the *source* but secrets are usually on the *target* -- that's *good* - # but also really annoying to build CI around when it needs secrets to work right.) + - id: plan run: | dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json echo "dist ran successfully" cat plan-dist-manifest.json - echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT" - - name: "Upload dist-manifest.json" + echo "manifest=$(jq -c . plan-dist-manifest.json)" >> "$GITHUB_OUTPUT" + + - name: Upload dist-manifest.json uses: actions/upload-artifact@v4 with: name: artifacts-plan-dist-manifest path: plan-dist-manifest.json - # Build and packages all the platform-specific things build-local-artifacts: name: build-local-artifacts (${{ join(matrix.targets, ', ') }}) - # Let the initial task tell us to not run (currently very blunt) - needs: - - plan + needs: [plan] if: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix.include != null && (needs.plan.outputs.publishing == 'true' || fromJson(needs.plan.outputs.val).ci.github.pr_run_mode == 'upload') }} strategy: fail-fast: false - # Target platforms/runners are computed by dist in create-release. - # Each member of the matrix has the following arguments: - # - # - runner: the github runner - # - dist-args: cli flags to pass to dist - # - install-dist: expression to run to install dist on the runner - # - # Typically there will be: - # - 1 "global" task that builds universal installers - # - N "local" tasks that build each platform's binaries and platform-specific installers matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }} runs-on: ${{ matrix.runner }} container: ${{ matrix.container && matrix.container.image || null }} @@ -114,11 +61,12 @@ jobs: BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json steps: - name: enable windows longpaths - run: | - git config --global core.longpaths true + run: git config --global core.longpaths true + - uses: actions/checkout@v4 with: submodules: recursive + - name: Install Rust non-interactively if not already installed if: ${{ matrix.container }} run: | @@ -126,37 +74,103 @@ jobs: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y echo "$HOME/.cargo/bin" >> $GITHUB_PATH fi + - name: Install dist run: ${{ matrix.install_dist.run }} - # Get the dist-manifest + - name: Fetch local artifacts uses: actions/download-artifact@v4 with: pattern: artifacts-* path: target/distrib/ merge-multiple: true + + # ===== BEGIN: Injected ORT staging for cargo-dist bundling ===== + - run: echo "=== BUILD-SETUP START ===" + + # Unix shells + - name: Prepare lib dir (Unix) + if: runner.os != 'Windows' + shell: bash + run: | + mkdir -p lib + rm -f lib/* + + # Windows PowerShell + - name: Prepare lib dir (Windows) + if: runner.os == 'Windows' + shell: pwsh + run: | + New-Item -ItemType Directory -Force -Path lib | Out-Null + # remove contents if any + Get-ChildItem -Path lib -Force | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue + + - name: Fetch ONNX Runtime (Linux) + if: runner.os == 'Linux' + env: + ORT_VER: 1.22.0 + run: | + set -euo pipefail + ARCH="$(uname -m)" + case "$ARCH" in + x86_64) URL="https://github.com/microsoft/onnxruntime/releases/download/v${ORT_VER}/onnxruntime-linux-x64-${ORT_VER}.tgz" ;; + aarch64) URL="https://github.com/microsoft/onnxruntime/releases/download/v${ORT_VER}/onnxruntime-linux-aarch64-${ORT_VER}.tgz" ;; + *) echo "Unsupported arch $ARCH"; exit 1 ;; + esac + curl -fsSL -o ort.tgz "$URL" + tar -xzf ort.tgz + cp -v onnxruntime-*/lib/libonnxruntime.so* lib/ + # normalize to stable name if needed + [ -f lib/libonnxruntime.so ] || cp -v lib/libonnxruntime.so.* lib/libonnxruntime.so + + - name: Fetch ONNX Runtime (macOS) + if: runner.os == 'macOS' + env: + ORT_VER: 1.22.0 + run: | + set -euo pipefail + curl -fsSL -o ort.tgz "https://github.com/microsoft/onnxruntime/releases/download/v${ORT_VER}/onnxruntime-osx-universal2-${ORT_VER}.tgz" + tar -xzf ort.tgz + cp -v onnxruntime-*/lib/libonnxruntime*.dylib lib/ + [ -f lib/libonnxruntime.dylib ] || cp -v lib/libonnxruntime*.dylib lib/libonnxruntime.dylib + + - name: Fetch ONNX Runtime (Windows) + if: runner.os == 'Windows' + shell: pwsh + env: + ORT_VER: 1.22.0 + run: | + $url = "https://github.com/microsoft/onnxruntime/releases/download/v$env:ORT_VER/onnxruntime-win-x64-$env:ORT_VER.zip" + Invoke-WebRequest $url -OutFile ort.zip + Expand-Archive ort.zip -DestinationPath ort + $dll = Get-ChildItem -Recurse -Path ort -Filter onnxruntime.dll | Select-Object -First 1 + Copy-Item $dll.FullName lib\onnxruntime.dll + + - run: | + echo "=== BUILD-SETUP END ===" + echo "lib/ contents:" + ls -l lib || dir lib + # ===== END: Injected ORT staging ===== + - name: Install dependencies run: | ${{ matrix.packages_install }} + - name: Build artifacts run: | - # Actually do builds and make zips and whatnot dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json echo "dist ran successfully" + - id: cargo-dist name: Post-build - # We force bash here just because github makes it really hard to get values up - # to "real" actions without writing to env-vars, and writing to env-vars has - # inconsistent syntax between shell and powershell. shell: bash run: | - # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" - cp dist-manifest.json "$BUILD_MANIFEST_NAME" - - name: "Upload artifacts" + + - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: artifacts-build-local-${{ join(matrix.targets, '_') }} @@ -167,16 +181,16 @@ jobs: build_and_push_docker_image: name: Build and Push Docker Image runs-on: ubuntu-latest - needs: [plan] - if: ${{ needs.plan.outputs.publishing == 'true' }} + needs: [plan] + if: ${{ needs.plan.outputs.publishing == 'true' }} permissions: - contents: read # Permission to checkout the repository - packages: write # Permission to push Docker image to GHCR + contents: read + packages: write steps: - name: Checkout repository uses: actions/checkout@v4 with: - submodules: recursive # Matches your other checkout steps + submodules: recursive - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -185,33 +199,28 @@ jobs: uses: docker/login-action@v3 with: registry: ghcr.io - username: ${{ github.actor }} # User triggering the workflow + username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Extract Docker metadata id: meta uses: docker/metadata-action@v5 with: - images: ghcr.io/${{ github.repository }} - # This action automatically uses the Git tag as the Docker image tag. - # For example, a Git tag 'v1.2.3' will result in Docker tag 'ghcr.io/owner/repo:v1.2.3'. + images: ghcr.io/${{ github.repository }} - name: Build and push Docker image uses: docker/build-push-action@v5 with: - context: . + context: . push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha # Enable Docker layer caching from GitHub Actions cache - cache-to: type=gha,mode=max # Enable Docker layer caching to GitHub Actions cache + cache-from: type=gha + cache-to: type=gha,mode=max - # Build and package all the platform-agnostic(ish) things build-global-artifacts: - needs: - - plan - - build-local-artifacts - runs-on: "ubuntu-22.04" + needs: [plan, build-local-artifacts] + runs-on: ubuntu-22.04 env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BUILD_MANIFEST_NAME: target/distrib/global-dist-manifest.json @@ -219,92 +228,90 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install cached dist uses: actions/download-artifact@v4 with: name: cargo-dist-cache path: ~/.cargo/bin/ - run: chmod +x ~/.cargo/bin/dist - # Get all the local artifacts for the global tasks to use (for e.g. checksums) + - name: Fetch local artifacts uses: actions/download-artifact@v4 with: pattern: artifacts-* path: target/distrib/ merge-multiple: true + - id: cargo-dist shell: bash run: | dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json echo "dist ran successfully" - - # Parse out what we just built and upload it to scratch storage echo "paths<> "$GITHUB_OUTPUT" jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT" echo "EOF" >> "$GITHUB_OUTPUT" - cp dist-manifest.json "$BUILD_MANIFEST_NAME" - - name: "Upload artifacts" + + - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: artifacts-build-global path: | ${{ steps.cargo-dist.outputs.paths }} ${{ env.BUILD_MANIFEST_NAME }} - # Determines if we should publish/announce + host: - needs: - - plan - - build-local-artifacts - - build-global-artifacts - # Only run if we're "publishing", and only if local and global didn't fail (skipped is fine) + needs: [plan, build-local-artifacts, build-global-artifacts] if: ${{ always() && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - runs-on: "ubuntu-22.04" + runs-on: ubuntu-22.04 outputs: val: ${{ steps.host.outputs.manifest }} steps: - uses: actions/checkout@v4 with: submodules: recursive + - name: Install cached dist uses: actions/download-artifact@v4 with: name: cargo-dist-cache path: ~/.cargo/bin/ - run: chmod +x ~/.cargo/bin/dist - # Fetch artifacts from scratch-storage + - name: Fetch artifacts uses: actions/download-artifact@v4 with: pattern: artifacts-* path: target/distrib/ merge-multiple: true + - id: host shell: bash run: | dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json echo "artifacts uploaded and released successfully" cat dist-manifest.json - echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT" - - name: "Upload dist-manifest.json" + echo "manifest=$(jq -c . dist-manifest.json)" >> "$GITHUB_OUTPUT" + + - name: Upload dist-manifest.json uses: actions/upload-artifact@v4 with: - # Overwrite the previous copy name: artifacts-dist-manifest path: dist-manifest.json - # Create a GitHub Release while uploading all files to it - - name: "Download GitHub Artifacts" + + - name: Download GitHub Artifacts uses: actions/download-artifact@v4 with: pattern: artifacts-* path: artifacts merge-multiple: true + - name: Cleanup - run: | - # Remove the granular manifests - rm -f artifacts/*-dist-manifest.json + run: rm -f artifacts/*-dist-manifest.json + - name: Create GitHub Release env: PRERELEASE_FLAG: "${{ fromJson(steps.host.outputs.manifest).announcement_is_prerelease && '--prerelease' || '' }}" @@ -312,20 +319,13 @@ jobs: ANNOUNCEMENT_BODY: "${{ fromJson(steps.host.outputs.manifest).announcement_github_body }}" RELEASE_COMMIT: "${{ github.sha }}" run: | - # Write and read notes from a file to avoid quoting breaking things echo "$ANNOUNCEMENT_BODY" > $RUNNER_TEMP/notes.txt - gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/* announce: - needs: - - plan - - host - # use "always() && ..." to allow us to wait for all publish jobs while - # still allowing individual publish jobs to skip themselves (for prereleases). - # "host" however must run to completion, no skipping allowed! + needs: [plan, host] if: ${{ always() && needs.host.result == 'success' }} - runs-on: "ubuntu-22.04" + runs-on: ubuntu-22.04 env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: diff --git a/dist-workspace.toml b/dist-workspace.toml index 106b44f..ab9bb09 100644 --- a/dist-workspace.toml +++ b/dist-workspace.toml @@ -8,8 +8,7 @@ cargo-dist-version = "0.30.0" # CI backends to support ci = "github" # Extra static files to include in each App (path relative to this Cargo.toml's dir) -include = [] -github-build-setup = "../build-setup.yml" +include = ["lib"] # The installers to generate for each app installers = [] # Target platforms to build apps for (Rust target-triple syntax)