Justfile 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. all: build test
  2. all-release: build-release test-release
  3. #----------#
  4. # building #
  5. #----------#
  6. # compile the exa binary
  7. @build:
  8. cargo build
  9. # compile the exa binary (in release mode)
  10. @build-release:
  11. cargo build --release --verbose
  12. # produce an HTML chart of compilation timings
  13. @build-time:
  14. cargo +nightly clean
  15. cargo +nightly build -Z timings
  16. # check that the exa binary can compile
  17. @check:
  18. cargo check
  19. #---------------#
  20. # running tests #
  21. #---------------#
  22. # run unit tests
  23. @test:
  24. cargo test --workspace -- --quiet
  25. # run unit tests (in release mode)
  26. @test-release:
  27. cargo test --workspace --release --verbose
  28. alias itest := integration_tests
  29. @integration_tests:
  30. VHS_PUBLISH=false ./tests/vhs-runner.sh
  31. #------------------------#
  32. # running extended tests #
  33. #------------------------#
  34. # run extended tests
  35. @xtests:
  36. echo "XTESTS ARE DEPRECATED DON'T USE"
  37. .xtests/run.sh
  38. # run extended tests (using the release mode exa)
  39. @xtests-release:
  40. echo "XTESTS ARE DEPRECATED DON'T USE"
  41. .xtests/run.sh --release
  42. # display the number of extended tests that get run
  43. @count-xtests:
  44. echo "XTESTS ARE DEPRECATED DON'T USE"
  45. grep -F '[[cmd]]' -R .xtests | wc -l
  46. #-----------------------#
  47. # code quality and misc #
  48. #-----------------------#
  49. # lint the code
  50. @clippy:
  51. touch src/main.rs
  52. cargo clippy
  53. # update dependency versions, and checks for outdated ones
  54. @update-deps:
  55. cargo update
  56. command -v cargo-outdated >/dev/null || (echo "cargo-outdated not installed" && exit 1)
  57. cargo outdated
  58. # list unused dependencies
  59. @unused-deps:
  60. command -v cargo-udeps >/dev/null || (echo "cargo-udeps not installed" && exit 1)
  61. cargo +nightly udeps
  62. # check that every combination of feature flags is successful
  63. @check-features:
  64. command -v cargo-hack >/dev/null || (echo "cargo-hack not installed" && exit 1)
  65. cargo hack check --feature-powerset
  66. # build exa and run extended tests with features disabled
  67. @feature-checks *args:
  68. echo "XTESTS ARE DEPRECATED DON'T USE"
  69. cargo build --no-default-features
  70. specsheet .xtests/features/none.toml -shide {{args}} \
  71. -O cmd.target.exa="${CARGO_TARGET_DIR:-../../target}/debug/exa"
  72. # print versions of the necessary build tools
  73. @versions:
  74. rustc --version
  75. cargo --version
  76. #---------------#
  77. # documentation #
  78. #---------------#
  79. # build the man pages
  80. @man:
  81. mkdir -p "${CARGO_TARGET_DIR:-target}/man"
  82. pandoc --standalone -f markdown -t man man/eza.1.md > "${CARGO_TARGET_DIR:-target}/man/eza.1"
  83. pandoc --standalone -f markdown -t man man/eza_colors.5.md > "${CARGO_TARGET_DIR:-target}/man/eza_colors.5"
  84. pandoc --standalone -f markdown -t man man/eza_colors-explanation.5.md > "${CARGO_TARGET_DIR:-target}/man/eza_colors-explanation.5"
  85. # build and preview the main man page (eza.1)
  86. @man-1-preview: man
  87. man "${CARGO_TARGET_DIR:-target}/man/eza.1"
  88. # build and preview the colour configuration man page (eza_colors.5)
  89. @man-5-preview: man
  90. man "${CARGO_TARGET_DIR:-target}/man/eza_colors.5"
  91. # build and preview the colour configuration man page (eza_colors.5)
  92. @man-5-explanations-preview: man
  93. man "${CARGO_TARGET_DIR:-target}/man/eza_colors-explanation.5"
  94. #---------------#
  95. # release #
  96. #---------------#
  97. # If you're not cafkafk and she isn't dead, don't run this!
  98. #
  99. # usage: release major, release minor, release patch
  100. @release version:
  101. cargo bump '{{version}}'
  102. git cliff -t $(grep '^version' Cargo.toml | head -n 1 | grep -E '([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?' -o) > CHANGELOG.md
  103. cargo check
  104. nix build -L ./#clippy
  105. git checkout -b cafk-release-$(grep '^version' Cargo.toml | head -n 1 | grep -E '([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?' -o)
  106. git commit -asm "chore: release $(grep '^version' Cargo.toml | head -n 1 | grep -E '([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?' -o)"
  107. git push
  108. echo "waiting 10 seconds for github to catch up..."
  109. sleep 10
  110. gh pr create --draft --title "chore: release $(grep '^version' Cargo.toml | head -n 1 | grep -E '([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?' -o)" --body "This PR was auto-generated by our lovely just file" --reviewer cafkafk
  111. # If you're not cafkafk and she isn't dead, you probably don't need to run
  112. # this!
  113. #
  114. # usage: cross
  115. @cross:
  116. rustup toolchain install stable
  117. mkdir -p ./target/"bin-$(convco version)"
  118. # Build
  119. ## Linux
  120. cross build --target x86_64-unknown-linux-gnu --release
  121. tar czvf ./target/"bin-$(convco version)"/eza_x86_64-unknown-linux-gnu.tar.gz -C ./target/x86_64-unknown-linux-gnu/release/ ./eza
  122. cross build --target aarch64-unknown-linux-gnu --release
  123. tar czvf ./target/"bin-$(convco version)"/eza_aarch64-unknown-linux-gnu.tar.gz -C ./target/aarch64-unknown-linux-gnu/release/ ./eza
  124. cross build --target arm-unknown-linux-gnueabihf --release
  125. tar czvf ./target/"bin-$(convco version)"/arm-unknown-linux-gnueabihf.tar.gz -C ./target/arm-unknown-linux-gnueabihf/release/ ./eza
  126. ## Windows
  127. cross build --target x86_64-pc-windows-gnu --release
  128. zip -j ./target/"bin-$(convco version)"/x86_64-pc-windows-gnu.zip ./target/x86_64-pc-windows-gnu/release/eza.exe
  129. # Generate Checksums
  130. echo "# Checksums"
  131. echo "## sha256sum"
  132. echo "```"
  133. sha256sum ./target/"bin-$(convco version)"/*
  134. echo "```"
  135. echo "## md5sum"
  136. echo "```"
  137. md5sum ./target/"bin-$(convco version)"/*
  138. echo "```"