@@ -265,6 +265,8 @@ jobs:
265265 build_makefile :
266266 name : Build/Makefile
267267 needs : [ min_version, deps ]
268+ permissions :
269+ contents : write # Publish individual binaries
268270 runs-on : ${{ matrix.job.os }}
269271 env :
270272 SCCACHE_GHA_ENABLED : " true"
@@ -338,6 +340,8 @@ jobs:
338340 ! test -f /tmp/usr/local/share/zsh/site-functions/_uu-install
339341 ! test -f /tmp/usr/local/share/bash-completion/completions/uu-head.bash
340342 ! test -f /tmp/usr/local/share/fish/vendor_completions.d/uu-cat.fish
343+ # don't publish them
344+ make uninstall PROG_PREFIX=uu- PROFILE=release-small COMPLETIONS=n MANPAGES=n LOCALES=n
341345 env :
342346 RUST_BACKTRACE : " 1"
343347 - name : " `make install`"
@@ -368,24 +372,119 @@ jobs:
368372 ! test -f /tmp/usr/local/share/zsh/site-functions/_install
369373 ! test -f /tmp/usr/local/share/bash-completion/completions/head.bash
370374 ! test -f /tmp/usr/local/share/fish/vendor_completions.d/cat.fish
371- - name : " `make install MULTICALL=n `"
375+ - name : " `make install MULTICALL=y LN=ln -svf `"
372376 shell : bash
373377 run : |
374378 set -x
375- DESTDIR=/tmp/ make PROFILE=release MULTICALL=n install
376- # Check that *sum are present
379+ DESTDIR=/tmp make PROFILE=release MULTICALL=y LN="ln -svf" install
380+ # Check that symlinks of *sum are present
377381 for s in {md5,b2,sha1,sha224,sha256,sha384,sha512}sum
378- do test -e /tmp/usr/local/bin/${s}
382+ do test $(readlink /tmp/usr/local/bin/${s}) = coreutils
379383 done
380- - name : " `make install MULTICALL=y LN=ln -svf `"
384+ - name : " `make install MULTICALL=n `"
381385 shell : bash
382386 run : |
383387 set -x
384- DESTDIR=/tmp/ make PROFILE=release MULTICALL=y LN="ln -svf" install
385- # Check that symlinks of *sum are present
388+ # cargo should not rebuild them. Thus, timeout 20 should pass
389+ LIBSTDBUF_DIR=/tmp/usr/local/bin DESTDIR=/tmp/ timeout 20 make PROFILE=release MULTICALL=n install
390+ # Check that *sum are present
386391 for s in {md5,b2,sha1,sha224,sha256,sha384,sha512}sum
387- do test $(readlink /tmp/usr/local/bin/${s}) = coreutils
392+ do test -e /tmp/usr/local/bin/${s}
388393 done
394+ - name : Package
395+ shell : bash
396+ run : |
397+ strip -s /tmp/usr/local/bin/*
398+ mv /tmp/usr/local/bin/coreutils coreutils
399+ ZSTD_CLEVEL=19 tar --zstd -caf individual-x86_64-unknown-linux-gnu.tar.zst -C /tmp/usr/local bin
400+ - name : Publish
401+ uses : softprops/action-gh-release@v2
402+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
403+ with :
404+ tag_name : latest-commit
405+ draft : false
406+ prerelease : true
407+ files : |
408+ individual-x86_64-unknown-linux-gnu.tar.zst
409+ env :
410+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
411+ - name : Compute uutil release sizes
412+ shell : bash
413+ run : |
414+ ## Compute uutil release sizes
415+ DATE=$(date --rfc-email)
416+ find /tmp/usr/local/bin -type f -printf '%f\0' | sort -z |
417+ while IFS= read -r -d '' name; do
418+ size=$(du -s /tmp/usr/local/bin/$name | awk '{print $1}')
419+ echo "\"$name\""
420+ echo "$size"
421+ done | \
422+ jq -n \
423+ --arg date "$DATE" \
424+ --arg sha "$GITHUB_SHA" \
425+ 'reduce inputs as $name ({}; . + { ($name): input }) | { ($date): {sha: $sha, sizes: map_values(.)} }' > individual-size-result.json
426+ SIZE=$(cat individual-size-result.json | jq '[.[] | .sizes | .[]] | reduce .[] as $num (0; . + $num)')
427+ SIZE_MULTI=$(du -s coreutils | awk '{print $1}')
428+ jq -n \
429+ --arg date "$DATE" \
430+ --arg sha "$GITHUB_SHA" \
431+ --arg size "$SIZE" \
432+ --arg multisize "$SIZE_MULTI" \
433+ '{($date): { sha: $sha, size: $size, multisize: $multisize, }}' > size-result.json
434+ - name : Download the previous individual size result
435+ uses : dawidd6/action-download-artifact@v14
436+ with :
437+ workflow : CICD.yml
438+ name : individual-size-result
439+ repo : uutils/coreutils
440+ path : dl
441+ - name : Download the previous size result
442+ uses : dawidd6/action-download-artifact@v14
443+ with :
444+ workflow : CICD.yml
445+ name : size-result
446+ repo : uutils/coreutils
447+ path : dl
448+ - name : Check uutil release sizes
449+ shell : bash
450+ run : |
451+ check() {
452+ # Warn if the size increases by more than 5%
453+ threshold='1.05'
454+
455+ if [[ "$2" -eq 0 || "$3" -eq 0 ]]; then
456+ echo "::warning file=$4::Invalid size for $1. Sizes cannot be 0."
457+ return
458+ fi
459+
460+ ratio=$(jq -n "$2 / $3")
461+ echo "$1: size=$2, previous_size=$3, ratio=$ratio, threshold=$threshold"
462+ if [[ "$(jq -n "$ratio > $threshold")" == 'true' ]]; then
463+ echo "::warning file=$4::Size of $1 increases by more than 5%"
464+ fi
465+ }
466+ ## Check individual size result
467+ while read -r name previous_size; do
468+ size=$(cat individual-size-result.json | jq -r ".[] | .sizes | .\"$name\"")
469+ check "\`$name\` binary" "$size" "$previous_size" 'individual-size-result.json'
470+ done < <(cat dl/individual-size-result.json | jq -r '.[] | .sizes | to_entries[] | "\(.key) \(.value)"')
471+ ## Check size result
472+ size=$(cat size-result.json | jq -r '.[] | .size')
473+ previous_size=$(cat dl/size-result.json | jq -r '.[] | .size')
474+ check 'multiple binaries' "$size" "$previous_size" 'size-result.json'
475+ multisize=$(cat size-result.json | jq -r '.[] | .multisize')
476+ previous_multisize=$(cat dl/size-result.json | jq -r '.[] | .multisize')
477+ check 'multicall binary' "$multisize" "$previous_multisize" 'size-result.json'
478+ - name : Upload the individual size result
479+ uses : actions/upload-artifact@v6
480+ with :
481+ name : individual-size-result
482+ path : individual-size-result.json
483+ - name : Upload the size result
484+ uses : actions/upload-artifact@v6
485+ with :
486+ name : size-result
487+ path : size-result.json
389488 - name : " `make UTILS=XXX`"
390489 shell : bash
391490 run : |
@@ -478,130 +577,6 @@ jobs:
478577 flags : nightly,${{ matrix.job.os }}
479578 fail_ci_if_error : false
480579
481- compute_size :
482- name : Binary sizes
483- needs : [ min_version, deps ]
484- runs-on : ${{ matrix.job.os }}
485- permissions :
486- contents : write
487- env :
488- SCCACHE_GHA_ENABLED : " true"
489- RUSTC_WRAPPER : " sccache"
490- CARGO_INCREMENTAL : 0
491- strategy :
492- fail-fast : false
493- matrix :
494- job :
495- - { os: ubuntu-latest , features: feat_os_unix }
496- steps :
497- - uses : actions/checkout@v6
498- with :
499- persist-credentials : false
500- - uses : dtolnay/rust-toolchain@stable
501- - uses : Swatinem/rust-cache@v2
502- - name : Run sccache-cache
503- uses : mozilla-actions/sccache-action@v0.0.9
504- - name : " `make install PROFILE=release`"
505- shell : bash
506- run : |
507- export CARGO_TARGET_DIR=cargo-target RUSTFLAGS="${RUSTFLAGS} -C strip=symbols" PROFILE=release MANPAGES=n COMPLETIONS=n LOCALES=n
508- mkdir -p "${CARGO_TARGET_DIR}" && sudo mount -t tmpfs -o noatime,size=16G tmpfs "${CARGO_TARGET_DIR}"
509- make install DESTDIR=target/size-release/
510- make install COMPLETIONS=n MULTICALL=y LN="ln -vf" DESTDIR=target/size-multi-release/
511- ZSTD_CLEVEL=19 tar --zstd -caf individual-x86_64-unknown-linux-gnu.tar.zst -C target/size-release/usr/local bin
512- - name : Publish
513- uses : softprops/action-gh-release@v2
514- if : github.event_name == 'push' && github.ref == 'refs/heads/main'
515- with :
516- tag_name : latest-commit
517- draft : false
518- prerelease : true
519- files : |
520- individual-x86_64-unknown-linux-gnu.tar.zst
521- env :
522- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
523- - name : Test for hardlinks
524- shell : bash
525- run : |
526- [ $(stat -c %i target/size-multi-release/usr/local/bin/cp) = $(stat -c %i target/size-multi-release/usr/local/bin/coreutils) ]
527- - name : Compute uutil release sizes
528- shell : bash
529- run : |
530- ## Compute uutil release sizes
531- DATE=$(date --rfc-email)
532- find target/size-release/usr/local/bin -type f -printf '%f\0' | sort -z |
533- while IFS= read -r -d '' name; do
534- size=$(du -s target/size-release/usr/local/bin/$name | awk '{print $1}')
535- echo "\"$name\""
536- echo "$size"
537- done | \
538- jq -n \
539- --arg date "$DATE" \
540- --arg sha "$GITHUB_SHA" \
541- 'reduce inputs as $name ({}; . + { ($name): input }) | { ($date): {sha: $sha, sizes: map_values(.)} }' > individual-size-result.json
542- SIZE=$(cat individual-size-result.json | jq '[.[] | .sizes | .[]] | reduce .[] as $num (0; . + $num)')
543- SIZE_MULTI=$(du -s target/size-multi-release/usr/local/bin/coreutils | awk '{print $1}')
544- jq -n \
545- --arg date "$DATE" \
546- --arg sha "$GITHUB_SHA" \
547- --arg size "$SIZE" \
548- --arg multisize "$SIZE_MULTI" \
549- '{($date): { sha: $sha, size: $size, multisize: $multisize, }}' > size-result.json
550- - name : Download the previous individual size result
551- uses : dawidd6/action-download-artifact@v14
552- with :
553- workflow : CICD.yml
554- name : individual-size-result
555- repo : uutils/coreutils
556- path : dl
557- - name : Download the previous size result
558- uses : dawidd6/action-download-artifact@v14
559- with :
560- workflow : CICD.yml
561- name : size-result
562- repo : uutils/coreutils
563- path : dl
564- - name : Check uutil release sizes
565- shell : bash
566- run : |
567- check() {
568- # Warn if the size increases by more than 5%
569- threshold='1.05'
570-
571- if [[ "$2" -eq 0 || "$3" -eq 0 ]]; then
572- echo "::warning file=$4::Invalid size for $1. Sizes cannot be 0."
573- return
574- fi
575-
576- ratio=$(jq -n "$2 / $3")
577- echo "$1: size=$2, previous_size=$3, ratio=$ratio, threshold=$threshold"
578- if [[ "$(jq -n "$ratio > $threshold")" == 'true' ]]; then
579- echo "::warning file=$4::Size of $1 increases by more than 5%"
580- fi
581- }
582- ## Check individual size result
583- while read -r name previous_size; do
584- size=$(cat individual-size-result.json | jq -r ".[] | .sizes | .\"$name\"")
585- check "\`$name\` binary" "$size" "$previous_size" 'individual-size-result.json'
586- done < <(cat dl/individual-size-result.json | jq -r '.[] | .sizes | to_entries[] | "\(.key) \(.value)"')
587- ## Check size result
588- size=$(cat size-result.json | jq -r '.[] | .size')
589- previous_size=$(cat dl/size-result.json | jq -r '.[] | .size')
590- check 'multiple binaries' "$size" "$previous_size" 'size-result.json'
591- multisize=$(cat size-result.json | jq -r '.[] | .multisize')
592- previous_multisize=$(cat dl/size-result.json | jq -r '.[] | .multisize')
593- check 'multicall binary' "$multisize" "$previous_multisize" 'size-result.json'
594- - name : Upload the individual size result
595- uses : actions/upload-artifact@v6
596- with :
597- name : individual-size-result
598- path : individual-size-result.json
599- - name : Upload the size result
600- uses : actions/upload-artifact@v6
601- with :
602- name : size-result
603- path : size-result.json
604-
605580 build :
606581 permissions :
607582 contents : write # to create GitHub release (softprops/action-gh-release)
0 commit comments