Skip to content

Commit

Permalink
feat(rce): duckdb (#184)
Browse files Browse the repository at this point in the history
* feat(rce): duckdb

* fix(rce): use string includes for confirming installation works

* fix(rce): inverse assertion on Hello world output
  • Loading branch information
aldy505 authored Oct 27, 2024
1 parent e30f457 commit 599f648
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
15 changes: 15 additions & 0 deletions rce/packages/duckdb/config.toml
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions rce/packages/duckdb/install.sh
Original file line number Diff line number Diff line change
@@ -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"
1 change: 1 addition & 0 deletions rce/packages/duckdb/test.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SELECT 'Hello world!';
4 changes: 2 additions & 2 deletions rce/scripts/install.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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()}"`,
);
Expand All @@ -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()}"`,
);
Expand Down

0 comments on commit 599f648

Please sign in to comment.