fork/eza
git clone https://git.julia.blue/fork/eza
9ba9c655
v0.15.2
1all : build test 2all-release : build-release test-release 3 4 5#----------# 6# building # 7#----------# 8 9# compile the exa binary 10@ build : 11cargo build 12 13# compile the exa binary (in release mode) 14@ build-release : 15cargo build--release --verbose 16 17# produce an HTML chart of compilation timings 18@ build-time : 19cargo +nightly clean 20cargo +nightly build-Z timings 21 22# check that the exa binary can compile 23@ check : 24cargo check 25 26 27#---------------# 28# running tests # 29#---------------# 30 31# run unit tests 32@ test : 33cargo test--workspace -- --quiet 34 35# run unit tests (in release mode) 36@ test-release : 37cargo test--workspace --release --verbose 38 39#-----------------------# 40# code quality and misc # 41#-----------------------# 42 43# lint the code 44@ clippy : 45touch src/main.rs 46cargo clippy 47 48# update dependency versions, and checks for outdated ones 49@ update-deps : 50cargo update 51command -v cargo-outdated> /dev/null || (echo "cargo-outdated not installed" && exit 1) 52cargo outdated 53 54# list unused dependencies 55@ unused-deps : 56command -v cargo-udeps> /dev/null || (echo "cargo-udeps not installed" && exit 1) 57cargo +nightly udeps 58 59# check that every combination of feature flags is successful 60@ check-features : 61command -v cargo-hack> /dev/null || (echo "cargo-hack not installed" && exit 1) 62cargo hack check--feature-powerset 63 64# print versions of the necessary build tools 65@ versions : 66rustc --version 67cargo --version 68 69 70#---------------# 71# documentation # 72#---------------# 73 74# build the man pages 75@ man : 76mkdir -p " ${ CARGO_TARGET_DIR :-target} /man" 77version =$( awk 'BEGIN { FS = "\"" } ; /^version/ { print $2 ; exit }' Cargo.toml) ; \ 78for page in eza.1 eza_colors.5 eza_colors-explanation.5;do \ 79sed "s/\$version/v ${ version } /g" "man/ ${ page } .md" | pandoc --standalone -f markdown-t man> " ${ CARGO_TARGET_DIR :-target} /man/ ${ page } " ; \ 80done ; 81 82# build and preview the main man page (eza.1) 83@ man-1-preview : man 84man " ${ CARGO_TARGET_DIR :-target} /man/eza.1" 85 86# build and preview the colour configuration man page (eza_colors.5) 87@ man-5-preview : man 88man " ${ CARGO_TARGET_DIR :-target} /man/eza_colors.5" 89 90# build and preview the colour configuration man page (eza_colors.5) 91@ man-5-explanations-preview : man 92man " ${ CARGO_TARGET_DIR :-target} /man/eza_colors-explanation.5" 93 94#---------------# 95# release # 96#---------------# 97 98new_version := "$(convco version --bump)" 99 100# If you're not cafkafk and she isn't dead, don't run this! 101# 102# usage: release major, release minor, release patch 103release : 104cargo bump" {{ new_version }} " 105git cliff-t " {{ new_version }} " > CHANGELOG.md 106cargo check 107nix build-L ./#clippy 108git checkout-b "cafk-release-v {{ new_version }} " 109git commit-asm "chore: release eza v {{ new_version }} " 110git push 111@ echo "waiting 10 seconds for github to catch up..." 112sleep 10 113gh pr create--draft --title "chore: release v {{ new_version }} " --body "This PR was auto-generated by our lovely just file" --reviewer cafkafk 114@ echo "Now go review that and come back and run gh-release" 115 116@ gh-release : 117git tag-d "v {{ new_version }} " ||echo "tag not found, creating" ; 118git tag-a "v {{ new_version }} " -m "auto generated by the justfile for eza v $( convco version) " 119just cross 120mkdir -p ./target/"release-notes- $( convco version) " 121git cliff-t "v $( convco version) " --current > ./target/"release-notes- $( convco version) /RELEASE.md" 122just checksum>> ./target/"release-notes- $( convco version) /RELEASE.md" 123 124gh release create"v $( convco version) " --target " $( git rev-parse HEAD) " --title "eza v $( convco version) " -d -F ./target/"release-notes- $( convco version) /RELEASE.md" ./target/"bin- $( convco version) " /* 125 126#----------------# 127# binaries # 128#----------------# 129 130tar BINARY TARGET : 131tar czvf ./target/"bin- $( convco version) " /{{ BINARY }} _{{ TARGET }} .tar.gz-C ./target/{{ TARGET }} /release/ ./{{ BINARY }} 132 133zip BINARY TARGET : 134zip -j ./target/"bin- $( convco version) " /{{ BINARY }} _{{ TARGET }} .zip ./target/{{ TARGET }} /release/{{ BINARY }} 135 136tar_static BINARY TARGET : 137tar czvf ./target/"bin- $( convco version) " /{{ BINARY }} _{{ TARGET }} _static.tar.gz-C ./target/{{ TARGET }} /release/ ./{{ BINARY }} 138 139zip_static BINARY TARGET : 140zip -j ./target/"bin- $( convco version) " /{{ BINARY }} _{{ TARGET }} _static.zip ./target/{{ TARGET }} /release/{{ BINARY }} 141 142binary BINARY TARGET : 143rustup target add{{ TARGET }} 144cross build--release --target {{ TARGET }} 145just tar{{ BINARY }} {{ TARGET }} 146just zip{{ BINARY }} {{ TARGET }} 147 148binary_static BINARY TARGET : 149rustup target add{{ TARGET }} 150RUSTFLAGS ='-C target-feature=+crt-static' cross build--release --target {{ TARGET }} 151just tar_static{{ BINARY }} {{ TARGET }} 152just zip_static{{ BINARY }} {{ TARGET }} 153 154checksum : 155@ echo "# Checksums" 156@ echo "## sha256sum" 157@ echo '```' 158@ sha256sum ./target/"bin- $( convco version) " /* 159@ echo '```' 160@ echo "## md5sum" 161@ echo '```' 162@ md5sum ./target/"bin- $( convco version) " /* 163@ echo '```' 164 165alias c := cross 166 167# Generate release binaries for EZA 168# 169# usage: cross 170@ cross : 171# Setup Output Directory 172mkdir -p ./target/"bin- $( convco version) " 173 174# Install Toolchains/Targets 175rustup toolchain install stable 176 177## Linux 178### x86 179just binary eza x86_64-unknown-linux-gnu 180# just binary_static eza x86_64-unknown-linux-gnu 181just binary eza x86_64-unknown-linux-musl 182# just binary_static eza x86_64-unknown-linux-musl 183 184### aarch 185just binary eza aarch64-unknown-linux-gnu 186# BUG: just binary_static eza aarch64-unknown-linux-gnu 187 188### arm 189just binary eza arm-unknown-linux-gnueabihf 190# just binary_static eza arm-unknown-linux-gnueabihf 191 192## MacOS 193# TODO: just binary eza x86_64-apple-darwin 194 195## Windows 196### x86 197just binary eza.exe x86_64-pc-windows-gnu 198# just binary_static eza.exe x86_64-pc-windows-gnu 199# TODO: just binary eza.exe x86_64-pc-windows-gnullvm 200# TODO: just binary eza.exe x86_64-pc-windows-msvc 201 202# Generate Checksums 203# TODO: moved to gh-release just checksum 204 205#---------------------# 206# Integration testing # 207#---------------------# 208 209alias gen := gen_test_dir 210 211test_dir := "tests/test_dir" 212 213gen_test_dir : 214#!/usr/bin/env bash 215rm {{ test_dir }} -rf ; 216mkdir -p {{ test_dir }} 217cd {{ test_dir }} ; 218 219sudo groupadd-f eza_test 220 221# BEGIN grid 222mkdir -p grid 223cd grid 224 225mkdir $( seq -w 001 1000) ; 226seq 0001 1000| split -l 1-a 3-d - file_ 227 228# Set time to unix epoch 229touch --date=@0 *; 230 231cd .. 232 233# END grid 234 235# BEGIN git 236 237mkdir -p git 238cd git 239 240mkdir $( seq -w 001 10) ; 241for f in ./* 242do 243cd $ f 244git init 245seq 01 10| split -l 1-a 3-d - file_ 246cd .. 247done 248 249cd .. 250 251# END git 252 253# BEGIN test_root 254 255sudo mkdir root 256sudo chmod 777 root 257sudo mkdir root/empty 258 259# END test_root 260 261# BEGIN mknod 262 263mkdir -p specials 264 265sudo mknod specials/block-device b 3 60 266sudo mknod specials/char-device c 14 40 267sudo mknod specials/named-pipe p 268 269# END test_root 270 271# BEGIN test_symlinks 272 273mkdir -p symlinks 274touch symlinks/file--date=@0 275ln -s file symlinks/symlink 276ln -s symlink symlinks/symlink2 277mkdir -p symlinks/dir 278ln -s dir symlinks/symlink3 279ln -s pipitek symlinks/symlink4 280 281# END test_symlinks 282 283# BEGIN test_perms 284 285mkdir -p perms 286touch perms/file--date=@0 287touch perms/file2--date=@0 288chmod 777 perms/file 289chmod 001 perms/file2 290 291# END test_perms 292 293# BEGIN test_group 294mkdir -p group 295touch group/file--date=@0 296sudo chgrp eza_test group/file 297# END test_group 298 299# BEGIN test_size 300mkdir -p size 301touch size/1M--date=@0 302dd if=/dev/zero of=size/1M bs=1 count=0 seek=1M 303touch size/1K--date=@0 304dd if=/dev/zero of=size/1K bs=1 count=0 seek=1K 305touch size/1B--date=@0 306dd if=/dev/zero of=size/1B bs=1 count=0 seek=1 307touch size/1337--date=@0 308dd if=/dev/zero of=size/1337 bs=1 count=0 seek=1337 309# END test_size 310 311# BEGIN test_time 312mkdir -p time 313touch time/epoch--date=@0 314touch time/1s--date=@1 315touch time/1m--date=@60 316touch time/1h--date=@3600 317touch time/1d--date=@86400 318touch time/1y--date=@31536000 319# END test_time 320 321# BEGIN test_icons 322mkdir -p icons 323touch icons/file--date=@0 324touch icons/go.go--date=@0 325touch icons/rust.rs--date=@0 326touch icons/c.c--date=@0 327touch icons/c++.cpp--date=@0 328touch icons/python.py--date=@0 329touch icons/java.java--date=@0 330touch icons/javascript.js--date=@0 331touch icons/html.html--date=@0 332touch icons/css.css--date=@0 333touch icons/php.php--date=@0 334touch icons/ruby.rb--date=@0 335touch icons/shell.sh--date=@0 336touch icons/unknown.unknown--date=@0 337touch icons/man.1--date=@0 338touch icons/marked.md--date=@0 339# END test_icons 340 341eza -l --grid ; 342 343# Runs integration tests in nix sandbox 344# 345# Required nix, likely won't work on windows. 346@ itest : 347nix build-L ./#trycmd-local 348 349# Runs integration tests in nix sandbox, and dumps outputs. 350# 351# WARNING: this can cause loss of work 352@ idump : 353rm ./tests/cmd/*nix.stderr-f ||echo 354rm ./tests/cmd/*nix.stdout-f ||echo 355nix build-L ./#trydump 356cp ./result/dump/*nix.* ./tests/cmd/