@@ -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`"
@@ -372,10 +376,10 @@ jobs:
372376 shell : bash
373377 run : |
374378 set -x
375- DESTDIR =/tmp/ make PROFILE=release MULTICALL=n install
379+ make LIBSTDBUF_DIR =/tmp/individual/usr/local/bin DESTDIR=/tmp/individual PROFILE=release MULTICALL=n install
376380 # Check that *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 -e /tmp/individual/ usr/local/bin/${s}
379383 done
380384 - name : " `make install MULTICALL=y LN=ln -svf`"
381385 shell : bash
@@ -386,6 +390,99 @@ jobs:
386390 for s in {md5,b2,sha1,sha224,sha256,sha384,sha512}sum
387391 do test $(readlink /tmp/usr/local/bin/${s}) = coreutils
388392 done
393+ - name : Package
394+ shell : bash
395+ run : |
396+ strip -s /tmp/individual/usr/local/bin/*
397+ ZSTD_CLEVEL=19 tar --zstd -caf individual-x86_64-unknown-linux-gnu.tar.zst -C /tmp/individual/usr/local bin
398+ - name : Publish
399+ uses : softprops/action-gh-release@v2
400+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
401+ with :
402+ tag_name : latest-commit
403+ draft : false
404+ prerelease : true
405+ files : |
406+ individual-x86_64-unknown-linux-gnu.tar.zst
407+ env :
408+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
409+ - name : Compute uutil release sizes
410+ shell : bash
411+ run : |
412+ ## Compute uutil release sizes
413+ DATE=$(date --rfc-email)
414+ find /tmp/individual/usr/local/bin -type f -printf '%f\0' | sort -z |
415+ while IFS= read -r -d '' name; do
416+ size=$(du -s /tmp/individual/usr/local/bin/$name | awk '{print $1}')
417+ echo "\"$name\""
418+ echo "$size"
419+ done | \
420+ jq -n \
421+ --arg date "$DATE" \
422+ --arg sha "$GITHUB_SHA" \
423+ 'reduce inputs as $name ({}; . + { ($name): input }) | { ($date): {sha: $sha, sizes: map_values(.)} }' > individual-size-result.json
424+ SIZE=$(cat individual-size-result.json | jq '[.[] | .sizes | .[]] | reduce .[] as $num (0; . + $num)')
425+ SIZE_MULTI=$(du -s /tmp/usr/local/bin/coreutils | awk '{print $1}')
426+ jq -n \
427+ --arg date "$DATE" \
428+ --arg sha "$GITHUB_SHA" \
429+ --arg size "$SIZE" \
430+ --arg multisize "$SIZE_MULTI" \
431+ '{($date): { sha: $sha, size: $size, multisize: $multisize, }}' > size-result.json
432+ - name : Download the previous individual size result
433+ uses : dawidd6/action-download-artifact@v14
434+ with :
435+ workflow : CICD.yml
436+ name : individual-size-result
437+ repo : uutils/coreutils
438+ path : dl
439+ - name : Download the previous size result
440+ uses : dawidd6/action-download-artifact@v14
441+ with :
442+ workflow : CICD.yml
443+ name : size-result
444+ repo : uutils/coreutils
445+ path : dl
446+ - name : Check uutil release sizes
447+ shell : bash
448+ run : |
449+ check() {
450+ # Warn if the size increases by more than 5%
451+ threshold='1.05'
452+
453+ if [[ "$2" -eq 0 || "$3" -eq 0 ]]; then
454+ echo "::warning file=$4::Invalid size for $1. Sizes cannot be 0."
455+ return
456+ fi
457+
458+ ratio=$(jq -n "$2 / $3")
459+ echo "$1: size=$2, previous_size=$3, ratio=$ratio, threshold=$threshold"
460+ if [[ "$(jq -n "$ratio > $threshold")" == 'true' ]]; then
461+ echo "::warning file=$4::Size of $1 increases by more than 5%"
462+ fi
463+ }
464+ ## Check individual size result
465+ while read -r name previous_size; do
466+ size=$(cat individual-size-result.json | jq -r ".[] | .sizes | .\"$name\"")
467+ check "\`$name\` binary" "$size" "$previous_size" 'individual-size-result.json'
468+ done < <(cat dl/individual-size-result.json | jq -r '.[] | .sizes | to_entries[] | "\(.key) \(.value)"')
469+ ## Check size result
470+ size=$(cat size-result.json | jq -r '.[] | .size')
471+ previous_size=$(cat dl/size-result.json | jq -r '.[] | .size')
472+ check 'multiple binaries' "$size" "$previous_size" 'size-result.json'
473+ multisize=$(cat size-result.json | jq -r '.[] | .multisize')
474+ previous_multisize=$(cat dl/size-result.json | jq -r '.[] | .multisize')
475+ check 'multicall binary' "$multisize" "$previous_multisize" 'size-result.json'
476+ - name : Upload the individual size result
477+ uses : actions/upload-artifact@v6
478+ with :
479+ name : individual-size-result
480+ path : individual-size-result.json
481+ - name : Upload the size result
482+ uses : actions/upload-artifact@v6
483+ with :
484+ name : size-result
485+ path : size-result.json
389486 - name : " `make UTILS=XXX`"
390487 shell : bash
391488 run : |
@@ -478,130 +575,6 @@ jobs:
478575 flags : nightly,${{ matrix.job.os }}
479576 fail_ci_if_error : false
480577
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-
605578 build :
606579 permissions :
607580 contents : write # to create GitHub release (softprops/action-gh-release)
0 commit comments