11#!/ usr/ bin/ env just --justfile
22
33main_crate := ' sqlite-hashes'
4- bin_name := ' sqlite_hashes'
4+ features_flag := ' --all-features'
5+ bin_name := snakecase (main_crate)
56sqlite3 := ' sqlite3'
67
78# if running in CI, treat warnings as errors by setting RUSTFLAGS and RUSTDOCFLAGS to '-D warnings' unless they are already set
89# Use `CI=true just ci-test` to run the same tests as in GitHub CI.
910# Use `just env-info` to see the current values of RUSTFLAGS and RUSTDOCFLAGS
10- ci_mode := if env (' CI' , ' ' ) != ' ' { ' 1' } else { ' ' }
11+ ci_mode := if env (' CI' , ' ' ) != ' ' {' 1' } else {' ' }
1112export RUSTFLAGS := env (' RUSTFLAGS' , if ci_mode == ' 1' {' -D warnings' } else {' ' })
1213export RUSTDOCFLAGS := env (' RUSTDOCFLAGS' , if ci_mode == ' 1' {' -D warnings' } else {' ' })
1314export RUST_BACKTRACE := env (' RUST_BACKTRACE' , if ci_mode == ' 1' {' 1' } else {' ' })
1415
1516@_ default :
16- just --list
17+ {{ just_executable () }} --list
1718
1819# Run benchmarks
1920bench :
@@ -26,21 +27,22 @@ bless *args: (cargo-install 'cargo-insta')
2627
2728# Build the project
2829build : build-lib build-ext
30+ cargo check --workspace --all-targets {{ features_flag}}
2931
3032# Build extension binary
3133build-ext * args :
3234 cargo build --example {{ bin_name}} --no-default-features --features default_loadable_extension {{ args}}
3335
3436# Build the lib
3537build-lib :
36- cargo build --workspace --all-targets
38+ cargo build --workspace
3739
3840# Quick compile without building a binary
3941check :
40- cargo check --workspace --all-targets
42+ cargo check --workspace --all-targets {{ features_flag }}
4143
4244# Verify that the current version of the crate is not the same as the one published on crates.io
43- check-if-published : (assert ' jq' )
45+ check-if-published : (assert-cmd ' jq' )
4446 #!/usr/bin/env bash
4547 set -euo pipefail
4648 LOCAL_VERSION=" $({{ just_executable ()}} get-crate-field version)"
@@ -61,21 +63,13 @@ check-lib:
6163 cargo check --workspace
6264
6365# Generate code coverage report to upload to codecov.io
64- ci-coverage : && \
66+ ci-coverage : env-info && \
6567 (coverage ' --codecov --output-path target/llvm-cov/codecov.info' )
6668 # ATTENTION: the full file path above is used in the CI workflow
6769 mkdir -p target/ llvm-cov
6870
6971# Run all tests as expected by CI
70- ci-test : env-info test-fmt check clippy test test-ext test-doc
71- #!/usr/bin/env bash
72- set -euo pipefail
73- if [ -n " $(git status --untracked-files --porcelain)" ]; then
74- >&2 echo ' ERROR: git repo is no longer clean. Make sure compilation and tests artifacts are in the .gitignore, and no repo files are modified.'
75- >&2 echo ' ######### git status ##########'
76- git status
77- exit 1
78- fi
72+ ci-test : env-info test-fmt check clippy test test-ext test-doc && assert-git-is-clean
7973
8074# Run minimal subset of tests to ensure compatibility with MSRV
8175ci-test-msrv : env-info check-lib test
8680
8781# Run cargo clippy to lint the code
8882clippy * args :
89- cargo clippy --workspace --all-targets {{ args}}
83+ cargo clippy --workspace --all-targets {{ features_flag }} {{ args}}
9084 cargo clippy --no-default-features --features default_loadable_extension {{ args}}
9185
9286# Generate code coverage report. Will install `cargo llvm-cov` if missing.
@@ -150,10 +144,10 @@ msrv: (cargo-install 'cargo-msrv')
150144
151145# Check semver compatibility with prior published version. Install it with `cargo install cargo-semver-checks`
152146semver * args : (cargo-install ' cargo-semver-checks' )
153- cargo semver-checks {{ args}}
147+ cargo semver-checks {{ features_flag }} {{ args}}
154148
155149# Switch to the minimum rusqlite version
156- set-min-rusqlite-version : (assert " jq" )
150+ set-min-rusqlite-version : (assert-cmd ' jq' )
157151 #!/usr/bin/env bash
158152 set -euo pipefail
159153 MIN_RUSQL_VER=" $(grep '^rusqlite =.*version = " >=' Cargo.toml | sed -E ' s/ .*version = " [^"0- 9]*([0- 9.-]+ ).*/ \1 / ' )"
@@ -162,27 +156,27 @@ set-min-rusqlite-version: (assert "jq")
162156
163157# Run all unit and integration tests
164158test: \
165- ( test-one-lib " --no-default-features" " --features" " trace,hex,md5" ) \
166- ( test-one-lib " --no-default-features" " --features" " trace,hex,sha1" ) \
167- ( test-one-lib " --no-default-features" " --features" " trace,hex,sha224" ) \
168- ( test-one-lib " --no-default-features" " --features" " trace,hex,sha256" ) \
169- ( test-one-lib " --no-default-features" " --features" " trace,hex,sha384" ) \
170- ( test-one-lib " --no-default-features" " --features" " trace,hex,sha512" ) \
171- ( test-one-lib " --no-default-features" " --features" " trace,hex,blake3" ) \
172- ( test-one-lib " --no-default-features" " --features" " trace,hex,fnv" ) \
173- ( test-one-lib " --no-default-features" " --features" " trace,hex,xxhash" ) \
159+ ( test-one-lib ' --no-default-features' ' --features' ' trace,hex,md5' ) \
160+ ( test-one-lib ' --no-default-features' ' --features' ' trace,hex,sha1' ) \
161+ ( test-one-lib ' --no-default-features' ' --features' ' trace,hex,sha224 ' ) \
162+ ( test-one-lib ' --no-default-features' ' --features' ' trace,hex,sha256 ' ) \
163+ ( test-one-lib ' --no-default-features' ' --features' ' trace,hex,sha384 ' ) \
164+ ( test-one-lib ' --no-default-features' ' --features' ' trace,hex,sha512 ' ) \
165+ ( test-one-lib ' --no-default-features' ' --features' ' trace,hex,blake3 ' ) \
166+ ( test-one-lib ' --no-default-features' ' --features' ' trace,hex,fnv' ) \
167+ ( test-one-lib ' --no-default-features' ' --features' ' trace,hex,xxhash' ) \
174168 \
175- ( test-one-lib " --no-default-features" " --features" " md5,sha1,sha224,sha256,sha384,sha512,blake3,fnv,xxhash" ) \
176- ( test-one-lib " --no-default-features" " --features" " md5,sha1,sha224,sha256,sha384,sha512,blake3,fnv,xxhash,aggregate" ) \
169+ ( test-one-lib ' --no-default-features' ' --features' ' md5,sha1,sha224 ,sha256 ,sha384 ,sha512 ,blake3 ,fnv,xxhash' ) \
170+ ( test-one-lib ' --no-default-features' ' --features' ' md5,sha1,sha224 ,sha256 ,sha384 ,sha512 ,blake3 ,fnv,xxhash,aggregate' ) \
177171 \
178- ( test-one-lib " --no-default-features" " --features" " md5,sha1,sha224,sha256,sha384,sha512,blake3,fnv,xxhash,hex" ) \
179- ( test-one-lib " --no-default-features" " --features" " md5,sha1,sha224,sha256,sha384,sha512,blake3,fnv,xxhash,hex,aggregate" ) \
172+ ( test-one-lib ' --no-default-features' ' --features' ' md5,sha1,sha224 ,sha256 ,sha384 ,sha512 ,blake3 ,fnv,xxhash,hex ' ) \
173+ ( test-one-lib ' --no-default-features' ' --features' ' md5,sha1,sha224 ,sha256 ,sha384 ,sha512 ,blake3 ,fnv,xxhash,hex,aggregate' ) \
180174 \
181- ( test-one-lib " --no-default-features" " --features" " md5,sha1,sha224,sha256,sha384,sha512,blake3,fnv,xxhash,trace" ) \
182- ( test-one-lib " --no-default-features" " --features" " md5,sha1,sha224,sha256,sha384,sha512,blake3,fnv,xxhash,trace,aggregate" ) \
175+ ( test-one-lib ' --no-default-features' ' --features' ' md5,sha1,sha224 ,sha256 ,sha384 ,sha512 ,blake3 ,fnv,xxhash,trace' ) \
176+ ( test-one-lib ' --no-default-features' ' --features' ' md5,sha1,sha224 ,sha256 ,sha384 ,sha512 ,blake3 ,fnv,xxhash,trace,aggregate' ) \
183177 \
184- ( test-one-lib " --no-default-features" " --features" " md5,sha1,sha224,sha256,sha384,sha512,blake3,fnv,xxhash,hex,trace" ) \
185- ( test-one-lib " --no-default-features" " --features" " md5,sha1,sha224,sha256,sha384,sha512,blake3,fnv,xxhash,hex,trace,aggregate" )
178+ ( test-one-lib ' --no-default-features' ' --features' ' md5,sha1,sha224 ,sha256 ,sha384 ,sha512 ,blake3 ,fnv,xxhash,hex,trace' ) \
179+ ( test-one-lib ' --no-default-features' ' --features' ' md5,sha1,sha224 ,sha256 ,sha384 ,sha512 ,blake3 ,fnv,xxhash,hex,trace,aggregate' )
186180
187181# Test documentation
188182test-doc:
@@ -199,7 +193,7 @@ test-fmt:
199193
200194# Find unused dependencies. Install it with `cargo install cargo-udeps`
201195udeps: (cargo-install ' cargo-udeps' )
202- cargo +nightly udeps --all-targets -- workspace --all-features
196+ cargo +nightly udeps --workspace --all-targets {{ features_flag }}
203197
204198# Update all dependencies, including breaking changes. Requires nightly toolchain (install with `rustup install nightly`)
205199update:
@@ -208,12 +202,22 @@ update:
208202
209203# Ensure that a certain command is available
210204[private]
211- assert command:
205+ assert-cmd command:
212206 @if ! type {{ command}} > /dev/null; then \
213207 echo "Command ' {{ command}} ' could not be found. Please make sure it has been installed on your computer." ;\
214208 exit 1 ;\
215209 fi
216210
211+ # Make sure the git repo has no uncommitted changes
212+ [private]
213+ assert-git-is-clean:
214+ @if [ -n "$(git status --untracked-files --porcelain)" ]; then \
215+ >&2 echo "ERROR: git repo is no longer clean. Make sure compilation and tests artifacts are in the .gitignore, and no repo files are modified." ;\
216+ >&2 echo "######### git status ##########" ;\
217+ git status ;\
218+ exit 1 ;\
219+ fi
220+
217221# Check if a certain Cargo command is installed, and install it if needed
218222[private]
219223cargo-install $COMMAND $INSTALL_CMD='' *args='' :
@@ -231,11 +235,9 @@ cargo-install $COMMAND $INSTALL_CMD='' *args='':
231235
232236[private]
233237is-sqlite3-available:
234- #!/usr/bin/env bash
235- set -euo pipefail
236- if ! command -v {{ sqlite3}} > /dev/null; then
237- echo "{{ sqlite3}} executable could not be found"
238- exit 1
238+ if ! command -v {{ sqlite3}} > /dev/null; then \
239+ echo "{{ sqlite3}} executable could not be found" ;\
240+ exit 1 ;\
239241 fi
240242 echo "Found {{ sqlite3}} executable:"
241243 {{ sqlite3}} --version
0 commit comments