2022-10-28 21:52:39 +03:00
|
|
|
#!/usr/bin/env just --justfile
|
2023-05-24 06:47:55 +03:00
|
|
|
|
2022-10-28 21:52:39 +03:00
|
|
|
set shell := ["bash", "-c"]
|
|
|
|
|
2023-10-20 06:40:08 +03:00
|
|
|
#export DATABASE_URL="postgres://postgres:postgres@localhost:5411/db"
|
2023-11-09 03:46:23 +03:00
|
|
|
|
2024-01-15 04:21:30 +03:00
|
|
|
# Set additional database connection parameters, e.g. just PGPARAMS='keepalives=0&keepalives_idle=15' psql
|
|
|
|
PGPARAMS := ""
|
|
|
|
PGPORT := "5411"
|
|
|
|
|
|
|
|
export DATABASE_URL := "postgres://postgres:postgres@localhost:" + PGPORT + "/db" + (if PGPARAMS != "" { "?" + PGPARAMS } else { "" })
|
2022-10-28 21:52:39 +03:00
|
|
|
export CARGO_TERM_COLOR := "always"
|
2023-05-24 06:47:55 +03:00
|
|
|
|
2023-10-10 18:10:17 +03:00
|
|
|
#export RUST_LOG := "debug"
|
|
|
|
#export RUST_LOG := "sqlx::query=info,trace"
|
|
|
|
#export RUST_BACKTRACE := "1"
|
2022-10-28 21:52:39 +03:00
|
|
|
|
2024-01-29 21:15:10 +03:00
|
|
|
dockercompose := `if docker-compose --version &> /dev/null; then echo "docker-compose"; else echo "docker compose"; fi`
|
|
|
|
|
2022-10-28 21:52:39 +03:00
|
|
|
@_default:
|
2023-11-09 03:46:23 +03:00
|
|
|
{{ just_executable() }} --list --unsorted
|
2022-10-28 21:52:39 +03:00
|
|
|
|
2023-08-29 19:55:52 +03:00
|
|
|
# Start Martin server
|
|
|
|
run *ARGS:
|
2023-10-31 07:41:21 +03:00
|
|
|
cargo run -p martin -- {{ ARGS }}
|
|
|
|
|
2023-11-20 09:27:51 +03:00
|
|
|
# Start Martin server
|
|
|
|
cp *ARGS:
|
|
|
|
cargo run --bin martin-cp -- {{ ARGS }}
|
|
|
|
|
2023-10-31 07:41:21 +03:00
|
|
|
# Run mbtiles command
|
|
|
|
mbtiles *ARGS:
|
|
|
|
cargo run -p mbtiles -- {{ ARGS }}
|
2022-10-28 21:52:39 +03:00
|
|
|
|
2023-06-04 22:02:00 +03:00
|
|
|
# Start release-compiled Martin server and a test database
|
|
|
|
run-release *ARGS: start
|
|
|
|
cargo run -- {{ ARGS }}
|
|
|
|
|
2022-12-10 10:40:01 +03:00
|
|
|
# Start Martin server and open a test page
|
2022-12-27 09:56:27 +03:00
|
|
|
debug-page *ARGS: start
|
2022-12-10 10:40:01 +03:00
|
|
|
open tests/debug.html # run will not exit, so open debug page first
|
2023-11-09 03:46:23 +03:00
|
|
|
{{ just_executable() }} run {{ ARGS }}
|
2022-12-10 10:40:01 +03:00
|
|
|
|
2022-11-30 19:57:27 +03:00
|
|
|
# Run PSQL utility against the test database
|
2023-01-01 08:03:21 +03:00
|
|
|
psql *ARGS:
|
2024-01-15 04:21:30 +03:00
|
|
|
psql {{ ARGS }} {{ quote(DATABASE_URL) }}
|
2022-11-30 19:57:27 +03:00
|
|
|
|
2023-09-06 18:12:53 +03:00
|
|
|
# Run pg_dump utility against the test database
|
2023-08-13 05:06:23 +03:00
|
|
|
pg_dump *ARGS:
|
2024-01-15 04:21:30 +03:00
|
|
|
pg_dump {{ ARGS }} {{ quote(DATABASE_URL) }}
|
2023-08-13 05:06:23 +03:00
|
|
|
|
2022-10-28 21:52:39 +03:00
|
|
|
# Perform cargo clean to delete all build files
|
2022-11-30 19:57:27 +03:00
|
|
|
clean: clean-test stop
|
2022-10-28 21:52:39 +03:00
|
|
|
cargo clean
|
|
|
|
|
|
|
|
# Delete test output files
|
2023-01-01 08:03:21 +03:00
|
|
|
[private]
|
2022-10-28 21:52:39 +03:00
|
|
|
clean-test:
|
|
|
|
rm -rf tests/output
|
|
|
|
|
|
|
|
# Start a test database
|
2023-10-01 05:49:56 +03:00
|
|
|
start: (docker-up "db") docker-is-ready
|
2022-12-04 08:34:44 +03:00
|
|
|
|
2023-02-06 22:32:28 +03:00
|
|
|
# Start an ssl-enabled test database
|
2023-10-01 05:49:56 +03:00
|
|
|
start-ssl: (docker-up "db-ssl") docker-is-ready
|
|
|
|
|
|
|
|
# Start an ssl-enabled test database that requires a client certificate
|
|
|
|
start-ssl-cert: (docker-up "db-ssl-cert") docker-is-ready
|
2023-02-06 22:32:28 +03:00
|
|
|
|
2022-12-04 08:34:44 +03:00
|
|
|
# Start a legacy test database
|
2023-10-01 05:49:56 +03:00
|
|
|
start-legacy: (docker-up "db-legacy") docker-is-ready
|
2022-12-04 08:34:44 +03:00
|
|
|
|
|
|
|
# Start a specific test database, e.g. db or db-legacy
|
2023-01-01 08:03:21 +03:00
|
|
|
[private]
|
2023-12-22 09:01:50 +03:00
|
|
|
docker-up name: start-pmtiles-server
|
2024-01-29 21:15:10 +03:00
|
|
|
{{ dockercompose }} up -d {{ name }}
|
2023-10-01 05:49:56 +03:00
|
|
|
|
|
|
|
# Wait for the test database to be ready
|
|
|
|
[private]
|
|
|
|
docker-is-ready:
|
2024-01-29 21:15:10 +03:00
|
|
|
{{ dockercompose }} run -T --rm db-is-ready
|
2022-10-28 21:52:39 +03:00
|
|
|
|
|
|
|
alias _down := stop
|
|
|
|
alias _stop-db := stop
|
|
|
|
|
2023-08-04 00:51:10 +03:00
|
|
|
# Restart the test database
|
|
|
|
restart:
|
2023-11-09 03:46:23 +03:00
|
|
|
# sometimes Just optimizes targets, so here we force stop & start by using external just executable
|
|
|
|
{{ just_executable() }} stop
|
|
|
|
{{ just_executable() }} start
|
2023-08-04 00:51:10 +03:00
|
|
|
|
2022-10-28 21:52:39 +03:00
|
|
|
# Stop the test database
|
|
|
|
stop:
|
2024-01-29 21:15:10 +03:00
|
|
|
{{ dockercompose }} down --remove-orphans
|
2022-10-28 21:52:39 +03:00
|
|
|
|
2023-12-22 09:01:50 +03:00
|
|
|
# Start test server for testing HTTP pmtiles
|
|
|
|
start-pmtiles-server:
|
2024-01-29 21:15:10 +03:00
|
|
|
{{ dockercompose }} up -d fileserver
|
2023-12-22 09:01:50 +03:00
|
|
|
|
2022-10-28 21:52:39 +03:00
|
|
|
# Run benchmark tests
|
2023-12-27 21:50:07 +03:00
|
|
|
bench:
|
|
|
|
cargo bench --bench bench
|
|
|
|
open target/criterion/report/index.html
|
|
|
|
|
|
|
|
# Run benchmark tests showing a flamegraph
|
|
|
|
flamegraph:
|
|
|
|
cargo bench --bench bench -- --profile-time=10
|
|
|
|
/opt/google/chrome/chrome "file://$PWD/target/criterion/get_table_source_tile/profile/flamegraph.svg"
|
2022-10-28 21:52:39 +03:00
|
|
|
|
2023-12-26 07:55:20 +03:00
|
|
|
# Start release-compiled Martin server and a test database
|
|
|
|
bench-server: start
|
|
|
|
cargo run --release -- tests/fixtures/mbtiles tests/fixtures/pmtiles
|
|
|
|
|
|
|
|
# Run HTTP requests benchmark using OHA tool. Use with `just bench-server`
|
2023-07-07 23:44:30 +03:00
|
|
|
bench-http: (cargo-install "oha")
|
2023-12-26 10:43:47 +03:00
|
|
|
@echo "ATTENTION: Make sure Martin was started with just bench-server"
|
2023-06-04 22:02:00 +03:00
|
|
|
@echo "Warming up..."
|
|
|
|
oha -z 5s --no-tui http://localhost:3000/function_zxy_query/18/235085/122323 > /dev/null
|
2023-12-26 07:55:20 +03:00
|
|
|
oha -z 60s http://localhost:3000/function_zxy_query/18/235085/122323
|
|
|
|
oha -z 5s --no-tui http://localhost:3000/png/0/0/0 > /dev/null
|
|
|
|
oha -z 60s http://localhost:3000/png/0/0/0
|
|
|
|
oha -z 5s --no-tui http://localhost:3000/stamen_toner__raster_CC-BY-ODbL_z3/0/0/0 > /dev/null
|
|
|
|
oha -z 60s http://localhost:3000/stamen_toner__raster_CC-BY-ODbL_z3/0/0/0
|
2023-06-04 22:02:00 +03:00
|
|
|
|
2022-10-28 21:52:39 +03:00
|
|
|
# Run all tests using a test database
|
2023-10-10 18:10:17 +03:00
|
|
|
test: start (test-cargo "--all-targets") test-doc test-int
|
2023-01-01 08:03:21 +03:00
|
|
|
|
2023-02-06 22:32:28 +03:00
|
|
|
# Run all tests using an SSL connection to a test database. Expected output won't match.
|
2023-10-10 18:10:17 +03:00
|
|
|
test-ssl: start-ssl (test-cargo "--all-targets") test-doc clean-test
|
2023-02-06 22:32:28 +03:00
|
|
|
tests/test.sh
|
|
|
|
|
2023-10-01 05:49:56 +03:00
|
|
|
# Run all tests using an SSL connection with client cert to a test database. Expected output won't match.
|
|
|
|
test-ssl-cert: start-ssl-cert
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euxo pipefail
|
|
|
|
# copy client cert to the tests folder from the docker container
|
|
|
|
KEY_DIR=target/certs
|
|
|
|
mkdir -p $KEY_DIR
|
|
|
|
docker cp martin-db-ssl-cert-1:/etc/ssl/certs/ssl-cert-snakeoil.pem $KEY_DIR/ssl-cert-snakeoil.pem
|
|
|
|
docker cp martin-db-ssl-cert-1:/etc/ssl/private/ssl-cert-snakeoil.key $KEY_DIR/ssl-cert-snakeoil.key
|
|
|
|
# export DATABASE_URL="$DATABASE_URL?sslmode=verify-full&sslrootcert=$KEY_DIR/ssl-cert-snakeoil.pem&sslcert=$KEY_DIR/ssl-cert-snakeoil.pem&sslkey=$KEY_DIR/ssl-cert-snakeoil.key"
|
|
|
|
export PGSSLROOTCERT="$KEY_DIR/ssl-cert-snakeoil.pem"
|
|
|
|
export PGSSLCERT="$KEY_DIR/ssl-cert-snakeoil.pem"
|
|
|
|
export PGSSLKEY="$KEY_DIR/ssl-cert-snakeoil.key"
|
2023-11-09 03:46:23 +03:00
|
|
|
{{ just_executable() }} test-cargo --all-targets
|
|
|
|
{{ just_executable() }} clean-test
|
|
|
|
{{ just_executable() }} test-doc
|
2023-10-01 05:49:56 +03:00
|
|
|
tests/test.sh
|
|
|
|
|
2023-02-06 22:32:28 +03:00
|
|
|
# Run all tests using the oldest supported version of the database
|
2023-10-10 18:10:17 +03:00
|
|
|
test-legacy: start-legacy (test-cargo "--all-targets") test-doc test-int
|
2022-10-28 21:52:39 +03:00
|
|
|
|
2023-10-10 18:10:17 +03:00
|
|
|
# Run Rust unit tests (cargo test)
|
|
|
|
test-cargo *ARGS:
|
|
|
|
cargo test {{ ARGS }}
|
|
|
|
|
|
|
|
# Run Rust doc tests
|
|
|
|
test-doc *ARGS:
|
|
|
|
cargo test --doc {{ ARGS }}
|
2022-10-28 21:52:39 +03:00
|
|
|
|
|
|
|
# Run integration tests
|
2023-07-04 15:05:23 +03:00
|
|
|
test-int: clean-test install-sqlx
|
2023-02-07 09:05:47 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
2022-10-28 21:52:39 +03:00
|
|
|
tests/test.sh
|
2023-11-09 03:46:23 +03:00
|
|
|
if [ "{{ os() }}" != "linux" ]; then
|
|
|
|
echo "** Integration tests are only supported on Linux"
|
|
|
|
echo "** Skipping diffing with the expected output"
|
2023-01-01 08:03:21 +03:00
|
|
|
else
|
2023-11-09 03:46:23 +03:00
|
|
|
echo "** Comparing actual output with expected output..."
|
|
|
|
if ! diff --brief --recursive --new-file tests/output tests/expected; then
|
|
|
|
echo "** Expected output does not match actual output"
|
|
|
|
echo "** If this is expected, run 'just bless' to update expected output"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "** Expected output matches actual output"
|
|
|
|
fi
|
2023-01-01 08:03:21 +03:00
|
|
|
fi
|
|
|
|
|
2024-02-01 21:56:40 +03:00
|
|
|
# Run AWS Lambda smoke test against SAM local
|
|
|
|
test-lambda:
|
|
|
|
tests/test-aws-lambda.sh
|
|
|
|
|
2024-02-25 13:46:59 +03:00
|
|
|
# Run integration tests and save its output as the new expected output (ordering is important, but in some cases run `bless-tests` before others)
|
2023-12-19 05:20:36 +03:00
|
|
|
bless: restart clean-test bless-insta-martin bless-insta-mbtiles bless-tests bless-int
|
|
|
|
|
|
|
|
# Bless integration tests
|
|
|
|
bless-int:
|
2023-09-29 21:37:18 +03:00
|
|
|
rm -rf tests/temp
|
2023-01-01 08:03:21 +03:00
|
|
|
tests/test.sh
|
2024-06-25 22:34:14 +03:00
|
|
|
rm -rf tests/expected && mv tests/output tests/expected
|
2022-12-27 09:56:27 +03:00
|
|
|
|
2023-11-30 03:09:05 +03:00
|
|
|
# Run test with bless-tests feature
|
|
|
|
bless-tests:
|
|
|
|
cargo test -p martin --features bless-tests
|
|
|
|
|
2023-10-10 18:10:17 +03:00
|
|
|
# Run integration tests and save its output as the new expected output
|
2023-10-22 01:41:21 +03:00
|
|
|
bless-insta-mbtiles *ARGS: (cargo-install "cargo-insta")
|
2023-10-28 11:50:49 +03:00
|
|
|
#rm -rf mbtiles/tests/snapshots
|
|
|
|
cargo insta test --accept --unreferenced=auto -p mbtiles {{ ARGS }}
|
2023-10-10 18:10:17 +03:00
|
|
|
|
2023-10-20 06:40:08 +03:00
|
|
|
# Run integration tests and save its output as the new expected output
|
2023-10-22 01:41:21 +03:00
|
|
|
bless-insta-martin *ARGS: (cargo-install "cargo-insta")
|
2023-10-20 06:40:08 +03:00
|
|
|
cargo insta test --accept --unreferenced=auto -p martin {{ ARGS }}
|
|
|
|
|
2023-11-20 09:27:51 +03:00
|
|
|
# Run integration tests and save its output as the new expected output
|
|
|
|
bless-insta-cp *ARGS: (cargo-install "cargo-insta")
|
|
|
|
cargo insta test --accept --bin martin-cp {{ ARGS }}
|
|
|
|
|
2023-05-29 05:06:35 +03:00
|
|
|
# Build and open mdbook documentation
|
2023-07-07 23:44:30 +03:00
|
|
|
book: (cargo-install "mdbook")
|
2023-06-04 21:11:44 +03:00
|
|
|
mdbook serve docs --open --port 8321
|
2023-05-29 05:06:35 +03:00
|
|
|
|
2023-07-10 21:38:48 +03:00
|
|
|
# Build debian package
|
|
|
|
package-deb: (cargo-install "cargo-deb")
|
|
|
|
cargo deb -v -p martin --output target/debian/martin.deb
|
|
|
|
|
2023-05-29 05:06:35 +03:00
|
|
|
# Build and open code documentation
|
|
|
|
docs:
|
|
|
|
cargo doc --no-deps --open
|
|
|
|
|
2022-12-27 09:56:27 +03:00
|
|
|
# Run code coverage on tests and save its output in the coverage directory. Parameter could be html or lcov.
|
2023-07-07 23:44:30 +03:00
|
|
|
coverage FORMAT='html': (cargo-install "grcov")
|
2022-12-27 09:56:27 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
2023-06-13 06:05:54 +03:00
|
|
|
if ! rustup component list | grep llvm-tools-preview &> /dev/null; then \
|
2022-12-27 09:56:27 +03:00
|
|
|
echo "llvm-tools-preview could not be found. Installing..." ;\
|
|
|
|
rustup component add llvm-tools-preview ;\
|
|
|
|
fi
|
|
|
|
|
2023-11-09 03:46:23 +03:00
|
|
|
{{ just_executable() }} clean
|
|
|
|
{{ just_executable() }} start
|
2022-12-27 09:56:27 +03:00
|
|
|
|
|
|
|
PROF_DIR=target/prof
|
|
|
|
mkdir -p "$PROF_DIR"
|
|
|
|
PROF_DIR=$(realpath "$PROF_DIR")
|
|
|
|
|
2023-05-24 06:47:55 +03:00
|
|
|
OUTPUT_RESULTS_DIR=target/coverage/{{ FORMAT }}
|
2022-12-27 09:56:27 +03:00
|
|
|
mkdir -p "$OUTPUT_RESULTS_DIR"
|
|
|
|
|
|
|
|
export CARGO_INCREMENTAL=0
|
|
|
|
export RUSTFLAGS=-Cinstrument-coverage
|
|
|
|
# Avoid problems with relative paths
|
|
|
|
export LLVM_PROFILE_FILE=$PROF_DIR/cargo-test-%p-%m.profraw
|
|
|
|
export MARTIN_PORT=3111
|
|
|
|
|
|
|
|
cargo test --all-targets
|
|
|
|
tests/test.sh
|
|
|
|
|
|
|
|
set -x
|
2023-05-24 06:47:55 +03:00
|
|
|
grcov --binary-path ./target/debug \
|
|
|
|
-s . \
|
|
|
|
-t {{ FORMAT }} \
|
|
|
|
--branch \
|
|
|
|
--ignore 'benches/*' \
|
|
|
|
--ignore 'tests/*' \
|
|
|
|
--ignore-not-existing \
|
|
|
|
-o target/coverage/{{ FORMAT }} \
|
|
|
|
--llvm \
|
2022-12-27 09:56:27 +03:00
|
|
|
"$PROF_DIR"
|
|
|
|
{ set +x; } 2>/dev/null
|
|
|
|
|
|
|
|
# if this is html, open it in the browser
|
2023-05-24 06:47:55 +03:00
|
|
|
if [ "{{ FORMAT }}" = "html" ]; then
|
2022-12-27 09:56:27 +03:00
|
|
|
open "$OUTPUT_RESULTS_DIR/index.html"
|
|
|
|
fi
|
2022-10-31 23:28:21 +03:00
|
|
|
|
2022-11-02 21:00:05 +03:00
|
|
|
# Build and run martin docker image
|
|
|
|
docker-run *ARGS:
|
2023-05-24 06:47:55 +03:00
|
|
|
docker run -it --rm --net host -e DATABASE_URL -v $PWD/tests:/tests ghcr.io/maplibre/martin {{ ARGS }}
|
2022-11-02 21:00:05 +03:00
|
|
|
|
2022-10-31 23:28:21 +03:00
|
|
|
# Do any git command, ensuring that the testing environment is set up. Accepts the same arguments as git.
|
2022-11-30 19:57:27 +03:00
|
|
|
[no-exit-message]
|
2022-12-27 09:56:27 +03:00
|
|
|
git *ARGS: start
|
2023-05-24 06:47:55 +03:00
|
|
|
git {{ ARGS }}
|
2022-12-10 10:40:01 +03:00
|
|
|
|
2023-05-16 21:12:24 +03:00
|
|
|
# Print the connection string for the test database
|
|
|
|
print-conn-str:
|
2024-01-15 04:21:30 +03:00
|
|
|
@echo {{ quote(DATABASE_URL) }}
|
2023-05-16 21:12:24 +03:00
|
|
|
|
2022-12-22 09:35:29 +03:00
|
|
|
# Run cargo fmt and cargo clippy
|
2023-06-04 01:54:50 +03:00
|
|
|
lint: fmt clippy
|
|
|
|
|
|
|
|
# Run cargo fmt
|
|
|
|
fmt:
|
2022-12-22 09:35:29 +03:00
|
|
|
cargo fmt --all -- --check
|
2023-06-04 01:54:50 +03:00
|
|
|
|
2023-12-05 01:11:03 +03:00
|
|
|
# Reformat markdown files using markdownlint-cli2
|
|
|
|
fmt-md:
|
|
|
|
docker run -it --rm -v $PWD:/workdir davidanson/markdownlint-cli2 --config /workdir/.github/files/config.markdownlint-cli2.jsonc --fix
|
|
|
|
|
2023-06-16 01:36:41 +03:00
|
|
|
# Run Nightly cargo fmt, ordering imports
|
|
|
|
fmt2:
|
|
|
|
cargo +nightly fmt -- --config imports_granularity=Module,group_imports=StdExternalCrate
|
|
|
|
|
2023-12-16 07:13:57 +03:00
|
|
|
# Run cargo check
|
|
|
|
check:
|
2023-12-25 08:52:04 +03:00
|
|
|
RUSTFLAGS='-D warnings' cargo check --bins --tests --lib --benches --examples -p martin-tile-utils
|
|
|
|
RUSTFLAGS='-D warnings' cargo check --bins --tests --lib --benches --examples -p mbtiles
|
|
|
|
RUSTFLAGS='-D warnings' cargo check --bins --tests --lib --benches --examples -p mbtiles --no-default-features
|
|
|
|
RUSTFLAGS='-D warnings' cargo check --bins --tests --lib --benches --examples -p martin
|
|
|
|
RUSTFLAGS='-D warnings' cargo check --bins --tests --lib --benches --examples -p martin --no-default-features
|
|
|
|
RUSTFLAGS='-D warnings' cargo check --bins --tests --lib --benches --examples -p martin --no-default-features --features fonts
|
|
|
|
RUSTFLAGS='-D warnings' cargo check --bins --tests --lib --benches --examples -p martin --no-default-features --features mbtiles
|
|
|
|
RUSTFLAGS='-D warnings' cargo check --bins --tests --lib --benches --examples -p martin --no-default-features --features pmtiles
|
|
|
|
RUSTFLAGS='-D warnings' cargo check --bins --tests --lib --benches --examples -p martin --no-default-features --features postgres
|
|
|
|
RUSTFLAGS='-D warnings' cargo check --bins --tests --lib --benches --examples -p martin --no-default-features --features sprites
|
2023-12-16 07:13:57 +03:00
|
|
|
|
2023-12-25 07:43:58 +03:00
|
|
|
# Verify doc build
|
|
|
|
check-doc:
|
|
|
|
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --workspace
|
|
|
|
|
2023-06-04 01:54:50 +03:00
|
|
|
# Run cargo clippy
|
|
|
|
clippy:
|
2024-02-09 11:59:31 +03:00
|
|
|
cargo clippy --workspace --all-targets --bins --tests --lib --benches --examples -- -D warnings
|
2022-12-22 09:35:29 +03:00
|
|
|
|
2023-12-05 01:11:03 +03:00
|
|
|
# Validate markdown URLs with markdown-link-check
|
|
|
|
clippy-md:
|
|
|
|
docker run -it --rm -v ${PWD}:/workdir --entrypoint sh ghcr.io/tcort/markdown-link-check -c \
|
|
|
|
'echo -e "/workdir/README.md\n$(find /workdir/docs/src -name "*.md")" | tr "\n" "\0" | xargs -0 -P 5 -n1 -I{} markdown-link-check --config /workdir/.github/files/markdown.links.config.json {}'
|
|
|
|
|
2022-12-10 10:40:01 +03:00
|
|
|
# These steps automatically run before git push via a git hook
|
2023-12-25 08:52:04 +03:00
|
|
|
git-pre-push: env-info restart fmt clippy check-doc test check
|
2023-11-09 03:46:23 +03:00
|
|
|
|
|
|
|
# Get environment info
|
|
|
|
[private]
|
|
|
|
env-info:
|
|
|
|
@echo "OS is {{ os() }}, arch is {{ arch() }}"
|
|
|
|
{{ just_executable() }} --version
|
2022-12-19 05:24:06 +03:00
|
|
|
rustc --version
|
|
|
|
cargo --version
|
2023-12-25 07:43:58 +03:00
|
|
|
rustup --version
|
2023-06-01 20:07:13 +03:00
|
|
|
|
2023-07-04 15:05:23 +03:00
|
|
|
# Update sqlite database schema.
|
|
|
|
prepare-sqlite: install-sqlx
|
2023-10-28 11:50:49 +03:00
|
|
|
mkdir -p mbtiles/.sqlx
|
|
|
|
cd mbtiles && cargo sqlx prepare --database-url sqlite://$PWD/../tests/fixtures/mbtiles/world_cities.mbtiles -- --lib --tests
|
2023-07-04 15:05:23 +03:00
|
|
|
|
|
|
|
# Install SQLX cli if not already installed.
|
|
|
|
[private]
|
2023-07-07 23:44:30 +03:00
|
|
|
install-sqlx: (cargo-install "cargo-sqlx" "sqlx-cli" "--no-default-features" "--features" "sqlite,native-tls")
|
|
|
|
|
|
|
|
# Check if a certain Cargo command is installed, and install it if needed
|
|
|
|
[private]
|
|
|
|
cargo-install $COMMAND $INSTALL_CMD="" *ARGS="":
|
2024-02-06 05:49:36 +03:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
set -eu
|
2024-02-06 09:33:35 +03:00
|
|
|
if ! command -v $COMMAND > /dev/null; then
|
|
|
|
if ! command -v cargo-binstall > /dev/null; then
|
2024-02-27 10:40:20 +03:00
|
|
|
echo "$COMMAND could not be found. Installing it with cargo install ${INSTALL_CMD:-$COMMAND} --locked {{ ARGS }}"
|
|
|
|
cargo install ${INSTALL_CMD:-$COMMAND} --locked {{ ARGS }}
|
2024-02-06 05:49:36 +03:00
|
|
|
else
|
2024-02-27 10:40:20 +03:00
|
|
|
echo "$COMMAND could not be found. Installing it with cargo binstall ${INSTALL_CMD:-$COMMAND} --locked {{ ARGS }}"
|
|
|
|
cargo binstall ${INSTALL_CMD:-$COMMAND} --locked {{ ARGS }}
|
2024-02-06 05:49:36 +03:00
|
|
|
fi
|
2023-06-01 20:07:13 +03:00
|
|
|
fi
|