Justfile 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. all: build test xtests
  2. all-release: build-release test-release xtests-release
  3. all-quick: build-quick test-quick xtests-quick
  4. export DOG_DEBUG := ""
  5. # compiles the dog binary
  6. @build:
  7. cargo build
  8. # compiles the dog binary (in release mode)
  9. @build-release:
  10. cargo build --release --verbose
  11. strip "${CARGO_TARGET_DIR:-target}/release/dog"
  12. # compiles the dog binary (without some features)
  13. @build-quick:
  14. cargo build --no-default-features
  15. # runs unit tests
  16. @test:
  17. cargo test --workspace -- --quiet
  18. # runs unit tests (in release mode)
  19. @test-release:
  20. cargo test --release --workspace --verbose
  21. # runs unit tests (without some features)
  22. @test-quick:
  23. cargo test --workspace --no-default-features -- --quiet
  24. # runs mutation tests
  25. @test-mutation:
  26. cargo +nightly test --package dns --features=dns/with_mutagen -- --quiet
  27. cargo +nightly mutagen --package dns --features=dns/with_mutagen
  28. # runs extended tests
  29. @xtests:
  30. specsheet xtests/*.toml -O cmd.target.dog="${CARGO_TARGET_DIR:-../target}/debug/dog"
  31. # runs extended tests (in release mode)
  32. @xtests-release:
  33. specsheet xtests/*.toml -O cmd.target.dog="${CARGO_TARGET_DIR:-../target}/release/dog"
  34. # runs extended tests (omitting certain feature tests)
  35. @xtests-quick:
  36. specsheet xtests/*.toml -O cmd.target.dog="${CARGO_TARGET_DIR:-../target}/debug/dog" --skip-tags=udp,tls,https,json
  37. # runs fuzzing on the dns crate
  38. @fuzz:
  39. cargo +nightly fuzz --version
  40. cd dns; cargo +nightly fuzz run fuzz_parsing -- -jobs=`nproc` -workers=`nproc` -runs=69105
  41. # prints out the data that caused crashes during fuzzing as hexadecimal
  42. @fuzz-hex:
  43. for crash in dns/fuzz/artifacts/fuzz_parsing/crash-*; do echo; echo $crash; hexyl $crash; done
  44. # removes fuzz log files
  45. @fuzz-clean:
  46. rm dns/fuzz/fuzz-*.log
  47. # lints the code
  48. @clippy:
  49. touch dns/src/lib.rs
  50. cargo clippy
  51. # generates a code coverage report using tarpaulin via docker
  52. @coverage-docker:
  53. docker run --security-opt seccomp=unconfined -v "${PWD}:/volume" xd009642/tarpaulin cargo tarpaulin --all --out Html
  54. # updates dependency versions, and checks for outdated ones
  55. @update-deps:
  56. cargo update
  57. command -v cargo-outdated >/dev/null || (echo "cargo-outdated not installed" && exit 1)
  58. cargo outdated
  59. # lists unused dependencies
  60. @unused-deps:
  61. command -v cargo-udeps >/dev/null || (echo "cargo-udeps not installed" && exit 1)
  62. cargo +nightly udeps
  63. # prints versions of the necessary build tools
  64. @versions:
  65. rustc --version
  66. cargo --version
  67. # renders the documentation
  68. @doc:
  69. cargo doc --no-deps --workspace
  70. # builds the man pages
  71. @man:
  72. mkdir -p "${CARGO_TARGET_DIR:-target}/man"
  73. pandoc --standalone -f markdown -t man man/dog.1.md > "${CARGO_TARGET_DIR:-target}/man/dog.1"
  74. # builds and previews the man page
  75. @man-preview: man
  76. man "${CARGO_TARGET_DIR:-target}/man/dog.1"
  77. # creates a distributable package
  78. package release:
  79. #!/usr/bin/env perl
  80. use Archive::Zip;
  81. -e 'target/release/dog' || die 'Binary not built!';
  82. -e 'target/man/dog.1' || die 'Man page not built!';
  83. my $zip = Archive::Zip->new();
  84. $zip->addFile('completions/dog.bash');
  85. $zip->addFile('completions/dog.zsh');
  86. $zip->addFile('completions/dog.fish');
  87. $zip->addFile('target/man/dog.1', 'man/dog.1');
  88. $zip->addFile('target/release/dog', 'bin/dog');
  89. $zip->writeToFileNamed('dog-{{ release }}.zip') == AZ_OK || die 'Zip write error!';
  90. system 'unzip -l "dog-{{ release }}".zip'