Justfile 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. # code quality and misc #
  30. #-----------------------#
  31. # lint the code
  32. @clippy:
  33. touch src/main.rs
  34. cargo clippy
  35. # update dependency versions, and checks for outdated ones
  36. @update-deps:
  37. cargo update
  38. command -v cargo-outdated >/dev/null || (echo "cargo-outdated not installed" && exit 1)
  39. cargo outdated
  40. # list unused dependencies
  41. @unused-deps:
  42. command -v cargo-udeps >/dev/null || (echo "cargo-udeps not installed" && exit 1)
  43. cargo +nightly udeps
  44. # check that every combination of feature flags is successful
  45. @check-features:
  46. command -v cargo-hack >/dev/null || (echo "cargo-hack not installed" && exit 1)
  47. cargo hack check --feature-powerset
  48. # print versions of the necessary build tools
  49. @versions:
  50. rustc --version
  51. cargo --version
  52. #---------------#
  53. # documentation #
  54. #---------------#
  55. # build the man pages
  56. @man:
  57. mkdir -p "${CARGO_TARGET_DIR:-target}/man"
  58. pandoc --standalone -f markdown -t man man/eza.1.md > "${CARGO_TARGET_DIR:-target}/man/eza.1"
  59. pandoc --standalone -f markdown -t man man/eza_colors.5.md > "${CARGO_TARGET_DIR:-target}/man/eza_colors.5"
  60. pandoc --standalone -f markdown -t man man/eza_colors-explanation.5.md > "${CARGO_TARGET_DIR:-target}/man/eza_colors-explanation.5"
  61. # build and preview the main man page (eza.1)
  62. @man-1-preview: man
  63. man "${CARGO_TARGET_DIR:-target}/man/eza.1"
  64. # build and preview the colour configuration man page (eza_colors.5)
  65. @man-5-preview: man
  66. man "${CARGO_TARGET_DIR:-target}/man/eza_colors.5"
  67. # build and preview the colour configuration man page (eza_colors.5)
  68. @man-5-explanations-preview: man
  69. man "${CARGO_TARGET_DIR:-target}/man/eza_colors-explanation.5"
  70. #---------------#
  71. # release #
  72. #---------------#
  73. # If you're not cafkafk and she isn't dead, don't run this!
  74. #
  75. # usage: release major, release minor, release patch
  76. @release version:
  77. cargo bump '{{version}}'
  78. 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
  79. cargo check
  80. nix build -L ./#clippy
  81. 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)
  82. 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)"
  83. git push
  84. echo "waiting 10 seconds for github to catch up..."
  85. sleep 10
  86. 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
  87. # If you're not cafkafk and she isn't dead, you probably don't need to run
  88. # this!
  89. #
  90. # usage: cross
  91. @cross:
  92. rustup toolchain install stable
  93. mkdir -p ./target/"bin-$(convco version)"
  94. # Build
  95. ## Linux
  96. cross build --target x86_64-unknown-linux-gnu --release
  97. tar czvf ./target/"bin-$(convco version)"/eza_x86_64-unknown-linux-gnu.tar.gz -C ./target/x86_64-unknown-linux-gnu/release/ ./eza
  98. cross build --target aarch64-unknown-linux-gnu --release
  99. tar czvf ./target/"bin-$(convco version)"/eza_aarch64-unknown-linux-gnu.tar.gz -C ./target/aarch64-unknown-linux-gnu/release/ ./eza
  100. cross build --target arm-unknown-linux-gnueabihf --release
  101. tar czvf ./target/"bin-$(convco version)"/arm-unknown-linux-gnueabihf.tar.gz -C ./target/arm-unknown-linux-gnueabihf/release/ ./eza
  102. ## Windows
  103. cross build --target x86_64-pc-windows-gnu --release
  104. zip -j ./target/"bin-$(convco version)"/x86_64-pc-windows-gnu.zip ./target/x86_64-pc-windows-gnu/release/eza.exe
  105. # Generate Checksums
  106. echo "# Checksums"
  107. echo "## sha256sum"
  108. echo "```"
  109. sha256sum ./target/"bin-$(convco version)"/*
  110. echo "```"
  111. echo "## md5sum"
  112. echo "```"
  113. md5sum ./target/"bin-$(convco version)"/*
  114. echo "```"
  115. #---------------------#
  116. # Integration testing #
  117. #---------------------#
  118. # Runs integration tests in nix sandbox
  119. #
  120. # Required nix, likely won't work on windows.
  121. @itest:
  122. nix build -L ./#trycmd
  123. # Runs integration tests in nix sandbox, and dumps outputs.
  124. #
  125. # WARNING: this can cause loss of work
  126. @idump:
  127. rm ./tests/cmd/*nix.stderr -f || echo
  128. rm ./tests/cmd/*nix.stdout -f || echo
  129. nix build -L ./#trydump
  130. cp ./result/dump/*nix.* ./tests/cmd/