From 599f648ec23c3e7ffd995ed4bf302373b4d00b3d Mon Sep 17 00:00:00 2001 From: Reinaldy Rafli Date: Sun, 27 Oct 2024 19:43:02 +0700 Subject: [PATCH] feat(rce): duckdb (#184) * feat(rce): duckdb * fix(rce): use string includes for confirming installation works * fix(rce): inverse assertion on Hello world output --- rce/packages/duckdb/config.toml | 15 +++++++++++++++ rce/packages/duckdb/install.sh | 15 +++++++++++++++ rce/packages/duckdb/test.sql | 1 + rce/scripts/install.cjs | 4 ++-- 4 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 rce/packages/duckdb/config.toml create mode 100755 rce/packages/duckdb/install.sh create mode 100644 rce/packages/duckdb/test.sql diff --git a/rce/packages/duckdb/config.toml b/rce/packages/duckdb/config.toml new file mode 100644 index 0000000..d1b2f9b --- /dev/null +++ b/rce/packages/duckdb/config.toml @@ -0,0 +1,15 @@ +language = "DuckDB" +version = "1.0.0" +compiled = false +extension = "sql" +environment = [ + "PATH=/opt/duckdb/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", +] +build_command = [] +run_command = [ "/bin/cat", "{file}", "|", "duckdb", "-noheader", "-ascii" ] +test_file = "test.sql" +aliases = [ "duckdb" ] +should_limit_memory = true +memory_limit = 256 +process_limit = 256 +allowed_entrypoints = 1 diff --git a/rce/packages/duckdb/install.sh b/rce/packages/duckdb/install.sh new file mode 100755 index 0000000..872d827 --- /dev/null +++ b/rce/packages/duckdb/install.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +cd ~ + +curl -LO https://github.com/duckdb/duckdb/releases/download/v1.0.0/duckdb_cli-linux-amd64.zip + +unzip duckdb_cli-linux-amd64.zip + +rm duckdb_cli-linux-amd64.zip + +mkdir -p /opt/duckdb/bin + +mv -v duckdb /opt/duckdb/bin/duckdb + +echo "DuckDB installation finished" diff --git a/rce/packages/duckdb/test.sql b/rce/packages/duckdb/test.sql new file mode 100644 index 0000000..78914dc --- /dev/null +++ b/rce/packages/duckdb/test.sql @@ -0,0 +1 @@ +SELECT 'Hello world!'; diff --git a/rce/scripts/install.cjs b/rce/scripts/install.cjs index 95e746e..654c41e 100644 --- a/rce/scripts/install.cjs +++ b/rce/scripts/install.cjs @@ -130,7 +130,7 @@ function execute( ); console.log(testResult); - if (testResult.trim() !== "Hello world!") { + if (!testResult.trim().includes("Hello world!")) { throw new Error( `Test file failed for package ${pkg.name}. Expecting "Hello world!", got "${testResult.trim()}"`, ); @@ -143,7 +143,7 @@ function execute( ); console.log(testResult); - if (testResult.trim() !== "Hello world!") { + if (!testResult.trim().includes("Hello world!")) { throw new Error( `Test file failed for package ${pkg.name}. Expecting "Hello world!", got "${testResult.trim()}"`, );