From b1da240550b8d2a541feecebf98fb475db59f413 Mon Sep 17 00:00:00 2001 From: Serj Zavadsky Date: Fri, 7 Oct 2022 23:51:50 +0200 Subject: [PATCH 01/13] deno patched --- Cargo.lock | 12 ++++-------- Cargo.toml | 5 ++++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0eb0227..3db4a23 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -29,8 +29,6 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "deno_core" version = "0.114.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8ddd27161918d0d0cc44ee5ff3b817b4c87e868922d63ee026f3e7c24f36131" dependencies = [ "anyhow", "futures", @@ -216,9 +214,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" +checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" [[package]] name = "js-sandbox" @@ -524,8 +522,6 @@ dependencies = [ [[package]] name = "serde_v8" version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f393dfbff517625ec0d87f449c8778f5645ebff9408f70988cf9a9ac33525934" dependencies = [ "serde", "serde_bytes", @@ -549,9 +545,9 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "syn" -version = "1.0.101" +version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e90cde112c4b9690b8cbe810cba9ddd8bc1d7472e2cae317b69e9438c1cba7d2" +checksum = "3fcd952facd492f9be3ef0d0b7032a6e442ee9b361d4acc2b1d0c4aaa5f613a1" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index bdbc12a..bb4e329 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,4 +14,7 @@ serde = { version = "1.0.145", features = ["derive"] } serde_json = "1.0.85" anyhow = "1.0.65" thiserror = "1.0.37" -js-sandbox = "0.2.0-rc.0" \ No newline at end of file +js-sandbox = "0.2.0-rc.0" + +[patch.crates-io] +deno_core = { git = "https://github.com/fevral13/deno.git", branch = "patched" } \ No newline at end of file From dd2a9c0817c5ccaed679bc8ce20b210dc8f8d667 Mon Sep 17 00:00:00 2001 From: Serj Zavadsky Date: Sat, 8 Oct 2022 00:00:44 +0200 Subject: [PATCH 02/13] version 0.1.1 --- Cargo.lock | 2 ++ Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 3db4a23..4836427 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -29,6 +29,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "deno_core" version = "0.114.0" +source = "git+https://github.com/fevral13/deno.git?branch=patched#fe1c73b8ab03afdbb2db93f969d7af918cb6017a" dependencies = [ "anyhow", "futures", @@ -522,6 +523,7 @@ dependencies = [ [[package]] name = "serde_v8" version = "0.25.0" +source = "git+https://github.com/fevral13/deno.git?branch=patched#fe1c73b8ab03afdbb2db93f969d7af918cb6017a" dependencies = [ "serde", "serde_bytes", diff --git a/Cargo.toml b/Cargo.toml index bb4e329..906b8d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "evalrspy" -version = "0.1.0" +version = "0.1.1" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html From f5f7db9f09054958346a2865c1c2d087ff765c93 Mon Sep 17 00:00:00 2001 From: Serj Zavadsky Date: Sat, 8 Oct 2022 01:04:54 +0200 Subject: [PATCH 03/13] CI config update? --- .github/workflows/CI.yml | 1 + Cargo.lock | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ef17cdc..2fe5048 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -15,6 +15,7 @@ jobs: - uses: messense/maturin-action@v1 with: manylinux: auto + musllinux: 1.2 command: build args: --release --sdist -o dist --find-interpreter - name: Upload wheels diff --git a/Cargo.lock b/Cargo.lock index 4836427..60fac97 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -54,7 +54,7 @@ checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" [[package]] name = "evalrspy" -version = "0.1.0" +version = "0.1.1" dependencies = [ "anyhow", "js-sandbox", From 5bd8615f62538a5e31bcde428db3b159bb2c6e49 Mon Sep 17 00:00:00 2001 From: Serj Zavadsky Date: Sat, 8 Oct 2022 01:06:59 +0200 Subject: [PATCH 04/13] CI config update? --- .github/workflows/CI.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 2fe5048..7558f63 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -14,8 +14,7 @@ jobs: - uses: actions/checkout@v3 - uses: messense/maturin-action@v1 with: - manylinux: auto - musllinux: 1.2 + manylinux: musllinux_1_2 command: build args: --release --sdist -o dist --find-interpreter - name: Upload wheels From b48dd6c2246107d7f8fcf1d84a723ce0777e4770 Mon Sep 17 00:00:00 2001 From: Serj Zavadsky Date: Sat, 8 Oct 2022 01:07:58 +0200 Subject: [PATCH 05/13] version 0.1.2 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 906b8d3..abb8719 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "evalrspy" -version = "0.1.1" +version = "0.1.2" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html From 9632d8e49449234ae131c56098ada897f6d1cbc1 Mon Sep 17 00:00:00 2001 From: Serj Zavadsky Date: Sat, 8 Oct 2022 01:14:50 +0200 Subject: [PATCH 06/13] version 0.1.2 --- .github/workflows/CI.yml | 54 ++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7558f63..cbb226b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -10,32 +10,38 @@ on: jobs: linux: runs-on: ubuntu-latest + strategy: + matrix: + platform: [ + { target: "x86_64-unknown-linux-musl", image_tag: "x86_64-musl" }, + { target: "aarch64-unknown-linux-musl", image_tag: "aarch64-musl" }, + ] + container: + image: docker://messense/rust-musl-cross:${{ matrix.platform.image_tag }} + env: + CFLAGS_armv7_unknown_linux_musleabihf: '-mfpu=vfpv3-d16' steps: - - uses: actions/checkout@v3 - - uses: messense/maturin-action@v1 - with: - manylinux: musllinux_1_2 - command: build - args: --release --sdist -o dist --find-interpreter - - name: Upload wheels - uses: actions/upload-artifact@v2 - with: - name: wheels - path: dist + - uses: actions/checkout@v2 + - name: Build Wheels - manylinux + uses: messense/maturin-action@main + with: + target: ${{ matrix.platform.target }} + manylinux: auto + container: off + args: --release -o dist + - name: Build Wheels - musllinux + uses: messense/maturin-action@main + with: + target: ${{ matrix.platform.target }} + manylinux: musllinux_1_1 + container: off - windows: - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - uses: messense/maturin-action@v1 - with: - command: build - args: --release -o dist --find-interpreter - - name: Upload wheels - uses: actions/upload-artifact@v2 - with: - name: wheels - path: dist + args: --release -o dist + - name: Upload wheels + uses: actions/upload-artifact@v2 + with: + name: wheels + path: dist macos: runs-on: macos-latest From d0c2c89573ecfd4130b1dcc8aabcf64044798fea Mon Sep 17 00:00:00 2001 From: Serj Zavadsky Date: Sat, 8 Oct 2022 01:15:48 +0200 Subject: [PATCH 07/13] version 0.1.2 --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index cbb226b..a0eb25d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -61,7 +61,7 @@ jobs: name: Release runs-on: ubuntu-latest # if: "startsWith(github.ref, 'refs/tags/')" - needs: [ macos, windows, linux ] + needs: [ macos, linux ] steps: - uses: actions/download-artifact@v2 with: From f0f5f18cea0a4ce2ff5addc40b82b2d6c0ffacee Mon Sep 17 00:00:00 2001 From: Serj Zavadsky Date: Sat, 8 Oct 2022 01:18:21 +0200 Subject: [PATCH 08/13] version 0.1.2 --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a0eb25d..f157d6c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -33,7 +33,7 @@ jobs: uses: messense/maturin-action@main with: target: ${{ matrix.platform.target }} - manylinux: musllinux_1_1 + manylinux: musllinux_1_2 container: off args: --release -o dist From f023ecefe64204d7e39c261a15cb03d1a7df9480 Mon Sep 17 00:00:00 2001 From: Serj Zavadsky Date: Sat, 8 Oct 2022 01:18:42 +0200 Subject: [PATCH 09/13] version 0.1.2 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index abb8719..eadb6f8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "evalrspy" -version = "0.1.2" +version = "0.1.3" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html From 77a23edbefba09c60a091ed70036eea738595a8d Mon Sep 17 00:00:00 2001 From: Serj Zavadsky Date: Sun, 9 Oct 2022 22:15:06 +0200 Subject: [PATCH 10/13] dep lib version update --- Cargo.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 60fac97..50acdb9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -54,7 +54,7 @@ checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" [[package]] name = "evalrspy" -version = "0.1.1" +version = "0.1.3" dependencies = [ "anyhow", "js-sandbox", @@ -605,9 +605,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd" +checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" [[package]] name = "unicode-normalization" From 22810d1346cdd5c0bbedde0195c75048ef75f42c Mon Sep 17 00:00:00 2001 From: Serj Zavadsky Date: Sun, 9 Oct 2022 22:15:25 +0200 Subject: [PATCH 11/13] error handling refactored --- src/evaluator/evaluator.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/evaluator/evaluator.rs b/src/evaluator/evaluator.rs index 8c091d1..5889cf9 100644 --- a/src/evaluator/evaluator.rs +++ b/src/evaluator/evaluator.rs @@ -1,13 +1,13 @@ use js_sandbox::{AnyError, Script}; use pyo3::prelude::*; -use serde::{self, Deserialize}; +use serde; use serde_json::{self, Value}; use std::time::Duration; use thiserror; use super::constants::{DEFAULT_TIMEOUT, JS_PRELUDE}; -#[derive(Debug, Deserialize)] +#[derive(Debug, serde::Deserialize)] pub struct Request { pub script: String, pub variables: Value, @@ -24,16 +24,16 @@ impl Request { #[derive(thiserror::Error, Debug)] enum EvalrsError { #[error("Wrong argument structure")] - WrongArguments, + WrongArguments(#[source] serde_json::Error), #[error("Variables must be a dict")] WrongVariablesType, #[error("Script is not a valid JS code")] - WrongScriptCode { source: AnyError }, + WrongScriptCode(#[source] AnyError), #[error("Script evaluation error")] - ScriptEvaluationError { source: AnyError }, + ScriptEvaluationError(#[source] AnyError), } #[pyfunction] @@ -67,7 +67,7 @@ fn parse_request(request_string: &str) -> Result { match parse_result { Ok(request) => Ok(request), - Err(_) => Err(EvalrsError::WrongArguments), + Err(error) => Err(EvalrsError::WrongArguments(error)), } } @@ -93,7 +93,7 @@ fn get_script_evaluator(script_code: &str, timeout: u64) -> Result Ok(evaluator.with_timeout(duration)), - Err(error) => Err(EvalrsError::WrongScriptCode { source: error }), + Err(error) => Err(EvalrsError::WrongScriptCode(error)), } } @@ -107,7 +107,7 @@ fn evaluate_script( (Value::String(script.clone()), variables.clone()), ) { Ok(result) => Ok(result), - Err(error) => Err(EvalrsError::ScriptEvaluationError { source: error }), + Err(error) => Err(EvalrsError::ScriptEvaluationError(error)), } } From 8dc31b93b943c55c4e91dfabd8a781aaec26af8a Mon Sep 17 00:00:00 2001 From: Serj Zavadsky Date: Sun, 9 Oct 2022 22:15:53 +0200 Subject: [PATCH 12/13] finding the right setting for cross compile settings --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f157d6c..783fbec 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -14,7 +14,7 @@ jobs: matrix: platform: [ { target: "x86_64-unknown-linux-musl", image_tag: "x86_64-musl" }, - { target: "aarch64-unknown-linux-musl", image_tag: "aarch64-musl" }, +# { target: "aarch64-unknown-linux-musl", image_tag: "aarch64-musl" }, ] container: image: docker://messense/rust-musl-cross:${{ matrix.platform.image_tag }} From fa48b18ef0dc09339118a2edda5a18cda2b43124 Mon Sep 17 00:00:00 2001 From: Serj Zavadsky Date: Sun, 9 Oct 2022 22:32:55 +0200 Subject: [PATCH 13/13] finding the right setting for cross compile settings --- .github/workflows/CI.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 783fbec..73c838b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -22,13 +22,13 @@ jobs: CFLAGS_armv7_unknown_linux_musleabihf: '-mfpu=vfpv3-d16' steps: - uses: actions/checkout@v2 - - name: Build Wheels - manylinux - uses: messense/maturin-action@main - with: - target: ${{ matrix.platform.target }} - manylinux: auto - container: off - args: --release -o dist +# - name: Build Wheels - manylinux +# uses: messense/maturin-action@main +# with: +# target: ${{ matrix.platform.target }} +# manylinux: auto +# container: off +# args: --release -o dist - name: Build Wheels - musllinux uses: messense/maturin-action@main with: