Skip to content

Commit 0c09dd8

Browse files
authored
Add wasmtime to CI. (#212)
1 parent 31c5000 commit 0c09dd8

File tree

18 files changed

+55
-63
lines changed

18 files changed

+55
-63
lines changed

.github/workflows/cross.sh

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

.github/workflows/cross.yml

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

.github/workflows/repro.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ embed/build.sh
2727
embed/bcw2/build.sh
2828

2929
# Download and build sqlite-createtable-parser
30-
util/sql3util/parse/download.sh
31-
util/sql3util/parse/build.sh
30+
util/sql3util/wasm/download.sh
31+
util/sql3util/wasm/build.sh
3232

3333
# Check diffs
3434
git diff --exit-code

.github/workflows/repro.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ jobs:
2929
subject-path: |
3030
embed/sqlite3.wasm
3131
embed/bcw2/bcw2.wasm
32-
util/sql3util/parse/sql3parse_table.wasm
32+
util/sql3util/wasm/sql3parse_table.wasm

.github/workflows/test.yml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,17 @@ name: Test
22

33
on:
44
push:
5-
branches: [ "main" ]
5+
branches: [ 'main' ]
66
paths:
77
- '**.go'
88
- '**.mod'
99
- '**.wasm'
10-
- '**.wasm.bz2'
1110
pull_request:
12-
branches: [ "main" ]
11+
branches: [ 'main' ]
1312
paths:
1413
- '**.go'
1514
- '**.mod'
1615
- '**.wasm'
17-
- '**.wasm.bz2'
1816
workflow_dispatch:
1917

2018
jobs:
@@ -161,6 +159,27 @@ jobs:
161159
copyback: false
162160
run: . ./test.sh
163161

162+
test-wasip1:
163+
runs-on: ubuntu-latest
164+
needs: test
165+
166+
steps:
167+
- uses: bytecodealliance/actions/wasmtime/setup@v1
168+
- uses: actions/checkout@v4
169+
- uses: actions/setup-go@v5
170+
with: { go-version: stable }
171+
172+
- name: Set path
173+
run: echo "$(go env GOROOT)/misc/wasm" >> "$GITHUB_PATH"
174+
175+
- name: Test wasmtime
176+
env:
177+
GOOS: wasip1
178+
GOARCH: wasm
179+
GOWASIRUNTIME: wasmtime
180+
GOWASIRUNTIMEARGS: '--env CI=true'
181+
run: go test -v -short -tags sqlite3_dotlk -skip Example ./...
182+
164183
test-qemu:
165184
runs-on: ubuntu-latest
166185
needs: test
@@ -196,4 +215,4 @@ jobs:
196215
with: { go-version: stable }
197216

198217
- name: Test
199-
run: go test -v ./...
218+
run: go test -v ./...

conn.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"math"
77
"math/rand"
88
"net/url"
9+
"runtime"
910
"strings"
1011
"time"
1112

@@ -375,8 +376,13 @@ func (c *Conn) checkInterrupt(handle uint32) {
375376
}
376377

377378
func progressCallback(ctx context.Context, mod api.Module, _ uint32) (interrupt uint32) {
378-
if c, ok := ctx.Value(connKey{}).(*Conn); ok && c.interrupt.Err() != nil {
379-
interrupt = 1
379+
if c, ok := ctx.Value(connKey{}).(*Conn); ok {
380+
if c.interrupt.Done() != nil {
381+
runtime.Gosched()
382+
}
383+
if c.interrupt.Err() != nil {
384+
interrupt = 1
385+
}
380386
}
381387
return interrupt
382388
}

go.work.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8=
1212
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M=
1313
golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E=
1414
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
15+
golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek=
1516
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
1617
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=

tests/conn_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ func TestConn_SetInterrupt(t *testing.T) {
130130
t.Fatal(err)
131131
}
132132

133-
db.SetInterrupt(context.Background())
134-
135133
stmt, _, err := db.Prepare(`
136134
WITH RECURSIVE
137135
fibonacci (curr, next)
@@ -148,7 +146,6 @@ func TestConn_SetInterrupt(t *testing.T) {
148146
}
149147
defer stmt.Close()
150148

151-
db.SetInterrupt(ctx)
152149
go func() {
153150
time.Sleep(time.Millisecond)
154151
cancel()

util/sql3util/parse.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const (
1717
)
1818

1919
var (
20-
//go:embed parse/sql3parse_table.wasm
20+
//go:embed wasm/sql3parse_table.wasm
2121
binary []byte
2222
once sync.Once
2323
runtime wazero.Runtime

0 commit comments

Comments
 (0)