| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356 |
- all: build test
- all-release: build-release test-release
- #----------#
- # building #
- #----------#
- # compile the exa binary
- @build:
- cargo build
- # compile the exa binary (in release mode)
- @build-release:
- cargo build --release --verbose
- # produce an HTML chart of compilation timings
- @build-time:
- cargo +nightly clean
- cargo +nightly build -Z timings
- # check that the exa binary can compile
- @check:
- cargo check
- #---------------#
- # running tests #
- #---------------#
- # run unit tests
- @test:
- cargo test --workspace -- --quiet
- # run unit tests (in release mode)
- @test-release:
- cargo test --workspace --release --verbose
- #-----------------------#
- # code quality and misc #
- #-----------------------#
- # lint the code
- @clippy:
- touch src/main.rs
- cargo clippy
- # update dependency versions, and checks for outdated ones
- @update-deps:
- cargo update
- command -v cargo-outdated >/dev/null || (echo "cargo-outdated not installed" && exit 1)
- cargo outdated
- # list unused dependencies
- @unused-deps:
- command -v cargo-udeps >/dev/null || (echo "cargo-udeps not installed" && exit 1)
- cargo +nightly udeps
- # check that every combination of feature flags is successful
- @check-features:
- command -v cargo-hack >/dev/null || (echo "cargo-hack not installed" && exit 1)
- cargo hack check --feature-powerset
- # print versions of the necessary build tools
- @versions:
- rustc --version
- cargo --version
- #---------------#
- # documentation #
- #---------------#
- # build the man pages
- @man:
- mkdir -p "${CARGO_TARGET_DIR:-target}/man"
- version=$(awk 'BEGIN { FS = "\"" } ; /^version/ { print $2 ; exit }' Cargo.toml); \
- for page in eza.1 eza_colors.5 eza_colors-explanation.5; do \
- sed "s/\$version/v${version}/g" "man/${page}.md" | pandoc --standalone -f markdown -t man > "${CARGO_TARGET_DIR:-target}/man/${page}"; \
- done;
- # build and preview the main man page (eza.1)
- @man-1-preview: man
- man "${CARGO_TARGET_DIR:-target}/man/eza.1"
- # build and preview the colour configuration man page (eza_colors.5)
- @man-5-preview: man
- man "${CARGO_TARGET_DIR:-target}/man/eza_colors.5"
- # build and preview the colour configuration man page (eza_colors.5)
- @man-5-explanations-preview: man
- man "${CARGO_TARGET_DIR:-target}/man/eza_colors-explanation.5"
- #---------------#
- # release #
- #---------------#
- new_version := "$(convco version --bump)"
- # If you're not cafkafk and she isn't dead, don't run this!
- #
- # usage: release major, release minor, release patch
- release:
- cargo bump "{{new_version}}"
- git cliff -t "{{new_version}}" > CHANGELOG.md
- cargo check
- nix build -L ./#clippy
- git checkout -b "cafk-release-v{{new_version}}"
- git commit -asm "chore: release eza v{{new_version}}"
- git push
- @echo "waiting 10 seconds for github to catch up..."
- sleep 10
- gh pr create --draft --title "chore: release v{{new_version}}" --body "This PR was auto-generated by our lovely just file" --reviewer cafkafk
- @echo "Now go review that and come back and run gh-release"
- @gh-release:
- git tag -d "v{{new_version}}" || echo "tag not found, creating";
- git tag -a "v{{new_version}}" -m "auto generated by the justfile for eza v$(convco version)"
- just cross
- mkdir -p ./target/"release-notes-$(convco version)"
- git cliff -t "v$(convco version)" --current > ./target/"release-notes-$(convco version)/RELEASE.md"
- just checksum >> ./target/"release-notes-$(convco version)/RELEASE.md"
- gh 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)"/*
- #----------------#
- # binaries #
- #----------------#
- tar BINARY TARGET:
- tar czvf ./target/"bin-$(convco version)"/{{BINARY}}_{{TARGET}}.tar.gz -C ./target/{{TARGET}}/release/ ./{{BINARY}}
- zip BINARY TARGET:
- zip -j ./target/"bin-$(convco version)"/{{BINARY}}_{{TARGET}}.zip ./target/{{TARGET}}/release/{{BINARY}}
- tar_static BINARY TARGET:
- tar czvf ./target/"bin-$(convco version)"/{{BINARY}}_{{TARGET}}_static.tar.gz -C ./target/{{TARGET}}/release/ ./{{BINARY}}
- zip_static BINARY TARGET:
- zip -j ./target/"bin-$(convco version)"/{{BINARY}}_{{TARGET}}_static.zip ./target/{{TARGET}}/release/{{BINARY}}
- binary BINARY TARGET:
- rustup target add {{TARGET}}
- cross build --release --target {{TARGET}}
- just tar {{BINARY}} {{TARGET}}
- just zip {{BINARY}} {{TARGET}}
- binary_static BINARY TARGET:
- rustup target add {{TARGET}}
- RUSTFLAGS='-C target-feature=+crt-static' cross build --release --target {{TARGET}}
- just tar_static {{BINARY}} {{TARGET}}
- just zip_static {{BINARY}} {{TARGET}}
- checksum:
- @echo "# Checksums"
- @echo "## sha256sum"
- @echo '```'
- @sha256sum ./target/"bin-$(convco version)"/*
- @echo '```'
- @echo "## md5sum"
- @echo '```'
- @md5sum ./target/"bin-$(convco version)"/*
- @echo '```'
- alias c := cross
- # Generate release binaries for EZA
- #
- # usage: cross
- @cross:
- # Setup Output Directory
- mkdir -p ./target/"bin-$(convco version)"
- # Install Toolchains/Targets
- rustup toolchain install stable
- ## Linux
- ### x86
- just binary eza x86_64-unknown-linux-gnu
- # just binary_static eza x86_64-unknown-linux-gnu
- just binary eza x86_64-unknown-linux-musl
- # just binary_static eza x86_64-unknown-linux-musl
- ### aarch
- just binary eza aarch64-unknown-linux-gnu
- # BUG: just binary_static eza aarch64-unknown-linux-gnu
- ### arm
- just binary eza arm-unknown-linux-gnueabihf
- # just binary_static eza arm-unknown-linux-gnueabihf
- ## MacOS
- # TODO: just binary eza x86_64-apple-darwin
- ## Windows
- ### x86
- just binary eza.exe x86_64-pc-windows-gnu
- # just binary_static eza.exe x86_64-pc-windows-gnu
- # TODO: just binary eza.exe x86_64-pc-windows-gnullvm
- # TODO: just binary eza.exe x86_64-pc-windows-msvc
- # Generate Checksums
- # TODO: moved to gh-release just checksum
- #---------------------#
- # Integration testing #
- #---------------------#
- alias gen := gen_test_dir
- test_dir := "tests/test_dir"
- gen_test_dir:
- #!/usr/bin/env bash
- rm {{test_dir}} -rf;
- mkdir -p {{test_dir}}
- cd {{test_dir}};
- sudo groupadd -f eza_test
- # BEGIN grid
- mkdir -p grid
- cd grid
- mkdir $(seq -w 001 1000);
- seq 0001 1000 | split -l 1 -a 3 -d - file_
- # Set time to unix epoch
- touch --date=@0 *;
- cd ..
- # END grid
- # BEGIN git
- mkdir -p git
- cd git
- mkdir $(seq -w 001 10);
- for f in ./*
- do
- cd $f
- git init
- seq 01 10 | split -l 1 -a 3 -d - file_
- cd ..
- done
- cd ..
- # END git
- # BEGIN test_root
- sudo mkdir root
- sudo chmod 777 root
- sudo mkdir root/empty
- # END test_root
- # BEGIN mknod
- mkdir -p specials
- sudo mknod specials/block-device b 3 60
- sudo mknod specials/char-device c 14 40
- sudo mknod specials/named-pipe p
- # END test_root
- # BEGIN test_symlinks
- mkdir -p symlinks
- touch symlinks/file --date=@0
- ln -s file symlinks/symlink
- ln -s symlink symlinks/symlink2
- mkdir -p symlinks/dir
- ln -s dir symlinks/symlink3
- ln -s pipitek symlinks/symlink4
- # END test_symlinks
- # BEGIN test_perms
- mkdir -p perms
- touch perms/file --date=@0
- touch perms/file2 --date=@0
- chmod 777 perms/file
- chmod 001 perms/file2
- # END test_perms
- # BEGIN test_group
- mkdir -p group
- touch group/file --date=@0
- sudo chgrp eza_test group/file
- # END test_group
- # BEGIN test_size
- mkdir -p size
- touch size/1M --date=@0
- dd if=/dev/zero of=size/1M bs=1 count=0 seek=1M
- touch size/1K --date=@0
- dd if=/dev/zero of=size/1K bs=1 count=0 seek=1K
- touch size/1B --date=@0
- dd if=/dev/zero of=size/1B bs=1 count=0 seek=1
- touch size/1337 --date=@0
- dd if=/dev/zero of=size/1337 bs=1 count=0 seek=1337
- # END test_size
-
- # BEGIN test_time
- mkdir -p time
- touch time/epoch --date=@0
- touch time/1s --date=@1
- touch time/1m --date=@60
- touch time/1h --date=@3600
- touch time/1d --date=@86400
- touch time/1y --date=@31536000
- # END test_time
- # BEGIN test_icons
- mkdir -p icons
- touch icons/file --date=@0
- touch icons/go.go --date=@0
- touch icons/rust.rs --date=@0
- touch icons/c.c --date=@0
- touch icons/c++.cpp --date=@0
- touch icons/python.py --date=@0
- touch icons/java.java --date=@0
- touch icons/javascript.js --date=@0
- touch icons/html.html --date=@0
- touch icons/css.css --date=@0
- touch icons/php.php --date=@0
- touch icons/ruby.rb --date=@0
- touch icons/shell.sh --date=@0
- touch icons/unknown.unknown --date=@0
- touch icons/man.1 --date=@0
- touch icons/marked.md --date=@0
- # END test_icons
- eza -l --grid;
- # Runs integration tests in nix sandbox
- #
- # Required nix, likely won't work on windows.
- @itest:
- nix build -L ./#trycmd-local
- # Runs integration tests in nix sandbox, and dumps outputs.
- #
- # WARNING: this can cause loss of work
- @idump:
- rm ./tests/cmd/*nix.stderr -f || echo
- rm ./tests/cmd/*nix.stdout -f || echo
- nix build -L ./#trydump
- cp ./result/dump/*nix.* ./tests/cmd/
|