-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathjustfile
111 lines (88 loc) · 3.19 KB
/
justfile
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
set dotenv-load := true
dat_version := "0.0.3"
dat_dir := "dat"
local_config := "config/local.yaml"
# Show available commands
default:
@just --list --justfile {{ justfile() }}
# Run clippy with fixes
fix:
@cargo clippy --fix --allow-dirty --allow-staged
# the the documentation (requires mdbook)
docs:
uv run mkdocs serve
# Run unit tests
test:
@cargo test --workspace -- --nocapture
# Run integration tests
test-integration: start_pg
DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres \
cargo test -p delta-sharing-postgres --features integration-pg -- --nocapture
@just stop_pg
# Build a docker image for local use
docker-build:
DOCKER_BUILDKIT=0 docker build . -t delta-sharing:dev -f docker/Dockerfile
# Run a docker image for local use
docker-run:
docker run -it --rm \
-p 8080:8080 \
-v "$(pwd)/config/empty.yaml:/config.yaml" \
-e RUST_LOG=debug \
delta-sharing:dev rest
# Run local docker emvironment
docker:
docker-compose -f docker/compose.yaml up -d
# generate delta-sharing types from proto files
generate:
buf generate proto
npx -y @redocly/cli bundle --remove-unused-components delta-sharing/server/openapi.yaml > tmp.yaml
mv tmp.yaml delta-sharing/server/openapi.yaml
cargo clippy --fix --allow-dirty --allow-staged
generate-openfga:
just delta-sharing/openfga/generate
generate-app:
just app/generate
# load delta acceptance testing (dat) data from the release
load-dat:
rm -rf {{ dat_dir }}
curl -OL https://github.com/delta-incubator/dat/releases/download/v{{ dat_version }}/deltalake-dat-v{{ dat_version }}.tar.gz
mkdir -p {{ dat_dir }}
tar --no-same-permissions -xzf deltalake-dat-v{{ dat_version }}.tar.gz --directory {{ dat_dir }}
rm deltalake-dat-v{{ dat_version }}.tar.gz
render-config:
DIRECTORY={{ justfile_directory() }} DAT={{ dat_dir }} envsubst < config/local.yaml.tpl > {{ local_config }}
# local setup
local-setup: load-dat render-config
rest:
@RUST_LOG=INFO cargo run --bin delta-sharing rest --config {{ local_config }}
rest-db:
DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres RUST_LOG=INFO \
cargo run --bin delta-sharing rest --config {{ local_config }} --use-db
grpc:
@RUST_LOG=INFO cargo run --bin delta-sharing grpc --config {{ local_config }}
load-store:
fga store import --file {{ justfile_directory() }}/delta-sharing/openfga/fga/dev.fga.yaml
# Show unused dependencies
udeps:
cargo +nightly udeps
sqlx-prepare: start_pg
# Wait for PostgreSQL to be ready
sleep 1
# Run migrations to create tables
DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres cargo sqlx migrate run --source ./delta-sharing/postgres/migrations
# Prepare SQLx
cargo sqlx prepare --workspace -- --tests
# Clean up
@just stop_pg
# Start PostgreSQL container to prepare SQLx or to run tests
start_pg:
docker run -d \
--name postgres-sharing \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_USER=postgres \
-e POSTGRES_DB=postgres \
-p 5432:5432 \
postgres:14
# Stop PostgreSQL container
stop_pg:
docker stop postgres-sharing && docker rm postgres-sharing