fork/eza

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

Christina Sørensenchore: eza v0.22.1 changelogs, version bumpa362025d

main
11.2 KiB354 linesraw
1# SPDX-FileCopyrightText: 2024 Christina Sørensen
2# SPDX-License-Identifier: EUPL-1.2
3_default:
4    @just -l
5
6all: build test
7all-release: build-release test-release
8
9[group('house-keeping')]
10genDemo:
11    fish_prompt="> " fish_history="eza_history" vhs < docs/tapes/demo.tape
12    nsxiv -a docs/images/demo.gif
13
14#----------#
15# building #
16#----------#
17
18# compile the exa binary
19[group('building')]
20@build:
21    cargo build
22
23# compile the exa binary (in release mode)
24[group('building')]
25@build-release:
26    cargo build --release --verbose
27
28# produce an HTML chart of compilation timings
29[group('building')]
30@build-time:
31    cargo +nightly clean
32    cargo +nightly build -Z timings
33
34# check that the exa binary can compile
35[group('building')]
36@check:
37    cargo check
38
39
40#---------------#
41# running tests #
42#---------------#
43
44# run unit tests
45[group('testing')]
46@test:
47    cargo test --workspace -- --quiet
48
49# run unit tests (in release mode)
50[group('testing')]
51@test-release:
52    cargo test --workspace --release --verbose
53
54#-----------------------#
55# code quality and misc #
56#-----------------------#
57
58# lint the code
59[group('house-keeping')]
60@clippy:
61    touch src/main.rs
62    cargo clippy
63
64# update dependency versions, and checks for outdated ones
65[group('house-keeping')]
66@update-deps:
67    cargo update
68    command -v cargo-outdated >/dev/null || (echo "cargo-outdated not installed" && exit 1)
69    cargo outdated
70
71# list unused dependencies
72[group('house-keeping')]
73@unused-deps:
74    command -v cargo-udeps >/dev/null || (echo "cargo-udeps not installed" && exit 1)
75    cargo +nightly udeps
76
77# check that every combination of feature flags is successful
78[group('house-keeping')]
79@check-features:
80    command -v cargo-hack >/dev/null || (echo "cargo-hack not installed" && exit 1)
81    cargo hack check --feature-powerset
82
83# print versions of the necessary build tools
84[group('house-keeping')]
85@versions:
86    rustc --version
87    cargo --version
88
89
90#---------------#
91# documentation #
92#---------------#
93
94# build the man pages
95[group('documentation')]
96@man:
97    mkdir -p "${CARGO_TARGET_DIR:-target}/man"
98    version=$(awk 'BEGIN { FS = "\"" } ; /^version/ { print $2 ; exit }' Cargo.toml); \
99    for page in eza.1 eza_colors.5 eza_colors-explanation.5; do \
100        sed "s/\$version/v${version}/g" "man/${page}.md" | pandoc --standalone -f markdown -t man > "${CARGO_TARGET_DIR:-target}/man/${page}"; \
101    done;
102
103# build and preview the main man page (eza.1)
104[group('documentation')]
105@man-1-preview: man
106    man "${CARGO_TARGET_DIR:-target}/man/eza.1"
107
108# build and preview the colour configuration man page (eza_colors.5)
109[group('documentation')]
110@man-5-preview: man
111    man "${CARGO_TARGET_DIR:-target}/man/eza_colors.5"
112
113# build and preview the colour configuration man page (eza_colors.5)
114[group('documentation')]
115@man-5-explanations-preview: man
116    man "${CARGO_TARGET_DIR:-target}/man/eza_colors-explanation.5"
117
118#---------------#
119#    release    #
120#---------------#
121
122# To override the version, pass it as an argument before the recipe:
123# e.g. just version=1.2.3 release
124# If version is not set, it will be determined by convco.
125version := ""
126new_version := if version == "" { "$(convco version --bump)" } else { version }
127
128# If you're not cafkafk and she isn't dead, don't run this!
129#
130# usage: release major, release minor, release patch
131[group('release')]
132release:
133    cargo bump "{{new_version}}"
134    git cliff -c .config/cliff.toml -t "{{new_version}}" > CHANGELOG.md
135    cargo check
136    nix build -L ./#clippy
137    git checkout -b "cafk-release-v{{new_version}}"
138    git commit -asm "chore: eza v{{new_version}} changelogs, version bump"
139    git push
140    @echo "waiting 10 seconds for github to catch up..."
141    sleep 10
142    gh pr create --draft --title "chore: release v{{new_version}}" --body "This PR was auto-generated by our lovely just file" --reviewer cafkafk
143    @echo "Now go review that and come back and run gh-release"
144
145[group('release')]
146@gh-release:
147    git tag -d "v{{new_version}}" || echo "tag not found, creating";
148    git tag --sign -a "v{{new_version}}" -m "auto generated by the justfile for eza v$(convco version)"
149    just cross
150    just mangen
151    just completions
152    mkdir -p ./target/"release-notes-$(convco version)"
153    git cliff -c .config/cliff.toml -t "v$(convco version)" --current > ./target/"release-notes-$(convco version)/RELEASE.md"
154    just checksum >> ./target/"release-notes-$(convco version)/RELEASE.md"
155
156    git push origin "v{{new_version}}"
157    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)"/* ./target/"man-$(convco version).tar.gz" ./target/"completions-$(convco version).tar.gz"
158
159#----------------#
160#    binaries    #
161#----------------#
162
163# TODO: make static/no_static DRY
164# TODO: add name prefix/suffix arguments
165
166[group('binaries')]
167tar BINARY TARGET:
168    tar czvf ./target/"bin-$(convco version)"/{{BINARY}}_{{TARGET}}.tar.gz -C ./target/{{TARGET}}/release/ ./{{BINARY}}
169
170[group('binaries')]
171zip BINARY TARGET:
172    zip -j ./target/"bin-$(convco version)"/{{BINARY}}_{{TARGET}}.zip ./target/{{TARGET}}/release/{{BINARY}}
173
174[group('binaries')]
175tar_static BINARY TARGET:
176    tar czvf ./target/"bin-$(convco version)"/{{BINARY}}_{{TARGET}}_static.tar.gz -C ./target/{{TARGET}}/release/ ./{{BINARY}}
177
178[group('binaries')]
179zip_static BINARY TARGET:
180    zip -j ./target/"bin-$(convco version)"/{{BINARY}}_{{TARGET}}_static.zip ./target/{{TARGET}}/release/{{BINARY}}
181
182[group('binaries')]
183tar_no_libgit BINARY TARGET:
184    tar czvf ./target/"bin-$(convco version)"/{{BINARY}}_{{TARGET}}_no_libgit.tar.gz -C ./target/{{TARGET}}/release/ ./{{BINARY}}
185
186[group('binaries')]
187zip_no_libgit BINARY TARGET:
188    zip -j ./target/"bin-$(convco version)"/{{BINARY}}_{{TARGET}}_no_libgit.zip ./target/{{TARGET}}/release/{{BINARY}}
189
190[group('binaries')]
191tar_static_no_libgit BINARY TARGET:
192    tar czvf ./target/"bin-$(convco version)"/{{BINARY}}_{{TARGET}}_static_no_libgit.tar.gz -C ./target/{{TARGET}}/release/ ./{{BINARY}}
193
194[group('binaries')]
195zip_static_no_libgit BINARY TARGET:
196    zip -j ./target/"bin-$(convco version)"/{{BINARY}}_{{TARGET}}_static_no_libgit.zip ./target/{{TARGET}}/release/{{BINARY}}
197
198[group('binaries')]
199binary BINARY TARGET:
200    rustup target add {{TARGET}}
201    cross build --release --target {{TARGET}}
202    just tar {{BINARY}} {{TARGET}}
203    just zip {{BINARY}} {{TARGET}}
204
205[group('binaries')]
206binary_static BINARY TARGET:
207    rustup target add {{TARGET}}
208    RUSTFLAGS='-C target-feature=+crt-static' cross build --release --target {{TARGET}}
209    just tar_static {{BINARY}} {{TARGET}}
210    just zip_static {{BINARY}} {{TARGET}}
211
212[group('binaries')]
213binary_no_libgit BINARY TARGET:
214    rustup target add {{TARGET}}
215    cross build --no-default-features --release --target {{TARGET}}
216    just tar_no_libgit {{BINARY}} {{TARGET}}
217    just zip_no_libgit {{BINARY}} {{TARGET}}
218
219[group('binaries')]
220binary_static_no_libgit BINARY TARGET:
221    rustup target add {{TARGET}}
222    RUSTFLAGS='-C target-feature=+crt-static' cross build --no-default-features --release --target {{TARGET}}
223    just tar_static_no_libgit {{BINARY}} {{TARGET}}
224    just zip_static_no_libgit {{BINARY}} {{TARGET}}
225
226[group('binaries')]
227checksum:
228    @echo "# Checksums"
229    @echo "## sha256sum"
230    @echo '```'
231    @sha256sum ./target/"bin-$(convco version)"/*
232    @echo '```'
233    @echo "## md5sum"
234    @echo '```'
235    @md5sum ./target/"bin-$(convco version)"/*
236    @echo '```'
237    @echo "## blake3sum"
238    @echo '```'
239    @b3sum ./target/"bin-$(convco version)"/*
240    @echo '```'
241
242alias c := cross
243
244# Generate release binaries for EZA
245#
246# usage: cross
247[group('binaries')]
248@cross:
249    # Setup Output Directory
250    mkdir -p ./target/"bin-$(convco version)"
251
252    # Install Toolchains/Targets
253    rustup toolchain install stable
254
255    ## Linux
256    ### x86
257    just binary eza x86_64-unknown-linux-gnu
258    # just binary_static eza x86_64-unknown-linux-gnu
259    just binary eza x86_64-unknown-linux-musl
260    # just binary_static eza x86_64-unknown-linux-musl
261
262    ### aarch
263    just binary eza aarch64-unknown-linux-gnu
264    just binary_no_libgit eza aarch64-unknown-linux-gnu
265    # BUG: just binary_static eza aarch64-unknown-linux-gnu
266
267    ### arm
268    just binary eza arm-unknown-linux-gnueabihf
269    just binary_no_libgit eza arm-unknown-linux-gnueabihf
270    # just binary_static eza arm-unknown-linux-gnueabihf
271
272    ## MacOS
273    # TODO: just binary eza x86_64-apple-darwin
274
275    ## Windows
276    ### x86
277    just binary eza.exe x86_64-pc-windows-gnu
278    # just binary_static eza.exe x86_64-pc-windows-gnu
279    # TODO: just binary eza.exe x86_64-pc-windows-gnullvm
280    # TODO: just binary eza.exe x86_64-pc-windows-msvc
281
282    # Generate Checksums
283    # TODO: moved to gh-release just checksum
284
285[group('documentation')]
286@mangen:
287    # Setup Output Directory
288    mkdir -p ./target/"man-$(convco version)"
289    pandoc --standalone -f markdown -t man man/eza.1.md > ./target/"man-$(convco version)"/eza.1
290    pandoc --standalone -f markdown -t man man/eza_colors.5.md > ./target/"man-$(convco version)"/eza_colors.5
291    pandoc --standalone -f markdown -t man man/eza_colors-explanation.5.md > ./target/"man-$(convco version)"/eza_colors-explanation.5
292    tar czvf ./target/"man-$(convco version)".tar.gz ./target/"man-$(convco version)"
293
294[group('documentation')]
295[group('binaries')]
296@completions:
297    # Setup Output Directory
298    mkdir -p ./target/"completions-$(convco version)"
299    cp completions/*/* ./target/"completions-$(convco version)"/
300    tar czvf ./target/"completions-$(convco version)".tar.gz ./target/"completions-$(convco version)"
301
302
303#---------------------#
304# Integration testing #
305#---------------------#
306
307alias gen := gen_test_dir
308
309test_dir := "tests/test_dir"
310
311[group('testing')]
312gen_test_dir:
313    bash devtools/dir-generator.sh {{ test_dir }}
314
315# Runs integration tests in nix sandbox
316#
317# Required nix, likely won't work on windows.
318[group('testing')]
319@itest:
320    nix build -L ./#trycmd-local
321
322# Runs integration tests in nix sandbox, and dumps outputs.
323#
324# WARNING: this can cause loss of work
325[group('testing')]
326@idump:
327    rm ./tests/gen/*_nix.stderr -f || echo
328    rm ./tests/gen/*_nix.stdout -f || echo
329    rm ./tests/gen/*_unix.stderr -f || echo
330    rm ./tests/gen/*_unix.stdout -f || echo
331    rm ./tests/ptests/ptest_*.stderr -f || echo
332    rm ./tests/ptests/ptest_*.stdout -f || echo
333
334    nix build -L ./#trydump
335
336    find result/dump -type f \( -name "*.stdout" -o -name "*.stderr" \) -exec sh -c 'base=$(basename {}); if [ -e "tests/gen/${base%.*}.toml" ]; then cp {} tests/gen/; elif [ -e "tests/cmd/${base%.*}.toml" ]; then cp {} tests/cmd/; elif [ -e "tests/ptests/${base%.*}.toml" ]; then cp {} tests/ptests/; fi' \;
337
338[group('testing')]
339@itest-gen:
340    nix build -L ./#trycmd
341
342# Fully re-generates the integration tests using powertest
343[group('testing')]
344@regen:
345    which powertest >&- 2>&- || (echo -e "Powertest not installed. Please Clone the repo and run:\n\tcargo install --path . --locked" && exit 1)
346    echo "WARNING: this will delete all tests in tests/ptest"
347    sleep 5
348    echo "Deleting tests/ptests"
349    rm -rf tests/ptests
350    echo "Generating tests/ptests"
351    powertest
352    nix build -L ./#trydump
353    find result/dump -type f \( -name "*.stdout" -o -name "*.stderr" \) -exec sh -c 'base=$(basename {}); if [ -e "tests/ptests/${base%.*}.toml" ]; then cp {} tests/ptests/; fi' \;
354