From bcd7bae9189c801fe77d5d99471838e558221f82 Mon Sep 17 00:00:00 2001
From: Julien Girard <julien.girard2@cea.fr>
Date: Thu, 20 Jun 2024 15:07:09 +0200
Subject: [PATCH] [release][wip] Custom action to ensure python3 onnx package
 is available for tests

---
 caisar.opam          |  3 ++-
 caisar.opam.template | 17 +++++++++++++++++
 tests/dune           |  7 +++++++
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/caisar.opam b/caisar.opam
index ed401cf1..67fd9e90 100644
--- a/caisar.opam
+++ b/caisar.opam
@@ -38,6 +38,7 @@ depends: [
   "conf-python-3" {with-test}
   "odoc" {with-doc}
 ]
+dev-repo: "git+https://git.frama-c.com/pub/caisar.git"
 build: [
   ["dune" "subst"] {dev}
   [
@@ -49,9 +50,9 @@ build: [
     jobs
     "--promote-install-files=false"
     "@install"
+    "@ensures-onnx"
     "@runtest" {with-test}
     "@doc" {with-doc}
   ]
   ["dune" "install" "-p" name "--create-install-files" name]
 ]
-dev-repo: "git+https://git.frama-c.com/pub/caisar.git"
diff --git a/caisar.opam.template b/caisar.opam.template
index e69de29b..921585e4 100644
--- a/caisar.opam.template
+++ b/caisar.opam.template
@@ -0,0 +1,17 @@
+build: [
+  ["dune" "subst"] {dev}
+  [
+    "dune"
+    "build"
+    "-p"
+    name
+    "-j"
+    jobs
+    "--promote-install-files=false"
+    "@install"
+    "@ensures-onnx"
+    "@runtest" {with-test}
+    "@doc" {with-doc}
+  ]
+  ["dune" "install" "-p" name "--create-install-files" name]
+]
diff --git a/tests/dune b/tests/dune
index 57ad5a8b..35bc5f6a 100644
--- a/tests/dune
+++ b/tests/dune
@@ -1,3 +1,10 @@
+(rule
+  (alias ensures-onnx)
+  (deps (package caisar))
+  (action
+    (system "curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3 get-pip.py && python3 -m pip install onnx"))
+)
+
 (cram
  (alias local)
  (applies_to * \ nir_to_onnx acasxu_ci arithmetic comparison sequencing)
-- 
GitLab