Justfile 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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. #------------------------#
  29. # running extended tests #
  30. #------------------------#
  31. # run extended tests
  32. @xtests:
  33. echo "XTESTS ARE DEPRECATED DON'T USE"
  34. .xtests/run.sh
  35. # run extended tests (using the release mode exa)
  36. @xtests-release:
  37. echo "XTESTS ARE DEPRECATED DON'T USE"
  38. .xtests/run.sh --release
  39. # display the number of extended tests that get run
  40. @count-xtests:
  41. echo "XTESTS ARE DEPRECATED DON'T USE"
  42. grep -F '[[cmd]]' -R .xtests | wc -l
  43. #-----------------------#
  44. # code quality and misc #
  45. #-----------------------#
  46. # lint the code
  47. @clippy:
  48. touch src/main.rs
  49. cargo clippy
  50. # update dependency versions, and checks for outdated ones
  51. @update-deps:
  52. cargo update
  53. command -v cargo-outdated >/dev/null || (echo "cargo-outdated not installed" && exit 1)
  54. cargo outdated
  55. # list unused dependencies
  56. @unused-deps:
  57. command -v cargo-udeps >/dev/null || (echo "cargo-udeps not installed" && exit 1)
  58. cargo +nightly udeps
  59. # check that every combination of feature flags is successful
  60. @check-features:
  61. command -v cargo-hack >/dev/null || (echo "cargo-hack not installed" && exit 1)
  62. cargo hack check --feature-powerset
  63. # build exa and run extended tests with features disabled
  64. @feature-checks *args:
  65. echo "XTESTS ARE DEPRECATED DON'T USE"
  66. cargo build --no-default-features
  67. specsheet .xtests/features/none.toml -shide {{args}} \
  68. -O cmd.target.exa="${CARGO_TARGET_DIR:-../../target}/debug/exa"
  69. # print versions of the necessary build tools
  70. @versions:
  71. rustc --version
  72. cargo --version
  73. #---------------#
  74. # documentation #
  75. #---------------#
  76. # build the man pages
  77. @man:
  78. mkdir -p "${CARGO_TARGET_DIR:-target}/man"
  79. pandoc --standalone -f markdown -t man man/eza.1.md > "${CARGO_TARGET_DIR:-target}/man/eza.1"
  80. pandoc --standalone -f markdown -t man man/eza_colors.5.md > "${CARGO_TARGET_DIR:-target}/man/eza_colors.5"
  81. pandoc --standalone -f markdown -t man man/eza_colors-explanation.5.md > "${CARGO_TARGET_DIR:-target}/man/eza_colors-explanation.5"
  82. # build and preview the main man page (eza.1)
  83. @man-1-preview: man
  84. man "${CARGO_TARGET_DIR:-target}/man/eza.1"
  85. # build and preview the colour configuration man page (eza_colors.5)
  86. @man-5-preview: man
  87. man "${CARGO_TARGET_DIR:-target}/man/eza_colors.5"
  88. # build and preview the colour configuration man page (eza_colors.5)
  89. @man-5-explanations-preview: man
  90. man "${CARGO_TARGET_DIR:-target}/man/eza_colors-explanation.5"
  91. #---------------#
  92. # release #
  93. #---------------#
  94. # If you're not cafkafk and she isn't dead, don't run this!
  95. #
  96. # usage: release major, release minor, release patch
  97. @release version:
  98. cargo bump '{{version}}'
  99. 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
  100. cargo check
  101. nix build -L ./#clippy
  102. 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)
  103. 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)"
  104. git push
  105. echo "waiting 10 seconds for github to catch up..."
  106. sleep 10
  107. 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
  108. # If you're not cafkafk and she isn't dead, you probably don't need to run
  109. # this!
  110. #
  111. # usage: cross
  112. @cross:
  113. rustup toolchain install stable
  114. mkdir -p ./target/"bin-$(convco version)"
  115. # Build
  116. ## Linux
  117. cross build --target x86_64-unknown-linux-gnu --release
  118. tar czvf ./target/"bin-$(convco version)"/eza_x86_64-unknown-linux-gnu.tar.gz -C ./target/x86_64-unknown-linux-gnu/release/ ./eza
  119. cross build --target aarch64-unknown-linux-gnu --release
  120. tar czvf ./target/"bin-$(convco version)"/eza_aarch64-unknown-linux-gnu.tar.gz -C ./target/aarch64-unknown-linux-gnu/release/ ./eza
  121. cross build --target arm-unknown-linux-gnueabihf --release
  122. tar czvf ./target/"bin-$(convco version)"/arm-unknown-linux-gnueabihf.tar.gz -C ./target/arm-unknown-linux-gnueabihf/release/ ./eza
  123. ## Windows
  124. cross build --target x86_64-pc-windows-gnu --release
  125. zip -j ./target/"bin-$(convco version)"/x86_64-pc-windows-gnu.zip ./target/x86_64-pc-windows-gnu/release/eza.exe
  126. # Generate Checksums
  127. echo "# Checksums"
  128. echo "## sha256sum"
  129. echo "```"
  130. sha256sum ./target/"bin-$(convco version)"/*
  131. echo "```"
  132. echo "## md5sum"
  133. echo "```"
  134. md5sum ./target/"bin-$(convco version)"/*
  135. echo "```"