Skip to content

Commit 908f85d

Browse files
committed
feat: add wasm rigging
Signed-off-by: Xe Iaso <[email protected]>
1 parent ec90a8b commit 908f85d

File tree

22 files changed

+1339
-5
lines changed

22 files changed

+1339
-5
lines changed

.devcontainer/devcontainer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
"postStartCommand": "bash ./.devcontainer/poststart.sh",
1111
"features": {
1212
"ghcr.io/xe/devcontainer-features/ko:1.1.0": {},
13-
"ghcr.io/devcontainers/features/github-cli:1": {}
13+
"ghcr.io/devcontainers/features/github-cli:1": {},
14+
"ghcr.io/devcontainers/features/rust:1": {
15+
"version": "latest",
16+
"targets": "wasm32-unknown-unknown"
17+
}
1418
},
1519
"initializeCommand": "mkdir -p ${localEnv:HOME}${localEnv:USERPROFILE}/.local/share/atuin",
1620
"customizations": {

.devcontainer/docker-compose.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ services:
2020
dockerfile: .devcontainer/Dockerfile
2121
volumes:
2222
- ../:/workspace/anubis:cached
23+
- cargo-target:/workspace/anubis/target:cached
2324
environment:
2425
VALKEY_URL: redis://valkey:6379/0
2526
#entrypoint: ["/usr/bin/sleep", "infinity"]
2627
user: vscode
28+
29+
volumes:
30+
cargo-target:

.devcontainer/poststart.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ pwd
55
npm ci &
66
go mod download &
77
go install ./utils/cmd/... &
8+
cargo fetch &
89

910
wait

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,8 @@ node_modules
2121
# how does this get here
2222
doc/VERSION
2323

24-
web/static/locales/*.json
24+
web/static/locales/*.json
25+
26+
# Rust
27+
target/*
28+
*.wasm

Cargo.lock

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

Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[workspace]
2+
resolver = "2"
3+
members = ["wasm/anubis", "wasm/pow/*"]
4+
5+
[profile.release]
6+
#strip = true
7+
opt-level = "s"
8+
lto = "thin"
9+
codegen-units = 1
10+
panic = "abort"

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
VERSION= $(shell cat ./VERSION)
22
GO?= go
33
NPM?= npm
4+
CARGO?= cargo
45

5-
.PHONY: build assets deps lint prebaked-build test
6+
.PHONY: build assets assets-wasm deps lint prebaked-build test
67

78
all: build
89

910
deps:
1011
$(NPM) ci
1112
$(GO) mod download
13+
$(CARGO) fetch
14+
15+
assets-wasm:
16+
bash ./scripts/build_wasm.sh
1217

1318
assets: PATH:=$(PWD)/node_modules/.bin:$(PATH)
14-
assets: deps
19+
assets: deps assets-wasm
1520
$(GO) generate ./...
1621
./web/build.sh
1722
./xess/build.sh

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ require (
2525
github.com/sebest/xff v0.0.0-20210106013422-671bd2870b3a
2626
github.com/shirou/gopsutil/v4 v4.25.6
2727
github.com/testcontainers/testcontainers-go v0.38.0
28+
github.com/tetratelabs/wazero v1.9.0
2829
go.etcd.io/bbolt v1.4.2
2930
golang.org/x/net v0.42.0
3031
golang.org/x/text v0.27.0

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,8 @@ github.com/suzuki-shunsuke/urfave-cli-help-all v0.0.4 h1:YGHgrVjGTYHY98II6zijXUH
395395
github.com/suzuki-shunsuke/urfave-cli-help-all v0.0.4/go.mod h1:sSi6xaUaHfaqu32ECLeyE7NTMv+ZM5dW0JikhllaalY=
396396
github.com/testcontainers/testcontainers-go v0.38.0 h1:d7uEapLcv2P8AvH8ahLqDMMxda2W9gQN1nRbHS28HBw=
397397
github.com/testcontainers/testcontainers-go v0.38.0/go.mod h1:C52c9MoHpWO+C4aqmgSU+hxlR5jlEayWtgYrb8Pzz1w=
398+
github.com/tetratelabs/wazero v1.9.0 h1:IcZ56OuxrtaEz8UYNRHBrUa9bYeX9oVY93KspZZBf/I=
399+
github.com/tetratelabs/wazero v1.9.0/go.mod h1:TSbcXCfFP0L2FGkRPxHphadXPjo1T6W+CseNNY7EkjM=
398400
github.com/tklauser/go-sysconf v0.3.15 h1:VE89k0criAymJ/Os65CSn1IXaol+1wrsFHEB8Ol49K4=
399401
github.com/tklauser/go-sysconf v0.3.15/go.mod h1:Dmjwr6tYFIseJw7a3dRLJfsHAMXZ3nEnL/aZY+0IuI4=
400402
github.com/tklauser/numcpus v0.10.0 h1:18njr6LDBk1zuna922MgdjQuJFjrdppsZG60sHGfjso=

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"test:integration": "npm run assets && go test -v ./internal/test",
99
"test:integration:podman": "npm run assets && go test -v ./internal/test --playwright-runner=podman",
1010
"test:integration:docker": "npm run assets && go test -v ./internal/test --playwright-runner=docker",
11-
"assets": "go generate ./... && ./web/build.sh && ./xess/build.sh",
11+
"assets:wasm": "bash ./scripts/build_wasm.sh",
12+
"assets": "go generate ./... && ./web/build.sh && ./xess/build.sh && npm run assets:wasm",
1213
"build": "npm run assets && go build -o ./var/anubis ./cmd/anubis",
1314
"dev": "npm run assets && go run ./cmd/anubis --use-remote-address --target http://localhost:3000",
1415
"container": "npm run assets && go run ./cmd/containerbuild",

0 commit comments

Comments
 (0)