From 00453fdcbeb5e130f31472d10a7eccca05498175 Mon Sep 17 00:00:00 2001 From: Per Stark Date: Fri, 12 Jun 2026 09:11:55 +0200 Subject: [PATCH] chore: bump to 1.0.3 and harmonize onnx runtime version across nix, ci, and docker. --- .github/build-setup.yml | 49 ----------------------------------- .github/workflows/release.yml | 20 +++++++++----- Cargo.lock | 2 +- Dockerfile | 8 +++--- devenv.nix | 8 +++++- dist-workspace.toml | 2 +- flake.nix | 29 +++++++++++++++++---- main/Cargo.toml | 2 +- ort-version | 1 + 9 files changed, 53 insertions(+), 68 deletions(-) delete mode 100644 .github/build-setup.yml create mode 100644 ort-version diff --git a/.github/build-setup.yml b/.github/build-setup.yml deleted file mode 100644 index c6aa02f..0000000 --- a/.github/build-setup.yml +++ /dev/null @@ -1,49 +0,0 @@ -- 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/.github/workflows/release.yml b/.github/workflows/release.yml index 1df6944..4534473 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,9 +24,18 @@ jobs: with: submodules: recursive + - name: Install Nix + uses: cachix/install-nix-action@v27 + with: + extra_nix_config: | + experimental-features = nix-command flakes + + - name: Verify ort-version matches nixpkgs onnxruntime + run: nix flake check --system x86_64-linux -L + - name: Install dist shell: bash - run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.30.0/cargo-dist-installer.sh | sh" + run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.30.3/cargo-dist-installer.sh | sh" - name: Cache dist uses: actions/upload-artifact@v4 @@ -67,6 +76,9 @@ jobs: with: submodules: recursive + - name: Load ONNX Runtime version + run: echo "ORT_VER=$(tr -d '[:space:]' < ort-version)" >> "$GITHUB_ENV" + - name: Install Rust non-interactively if not already installed if: ${{ matrix.container }} run: | @@ -107,8 +119,6 @@ jobs: - name: Fetch ONNX Runtime (Linux) if: runner.os == 'Linux' - env: - ORT_VER: 1.22.0 run: | set -euo pipefail ARCH="$(uname -m)" @@ -125,8 +135,6 @@ jobs: - 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" @@ -137,8 +145,6 @@ jobs: - 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 diff --git a/Cargo.lock b/Cargo.lock index 0f6ca8c..003d45d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3832,7 +3832,7 @@ checksum = "670fdfda89751bc4a84ac13eaa63e205cf0fd22b4c9a5fbfa085b63c1f1d3a30" [[package]] name = "main" -version = "1.0.2" +version = "1.0.3" dependencies = [ "anyhow", "api-router", diff --git a/Dockerfile b/Dockerfile index 66f0e55..1173b87 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,9 +30,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libgomp1 libstdc++6 curl \ && rm -rf /var/lib/apt/lists/* -# ONNX Runtime (CPU). Keep in sync with ort crate requirements. -ARG ORT_VERSION=1.23.2 -RUN mkdir -p /opt/onnxruntime && \ +# ONNX Runtime (CPU). Version is read from ort-version (override with --build-arg ORT_VERSION=...). +COPY ort-version /tmp/ort-version +ARG ORT_VERSION +RUN ORT_VERSION="${ORT_VERSION:-$(tr -d '[:space:]' < /tmp/ort-version)}" && \ + 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" && \ tar -xzf /tmp/ort.tgz -C /opt/onnxruntime --strip-components=1 && rm /tmp/ort.tgz diff --git a/devenv.nix b/devenv.nix index bf21888..ca89950 100644 --- a/devenv.nix +++ b/devenv.nix @@ -4,7 +4,13 @@ config, inputs, ... -}: { +}: +let + ortVersion = lib.removeSuffix "\n" (builtins.readFile "${toString ./.}/ort-version"); +in +lib.assertMsg (pkgs.onnxruntime.version == ortVersion) + "pkgs.onnxruntime.version (${pkgs.onnxruntime.version}) must match ort-version (${ortVersion})" +{ cachix.enable = false; packages = [ diff --git a/dist-workspace.toml b/dist-workspace.toml index 4384e5e..225ded9 100644 --- a/dist-workspace.toml +++ b/dist-workspace.toml @@ -4,7 +4,7 @@ members = ["cargo:."] # Config for 'dist' [dist] # The preferred dist version to use in CI (Cargo.toml SemVer syntax) -cargo-dist-version = "0.30.0" +cargo-dist-version = "0.30.3" # CI backends to support ci = "github" # Extra static files to include in each App (path relative to this Cargo.toml's dir) diff --git a/flake.nix b/flake.nix index 3486d32..cede23e 100644 --- a/flake.nix +++ b/flake.nix @@ -12,7 +12,10 @@ nixpkgs, flake-utils, crane, - }: + }: let + inherit (nixpkgs.legacyPackages.x86_64-linux) lib; + ortVersion = lib.removeSuffix "\n" (builtins.readFile "${self}/ort-version"); + in flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; lib = pkgs.lib; @@ -21,7 +24,9 @@ if pkgs.stdenv.isDarwin then "dylib" else "so"; - minne-pkg = craneLib.buildPackage { + minne-pkg = + if pkgs.onnxruntime.version == ortVersion then + craneLib.buildPackage { src = lib.cleanSourceWith { src = ./.; filter = let @@ -40,7 +45,7 @@ }; pname = "minne"; - version = "0.2.6"; + version = "1.0.3"; doCheck = false; nativeBuildInputs = [pkgs.pkg-config pkgs.rustfmt pkgs.makeWrapper]; @@ -58,7 +63,9 @@ fi done ''; - }; + } + else + throw "pkgs.onnxruntime.version (${pkgs.onnxruntime.version}) must match ort-version (${ortVersion})"; in { packages = { minne-pkg = minne-pkg; @@ -82,5 +89,17 @@ name = "main"; }; }; - }); + checks = { + ortVersion = pkgs.runCommand "ort-version-check" {} '' + if [ "${pkgs.onnxruntime.version}" != "${ortVersion}" ]; then + echo "pkgs.onnxruntime.version is ${pkgs.onnxruntime.version}, but ort-version pins ${ortVersion}" >&2 + echo "Update ort-version or wait for nixpkgs to catch up." >&2 + exit 1 + fi + touch $out + ''; + }; + }) // { + ortVersion = ortVersion; + }; } diff --git a/main/Cargo.toml b/main/Cargo.toml index 9dcf6f1..33a49f0 100644 --- a/main/Cargo.toml +++ b/main/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "main" -version = "1.0.2" +version = "1.0.3" edition = "2021" repository = "https://github.com/perstarkse/minne" license = "AGPL-3.0-or-later" diff --git a/ort-version b/ort-version new file mode 100644 index 0000000..14bee92 --- /dev/null +++ b/ort-version @@ -0,0 +1 @@ +1.23.2