mirror of
https://github.com/maplibre/martin.git
synced 2024-12-24 23:45:42 +03:00
Format justfile using just --fmt
This commit is contained in:
parent
843c21050d
commit
0209b662bf
45
justfile
45
justfile
@ -1,27 +1,29 @@
|
|||||||
#!/usr/bin/env just --justfile
|
#!/usr/bin/env just --justfile
|
||||||
|
|
||||||
set shell := ["bash", "-c"]
|
set shell := ["bash", "-c"]
|
||||||
|
|
||||||
export PGPORT := "5411"
|
export PGPORT := "5411"
|
||||||
export DATABASE_URL := "postgres://postgres:postgres@localhost:" + PGPORT + "/db"
|
export DATABASE_URL := "postgres://postgres:postgres@localhost:" + PGPORT + "/db"
|
||||||
export CARGO_TERM_COLOR := "always"
|
export CARGO_TERM_COLOR := "always"
|
||||||
|
|
||||||
# export RUST_LOG := "debug"
|
# export RUST_LOG := "debug"
|
||||||
# export RUST_BACKTRACE := "1"
|
# export RUST_BACKTRACE := "1"
|
||||||
|
|
||||||
@_default:
|
@_default:
|
||||||
just --list --unsorted
|
just --list --unsorted
|
||||||
|
|
||||||
# Start Martin server and a test database
|
# Start Martin server and a test database
|
||||||
run *ARGS: start
|
run *ARGS: start
|
||||||
cargo run -- {{ARGS}}
|
cargo run -- {{ ARGS }}
|
||||||
|
|
||||||
# Start Martin server and open a test page
|
# Start Martin server and open a test page
|
||||||
debug-page *ARGS: start
|
debug-page *ARGS: start
|
||||||
open tests/debug.html # run will not exit, so open debug page first
|
open tests/debug.html # run will not exit, so open debug page first
|
||||||
just run {{ARGS}}
|
just run {{ ARGS }}
|
||||||
|
|
||||||
# Run PSQL utility against the test database
|
# Run PSQL utility against the test database
|
||||||
psql *ARGS:
|
psql *ARGS:
|
||||||
psql {{ARGS}} {{DATABASE_URL}}
|
psql {{ ARGS }} {{ DATABASE_URL }}
|
||||||
|
|
||||||
# Perform cargo clean to delete all build files
|
# Perform cargo clean to delete all build files
|
||||||
clean: clean-test stop
|
clean: clean-test stop
|
||||||
@ -44,7 +46,7 @@ start-legacy: (docker-up "db-legacy")
|
|||||||
# Start a specific test database, e.g. db or db-legacy
|
# Start a specific test database, e.g. db or db-legacy
|
||||||
[private]
|
[private]
|
||||||
docker-up name:
|
docker-up name:
|
||||||
docker-compose up -d {{name}}
|
docker-compose up -d {{ name }}
|
||||||
docker-compose run --rm db-is-ready
|
docker-compose run --rm db-is-ready
|
||||||
|
|
||||||
alias _down := stop
|
alias _down := stop
|
||||||
@ -58,7 +60,6 @@ stop:
|
|||||||
bench: start
|
bench: start
|
||||||
cargo bench
|
cargo bench
|
||||||
|
|
||||||
|
|
||||||
# Run all tests using a test database
|
# Run all tests using a test database
|
||||||
test: (docker-up "db") test-unit test-int
|
test: (docker-up "db") test-unit test-int
|
||||||
|
|
||||||
@ -71,8 +72,8 @@ test-legacy: (docker-up "db-legacy") test-unit test-int
|
|||||||
|
|
||||||
# Run Rust unit and doc tests (cargo test)
|
# Run Rust unit and doc tests (cargo test)
|
||||||
test-unit *ARGS:
|
test-unit *ARGS:
|
||||||
cargo test --all-targets {{ARGS}}
|
cargo test --all-targets {{ ARGS }}
|
||||||
cargo test --all-targets --all-features {{ARGS}}
|
cargo test --all-targets --all-features {{ ARGS }}
|
||||||
cargo test --doc
|
cargo test --doc
|
||||||
|
|
||||||
# Run integration tests
|
# Run integration tests
|
||||||
@ -114,7 +115,7 @@ coverage FORMAT='html':
|
|||||||
mkdir -p "$PROF_DIR"
|
mkdir -p "$PROF_DIR"
|
||||||
PROF_DIR=$(realpath "$PROF_DIR")
|
PROF_DIR=$(realpath "$PROF_DIR")
|
||||||
|
|
||||||
OUTPUT_RESULTS_DIR=target/coverage/{{FORMAT}}
|
OUTPUT_RESULTS_DIR=target/coverage/{{ FORMAT }}
|
||||||
mkdir -p "$OUTPUT_RESULTS_DIR"
|
mkdir -p "$OUTPUT_RESULTS_DIR"
|
||||||
|
|
||||||
export CARGO_INCREMENTAL=0
|
export CARGO_INCREMENTAL=0
|
||||||
@ -128,20 +129,20 @@ coverage FORMAT='html':
|
|||||||
tests/test.sh
|
tests/test.sh
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
grcov --binary-path ./target/debug \
|
grcov --binary-path ./target/debug \
|
||||||
-s . \
|
-s . \
|
||||||
-t {{FORMAT}} \
|
-t {{ FORMAT }} \
|
||||||
--branch \
|
--branch \
|
||||||
--ignore 'benches/*' \
|
--ignore 'benches/*' \
|
||||||
--ignore 'tests/*' \
|
--ignore 'tests/*' \
|
||||||
--ignore-not-existing \
|
--ignore-not-existing \
|
||||||
-o target/coverage/{{FORMAT}} \
|
-o target/coverage/{{ FORMAT }} \
|
||||||
--llvm \
|
--llvm \
|
||||||
"$PROF_DIR"
|
"$PROF_DIR"
|
||||||
{ set +x; } 2>/dev/null
|
{ set +x; } 2>/dev/null
|
||||||
|
|
||||||
# if this is html, open it in the browser
|
# if this is html, open it in the browser
|
||||||
if [ "{{FORMAT}}" = "html" ]; then
|
if [ "{{ FORMAT }}" = "html" ]; then
|
||||||
open "$OUTPUT_RESULTS_DIR/index.html"
|
open "$OUTPUT_RESULTS_DIR/index.html"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -151,16 +152,16 @@ docker-build:
|
|||||||
|
|
||||||
# Build and run martin docker image
|
# Build and run martin docker image
|
||||||
docker-run *ARGS:
|
docker-run *ARGS:
|
||||||
docker run -it --rm --net host -e DATABASE_URL -v $PWD/tests:/tests ghcr.io/maplibre/martin {{ARGS}}
|
docker run -it --rm --net host -e DATABASE_URL -v $PWD/tests:/tests ghcr.io/maplibre/martin {{ ARGS }}
|
||||||
|
|
||||||
# Do any git command, ensuring that the testing environment is set up. Accepts the same arguments as git.
|
# Do any git command, ensuring that the testing environment is set up. Accepts the same arguments as git.
|
||||||
[no-exit-message]
|
[no-exit-message]
|
||||||
git *ARGS: start
|
git *ARGS: start
|
||||||
git {{ARGS}}
|
git {{ ARGS }}
|
||||||
|
|
||||||
# Print the connection string for the test database
|
# Print the connection string for the test database
|
||||||
print-conn-str:
|
print-conn-str:
|
||||||
@echo {{DATABASE_URL}}
|
@echo {{ DATABASE_URL }}
|
||||||
|
|
||||||
# Run cargo fmt and cargo clippy
|
# Run cargo fmt and cargo clippy
|
||||||
lint:
|
lint:
|
||||||
|
Loading…
Reference in New Issue
Block a user