fork/eza

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

Christina Sørensenbuild: sign release tags7b813751

v0.16.1
6.9 KiB244 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 --sign -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    git push origin "v{{new_version}}"
128    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)"/*
129
130#----------------#
131#    binaries    #
132#----------------#
133
134tar BINARY TARGET:
135    tar czvf ./target/"bin-$(convco version)"/{{BINARY}}_{{TARGET}}.tar.gz -C ./target/{{TARGET}}/release/ ./{{BINARY}}
136
137zip BINARY TARGET:
138    zip -j ./target/"bin-$(convco version)"/{{BINARY}}_{{TARGET}}.zip ./target/{{TARGET}}/release/{{BINARY}}
139
140tar_static BINARY TARGET:
141    tar czvf ./target/"bin-$(convco version)"/{{BINARY}}_{{TARGET}}_static.tar.gz -C ./target/{{TARGET}}/release/ ./{{BINARY}}
142
143zip_static BINARY TARGET:
144    zip -j ./target/"bin-$(convco version)"/{{BINARY}}_{{TARGET}}_static.zip ./target/{{TARGET}}/release/{{BINARY}}
145
146binary BINARY TARGET:
147    rustup target add {{TARGET}}
148    cross build --release --target {{TARGET}}
149    just tar {{BINARY}} {{TARGET}}
150    just zip {{BINARY}} {{TARGET}}
151
152binary_static BINARY TARGET:
153    rustup target add {{TARGET}}
154    RUSTFLAGS='-C target-feature=+crt-static' cross build --release --target {{TARGET}}
155    just tar_static {{BINARY}} {{TARGET}}
156    just zip_static {{BINARY}} {{TARGET}}
157
158checksum:
159    @echo "# Checksums"
160    @echo "## sha256sum"
161    @echo '```'
162    @sha256sum ./target/"bin-$(convco version)"/*
163    @echo '```'
164    @echo "## md5sum"
165    @echo '```'
166    @md5sum ./target/"bin-$(convco version)"/*
167    @echo '```'
168
169alias c := cross
170
171# Generate release binaries for EZA
172#
173# usage: cross
174@cross:
175    # Setup Output Directory
176    mkdir -p ./target/"bin-$(convco version)"
177
178    # Install Toolchains/Targets
179    rustup toolchain install stable
180
181    ## Linux
182    ### x86
183    just binary eza x86_64-unknown-linux-gnu
184    # just binary_static eza x86_64-unknown-linux-gnu
185    just binary eza x86_64-unknown-linux-musl
186    # just binary_static eza x86_64-unknown-linux-musl
187
188    ### aarch
189    just binary eza aarch64-unknown-linux-gnu
190    # BUG: just binary_static eza aarch64-unknown-linux-gnu
191
192    ### arm
193    just binary eza arm-unknown-linux-gnueabihf
194    # just binary_static eza arm-unknown-linux-gnueabihf
195
196    ## MacOS
197    # TODO: just binary eza x86_64-apple-darwin
198
199    ## Windows
200    ### x86
201    just binary eza.exe x86_64-pc-windows-gnu
202    # just binary_static eza.exe x86_64-pc-windows-gnu
203    # TODO: just binary eza.exe x86_64-pc-windows-gnullvm
204    # TODO: just binary eza.exe x86_64-pc-windows-msvc
205
206    # Generate Checksums
207    # TODO: moved to gh-release just checksum
208
209#---------------------#
210# Integration testing #
211#---------------------#
212
213alias gen := gen_test_dir
214
215test_dir := "tests/test_dir"
216
217gen_test_dir:
218    bash devtools/dir-generator.sh {{ test_dir }}
219
220# Runs integration tests in nix sandbox
221#
222# Required nix, likely won't work on windows.
223@itest:
224    nix build -L ./#trycmd-local
225
226# Runs integration tests in nix sandbox, and dumps outputs.
227#
228# WARNING: this can cause loss of work
229@idump:
230    rm ./tests/gen/*_nix.stderr -f || echo
231    rm ./tests/gen/*_nix.stdout -f || echo
232    rm ./tests/gen/*_unix.stderr -f || echo
233    rm ./tests/gen/*_unix.stdout -f || echo
234    rm ./tests/ptests/ptest_*.stderr -f || echo  
235    rm ./tests/ptests/ptest_*.stdout -f || echo
236
237    nix build -L ./#trydump
238
239    cp ./result/dump/*nix.* ./tests/cmd/
240    cp ./result/dump/*.std* ./tests/gen/
241    cp ./result/dump/ptest_*.* ./tests/ptests/
242
243@itest-gen:
244    nix build -L ./#trycmd