-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
80 lines (64 loc) · 2.25 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
IMAGE = rust:1.70.0-bullseye
DOCKER = docker run --rm -e CARGO_HOME=/app/.cargo -v $(PWD):/app -w /app
.PHONY: shell
shell:
@$(DOCKER) -it $(IMAGE) bash
.PHONY: can-release
can-release: lint test
.PHONY: lint
lint:
@$(DOCKER) $(IMAGE) bash -c "\
rustup component add rustfmt clippy && \
cargo fmt -- --check && \
cargo clippy -- -D warnings"
.PHONY: test
test: test/lang test/cli test/wasm
.PHONY: test/lang
test/lang:
@$(DOCKER) $(IMAGE) cargo test --package santa-lang --verbose
.PHONY: test/cli
test/cli:
@$(DOCKER) $(IMAGE) cargo build --bin santa-cli --verbose
@$(DOCKER) $(IMAGE) cargo test --bin santa-cli --verbose
.PHONY: test/wasm
test/wasm:
@echo "Note: test/wasm runs on the host"
@wasm-pack test --node runtime/wasm
.PHONY: fmt
fmt:
@$(DOCKER) -it $(IMAGE) bash -c "rustup component add rustfmt && cargo fmt"
.PHONY: lambda/build
lambda/build:
@$(DOCKER) -e BIN=santa-lambda rustserverless/lambda-rust:0.4.0-rust-stable
.PHONY: lambda/serve
lambda/serve:
@docker run --rm -it \
-e DOCKER_LAMBDA_STAY_OPEN=1 \
-e _HANDLER=fibonacci.handler \
-p 9001:9001 \
-v $(PWD)/target/lambda/release/santa-lambda:/opt/bootstrap \
-v $(PWD)/runtime/lambda/fixtures:/var/task \
lambci/lambda:provided.al2
.PHONY: lambda/invoke
lambda/invoke:
@curl -d '{"number": 100}' http://localhost:9001/2015-03-31/functions/myfunction/invocations
.PHONY: php-ext/build
php-ext/build:
@docker build -t local/santa-php-ext-build - < runtime/php-ext/build.Dockerfile
@$(DOCKER) local/santa-php-ext-build bash -c "cargo build --package santa-php-ext --release"
.PHONY: php-ext/test
php-ext/test:
@docker build -t local/santa-php-ext-build - < runtime/php-ext/build.Dockerfile
@$(DOCKER) local/santa-php-ext-build bash -c "php -dextension=./target/release/libsanta_lang.so runtime/php-ext/fixtures/test.php"
.PHONY: jupyter/build
jupyter/build:
docker build \
-f runtime/jupyter/build.Dockerfile \
--label "org.opencontainers.image.source=https://github.com/eddmann/santa-lang-rs" \
-t ghcr.io/eddmann/santa-lang-jupyter:latest .
.PHONY: jupyter/run
jupyter/run:
docker run --rm -it -p 8888:8888 ghcr.io/eddmann/santa-lang-jupyter:latest
cli/build/%:
@$(DOCKER) joseluisq/rust-linux-darwin-builder:1.70.0 \
sh -c "cargo build --release --bin santa-cli --target $*"