fork/eza

git clone https://git.julia.blue/fork/eza

Christina Sørensenfeat(docs): demo gif and gif generation recipe0c75e4cc

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