Skip to content

Commit 738e47b

Browse files
committed
updates, gh actions
1 parent ca0151b commit 738e47b

22 files changed

+933
-353
lines changed

.cargo/config

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/test.yaml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: "test build"
2+
on:
3+
push:
4+
branches:
5+
- main
6+
permissions:
7+
contents: read
8+
jobs:
9+
test-ubuntu:
10+
name: Testing ubuntu-latest
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/cache@v3
15+
with:
16+
path: |
17+
~/.cargo/bin/
18+
~/.cargo/registry/index/
19+
~/.cargo/registry/cache/
20+
~/.cargo/git/db/
21+
target/
22+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
23+
- uses: actions-rs/toolchain@v1
24+
with:
25+
toolchain: stable
26+
- run: cargo build --release --verbose
27+
- name: Upload artifacts
28+
uses: actions/upload-artifact@v2
29+
with:
30+
name: sqlite-regex-ubuntu
31+
path: target/release/libregex0.so
32+
test-macos:
33+
name: Testing macos-latest
34+
runs-on: macos-latest
35+
steps:
36+
- uses: actions/checkout@v2
37+
- uses: actions/cache@v3
38+
with:
39+
path: |
40+
~/.cargo/bin/
41+
~/.cargo/registry/index/
42+
~/.cargo/registry/cache/
43+
~/.cargo/git/db/
44+
target/
45+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
46+
- uses: actions-rs/toolchain@v1
47+
with:
48+
toolchain: stable
49+
- run: cargo build --release --verbose
50+
#- run: make test
51+
- name: Upload artifacts
52+
uses: actions/upload-artifact@v2
53+
with:
54+
name: sqlite-regex-macos
55+
path: target/release/libregex0.dylib
56+
test-windows:
57+
name: Testing windows-latest
58+
runs-on: windows-latest
59+
steps:
60+
- uses: actions/checkout@v2
61+
- uses: actions/cache@v3
62+
with:
63+
path: |
64+
~/.cargo/bin/
65+
~/.cargo/registry/index/
66+
~/.cargo/registry/cache/
67+
~/.cargo/git/db/
68+
target/
69+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
70+
- uses: actions-rs/toolchain@v1
71+
with:
72+
toolchain: stable
73+
- run: cargo build --release --verbose
74+
#- run: make test
75+
- name: Upload artifacts
76+
uses: actions/upload-artifact@v2
77+
with:
78+
name: sqlite-regex-windows
79+
path: target/release/regex0.dll
80+
upload:
81+
name: upload to unstable
82+
needs: [test-macos, test-ubuntu, test-windows]
83+
permissions:
84+
contents: write
85+
runs-on: ubuntu-latest
86+
steps:
87+
- uses: actions/checkout@v2
88+
- name: Download workflow artifacts
89+
uses: actions/download-artifact@v2
90+
- uses: actions/github-script@v6
91+
with:
92+
github-token: ${{ secrets.GITHUB_TOKEN }}
93+
script: |
94+
const script = require('.github/workflows/upload.js')
95+
await script({github, context})

.github/workflows/upload.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const fs = require("fs").promises;
2+
3+
module.exports = async ({ github, context }) => {
4+
const {
5+
repo: { owner, repo },
6+
sha,
7+
} = context;
8+
console.log(process.env.GITHUB_REF);
9+
const release = await github.rest.repos.getReleaseByTag({
10+
owner,
11+
repo,
12+
tag: "unstable",
13+
});
14+
15+
const release_id = release.data.id;
16+
async function uploadReleaseAsset(path, name) {
17+
console.log("Uploading", name, "at", path);
18+
19+
return github.rest.repos.uploadReleaseAsset({
20+
owner,
21+
repo,
22+
release_id,
23+
name,
24+
data: await fs.readFile(path),
25+
});
26+
}
27+
await Promise.all([
28+
uploadReleaseAsset("sqlite-regex-ubuntu/libregex0.so", "regex0.so"),
29+
uploadReleaseAsset("sqlite-regex-macos/libregex0.dylib", "regex0.dylib"),
30+
uploadReleaseAsset("sqlite-regex-windows/regex0.dll", "regex0.dll"),
31+
]);
32+
33+
return;
34+
};

Cargo.lock

Lines changed: 20 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@ name = "sqlite-regex"
33
version = "0.1.0"
44
edition = "2021"
55

6-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7-
86
[dependencies]
9-
sqlite3-loadable = {path="../rust-sqlite-exts/sqlite3-loadable"}
10-
sqlite3ext-sys = {path="../rust-sqlite-exts/sqlite3ext-sys"}
7+
sqlite-loadable = "0.0.1"
118
regex = "1"
129

1310
[lib]

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
test:
2-
sqlite3x :memory: '.read test.sql'
2+
python3 tests/test-loadable.py

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
.load ../sqlite-lines/dist/lines0
2+
create table words as select line as word from lines_read('/usr/share/dict/words');
3+
14
gcc regexp.c -fPIC -shared -o regexp.dylib -I /Users/alex/projects/sqlite-lines/sqlite
25

36
## TODO

benchmarks/bench.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#!/bin/bash
2-
hyperfine --warmup 5 \
3-
'duckdb benchmarks/test.duckdb ".read benchmarks/duckdb.sql"' \
4-
'sqlite3x benchmarks/test.sqlite ".read benchmarks/this.sql"' \
5-
'sqlite3x benchmarks/test.sqlite ".read benchmarks/sqlean.sql"' \
6-
'sqlite3x benchmarks/test.sqlite ".read benchmarks/regexp.sql"'
2+
#'sqlite3x benchmarks/test.sqlite ".read benchmarks/this.sql"' \
3+
4+
hyperfine --warmup 10 \
5+
'sqlite3x benchmarks/test.sqlite ".read benchmarks/this-pointer.sql"' \
6+
'sqlite3x benchmarks/test.sqlite ".read benchmarks/regexp.sql"' \
7+
'sqlite3x benchmarks/test.sqlite ".read benchmarks/sqlean.sql"'
8+
#'duckdb.0.5.1 benchmarks/test.duckdb ".read benchmarks/duckdb.sql"' \
9+
#'sqlite3x benchmarks/test.sqlite ".read benchmarks/thisx.sql"'
10+

benchmarks/this-pointer.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.load ./target/release/libregex0
2+
3+
select sum(
4+
regexp(regex('^\d{4}-\d{2}-\d{2}$'), date)
5+
)
6+
from dates;

benchmarks/thisx.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.load ./target/release/libregex0
2+
3+
select sum(
4+
regexpx('^\d{4}-\d{2}-\d{2}$', date)
5+
)
6+
from dates;

build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::process::Command;
22
fn main() {
33
let output = Command::new("git")
4-
.args(&["rev-parse", "HEAD"])
4+
.args(["rev-parse", "HEAD"])
55
.output()
66
.unwrap();
77
let git_hash = String::from_utf8(output.stdout).unwrap();

0 commit comments

Comments
 (0)