graphql-engine/v3/justfile
Manas Agarwal e27e5b7ffe v3: open-source hasura v3 engine
Hasura V3 Engine v3.alpha.12-19-2023
V3-GitOrigin-RevId: 6605575a52b347b5e9a14ecd1cc736f113c663b3

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/10567
Co-authored-by: Vishnu Bharathi <4211715+scriptnull@users.noreply.github.com>
GitOrigin-RevId: 38c98a4b1971efe3ac724c2371c43ceb7d31f140
2023-12-19 09:05:39 +00:00

85 lines
3.1 KiB
Makefile

set positional-arguments
default:
just --list
# run commands in a rust docker environment with source code only without starting any dependencies.
docker_with_source_only +args:
#!/usr/bin/env sh
DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker compose -f ci.docker-compose.yaml run --build --rm source_only "$@"
exit_code=$?
docker compose -f ci.docker-compose.yaml down
exit $exit_code
# run commands in a rust docker environment including test dependencies and then removes the container dependencies
# while emiting the exit code of the docker command
docker_with_test_env +args:
#!/usr/bin/env sh
DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker compose -f ci.docker-compose.yaml run --build --rm test_setup "$@"
exit_code=$?
docker compose -f ci.docker-compose.yaml down
exit $exit_code
# build used by CI
ci-build:
# see https://github.com/rust-lang/cargo/issues/4463 for why we build each
# package explictly instead of cargo build --workspace --all-targets
just docker_with_source_only cargo build -p lang-graphql \
-p engine \
-p open-dds \
-p tracing-util \
-p hasura-authn-core \
-p hasura-authn-webhook \
--release --all-targets
# linting run by CI
ci-lint:
just docker_with_source_only sh -c \
"cargo clippy --no-deps -- -A clippy::result_large_err -D clippy::complexity -A clippy::too_many_arguments -D clippy::style && cargo fmt --check"
fix:
just docker_with_source_only sh -c "cargo clippy --no-deps --fix --allow-no-vcs -- -A clippy::result_large_err -A clippy::too_many_arguments; cargo fmt"
fix-local:
cargo clippy --no-deps --fix --allow-no-vcs -- -A clippy::result_large_err -A clippy::too_many_arguments; cargo fmt
# tests run by CI
ci-test:
just docker_with_test_env cargo nextest run
test *TESTNAME:
if [ -z {{TESTNAME}} ]; then \
just docker_with_test_env cargo nextest run -E 'all()'; \
else \
just docker_with_test_env cargo nextest run -E 'test(={{TESTNAME}})'; \
fi
# tests using cargo test and not nextest.
# The nextest binary pulled in the docker image only works on linux hosts.
cargo-test *args:
just docker_with_test_env cargo test {{args}}
update-golden-files:
DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker compose -f ci.docker-compose.yaml run --build --rm -e REGENERATE_GOLDENFILES=1 test_setup cargo test
# Benchmarks run by CI
ci-bench:
# Only bench what is required
just docker_with_test_env cargo bench \
-p lang-graphql --bench validation --bench parser \
-p engine --bench generate_ir --bench execute
drill:
just docker_with_test_env drill --benchmark drill.yml -s -q
# optional argument to show coverage only for files matched by {{filterexp}} i.e. grep -E filterexp
coverage *filterexp:
just docker_with_source_only bash coverage.sh '{{filterexp}}'
generate-benchmarks gh-issue gh-token:
just docker_with_test_env bash benchmark.sh {{gh-issue}} {{gh-token}}
dev:
docker compose run --build --rm dev_setup bash
docker compose down