@@ -475,129 +475,6 @@ jobs:
475475 flags : nightly,${{ matrix.job.os }}
476476 fail_ci_if_error : false
477477
478- compute_size :
479- name : Binary sizes
480- needs : [ min_version, deps ]
481- runs-on : ${{ matrix.job.os }}
482- permissions :
483- contents : write
484- env :
485- SCCACHE_GHA_ENABLED : " true"
486- RUSTC_WRAPPER : " sccache"
487- strategy :
488- fail-fast : false
489- matrix :
490- job :
491- - { os: ubuntu-latest , features: feat_os_unix }
492- steps :
493- - uses : actions/checkout@v6
494- with :
495- persist-credentials : false
496- - uses : dtolnay/rust-toolchain@stable
497- - uses : Swatinem/rust-cache@v2
498- - name : Run sccache-cache
499- uses : mozilla-actions/sccache-action@v0.0.9
500- - name : " `make install PROFILE=release-fast`"
501- shell : bash
502- run : |
503- export CARGO_TARGET_DIR=cargo-target RUSTFLAGS="${RUSTFLAGS} -C strip=symbols" PROFILE=release-fast MANPAGES=n COMPLETIONS=n LOCALES=n
504- mkdir -p "${CARGO_TARGET_DIR}" && sudo mount -t tmpfs -o noatime,size=16G tmpfs "${CARGO_TARGET_DIR}"
505- make install DESTDIR=target/size-release/
506- make install COMPLETIONS=n MULTICALL=y LN="ln -vf" DESTDIR=target/size-multi-release/
507- ZSTD_CLEVEL=19 tar --zstd -caf individual-x86_64-unknown-linux-gnu.tar.zst -C target/size-release/usr/local bin
508- - name : Publish
509- uses : softprops/action-gh-release@v2
510- if : github.event_name == 'push' && github.ref == 'refs/heads/main'
511- with :
512- tag_name : latest-commit
513- draft : false
514- prerelease : true
515- files : |
516- individual-x86_64-unknown-linux-gnu.tar.zst
517- env :
518- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
519- - name : Test for hardlinks
520- shell : bash
521- run : |
522- [ $(stat -c %i target/size-multi-release/usr/local/bin/cp) = $(stat -c %i target/size-multi-release/usr/local/bin/coreutils) ]
523- - name : Compute uutil release sizes
524- shell : bash
525- run : |
526- ## Compute uutil release sizes
527- DATE=$(date --rfc-email)
528- find target/size-release/usr/local/bin -type f -printf '%f\0' | sort -z |
529- while IFS= read -r -d '' name; do
530- size=$(du -s target/size-release/usr/local/bin/$name | awk '{print $1}')
531- echo "\"$name\""
532- echo "$size"
533- done | \
534- jq -n \
535- --arg date "$DATE" \
536- --arg sha "$GITHUB_SHA" \
537- 'reduce inputs as $name ({}; . + { ($name): input }) | { ($date): {sha: $sha, sizes: map_values(.)} }' > individual-size-result.json
538- SIZE=$(cat individual-size-result.json | jq '[.[] | .sizes | .[]] | reduce .[] as $num (0; . + $num)')
539- SIZE_MULTI=$(du -s target/size-multi-release/usr/local/bin/coreutils | awk '{print $1}')
540- jq -n \
541- --arg date "$DATE" \
542- --arg sha "$GITHUB_SHA" \
543- --arg size "$SIZE" \
544- --arg multisize "$SIZE_MULTI" \
545- '{($date): { sha: $sha, size: $size, multisize: $multisize, }}' > size-result.json
546- - name : Download the previous individual size result
547- uses : dawidd6/action-download-artifact@v12
548- with :
549- workflow : CICD.yml
550- name : individual-size-result
551- repo : uutils/coreutils
552- path : dl
553- - name : Download the previous size result
554- uses : dawidd6/action-download-artifact@v12
555- with :
556- workflow : CICD.yml
557- name : size-result
558- repo : uutils/coreutils
559- path : dl
560- - name : Check uutil release sizes
561- shell : bash
562- run : |
563- check() {
564- # Warn if the size increases by more than 5%
565- threshold='1.05'
566-
567- if [[ "$2" -eq 0 || "$3" -eq 0 ]]; then
568- echo "::warning file=$4::Invalid size for $1. Sizes cannot be 0."
569- return
570- fi
571-
572- ratio=$(jq -n "$2 / $3")
573- echo "$1: size=$2, previous_size=$3, ratio=$ratio, threshold=$threshold"
574- if [[ "$(jq -n "$ratio > $threshold")" == 'true' ]]; then
575- echo "::warning file=$4::Size of $1 increases by more than 5%"
576- fi
577- }
578- ## Check individual size result
579- while read -r name previous_size; do
580- size=$(cat individual-size-result.json | jq -r ".[] | .sizes | .\"$name\"")
581- check "\`$name\` binary" "$size" "$previous_size" 'individual-size-result.json'
582- done < <(cat dl/individual-size-result.json | jq -r '.[] | .sizes | to_entries[] | "\(.key) \(.value)"')
583- ## Check size result
584- size=$(cat size-result.json | jq -r '.[] | .size')
585- previous_size=$(cat dl/size-result.json | jq -r '.[] | .size')
586- check 'multiple binaries' "$size" "$previous_size" 'size-result.json'
587- multisize=$(cat size-result.json | jq -r '.[] | .multisize')
588- previous_multisize=$(cat dl/size-result.json | jq -r '.[] | .multisize')
589- check 'multicall binary' "$multisize" "$previous_multisize" 'size-result.json'
590- - name : Upload the individual size result
591- uses : actions/upload-artifact@v6
592- with :
593- name : individual-size-result
594- path : individual-size-result.json
595- - name : Upload the size result
596- uses : actions/upload-artifact@v6
597- with :
598- name : size-result
599- path : size-result.json
600-
601478 build :
602479 permissions :
603480 contents : write # to create GitHub release (softprops/action-gh-release)
@@ -623,7 +500,7 @@ jobs:
623500 - { os: ubuntu-latest , target: i686-unknown-linux-gnu , features: "feat_os_unix,test_risky_names", use-cross: use-cross }
624501 - { os: ubuntu-latest , target: i686-unknown-linux-musl , features: feat_os_unix_musl , use-cross: use-cross }
625502 - { os: ubuntu-latest , target: x86_64-unknown-linux-gnu , features: "feat_os_unix,test_risky_names", use-cross: use-cross, skip-publish: true }
626- - { os: ubuntu-latest , target: x86_64-unknown-linux-gnu , features: "feat_os_unix,uudoc" , use-cross: no, workspace-tests: true }
503+ - { os: ubuntu-latest, target: x86_64-unknown-linux-gnu, features: "feat_os_unix,uudoc", use-cross: no, workspace-tests: true, individual: "--workspace --bins --exclude uu_runcon --exclude uu_chcon" }
627504 - { os: ubuntu-latest , target: x86_64-unknown-linux-musl , features: feat_os_unix_musl , use-cross: use-cross }
628505 - { os: ubuntu-latest , target: x86_64-unknown-redox , features: feat_os_unix_redox , use-cross: redoxer , skip-tests: true }
629506 - { os: ubuntu-latest , target: wasm32-unknown-unknown , default-features: false, features: uucore/format, skip-tests: true, skip-package: true, skip-publish: true }
@@ -632,7 +509,7 @@ jobs:
632509 - { os: macos-latest , target: aarch64-apple-darwin , workspace-tests: true, skip-publish: true } # M1 CPU
633510 - { os: macos-latest , target: x86_64-apple-darwin , features: feat_os_macos, workspace-tests: true }
634511 - { os: windows-latest , target: i686-pc-windows-msvc , features: feat_os_windows }
635- - { os: windows-latest , target: x86_64-pc-windows-gnu , features: feat_os_windows }
512+ # - { os: windows-latest , target: x86_64-pc-windows-gnu , features: feat_os_windows }
636513 - { os: windows-latest , target: x86_64-pc-windows-msvc , features: feat_os_windows }
637514 - { os: windows-latest , target: aarch64-pc-windows-msvc , features: feat_os_windows, use-cross: use-cross , skip-tests: true }
638515 steps :
@@ -839,8 +716,7 @@ jobs:
839716 - name : Build
840717 shell : bash
841718 run : |
842- ## Build
843- ${{ steps.vars.outputs.CARGO_CMD }} ${{ steps.vars.outputs.CARGO_CMD_OPTIONS }} build --release --config=profile.release.strip=true \
719+ ${{ steps.vars.outputs.CARGO_CMD }} ${{ steps.vars.outputs.CARGO_CMD_OPTIONS }} build --release ${{ matrix.job.individual }} --config=profile.release.strip=true \
844720 --target=${{ matrix.job.target }} ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} ${{ steps.vars.outputs.CARGO_DEFAULT_FEATURES_OPTION }}
845721 - name : Test
846722 if : matrix.job.skip-tests != true
@@ -860,11 +736,6 @@ jobs:
860736 ${{ matrix.job.cargo-options }} ${{ steps.dep_vars.outputs.CARGO_UTILITY_LIST_OPTIONS }}
861737 env :
862738 RUST_BACKTRACE : " 1"
863- - name : Archive executable artifacts
864- uses : actions/upload-artifact@v6
865- with :
866- name : ${{ env.PROJECT_NAME }}-${{ matrix.job.target }}${{ steps.vars.outputs.ARTIFACTS_SUFFIX }}
867- path : target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}
868739 - name : Package
869740 if : matrix.job.skip-package != true
870741 shell : bash
@@ -884,6 +755,13 @@ jobs:
884755 *) tar czf '${{ steps.vars.outputs.PKG_NAME }}' '${{ steps.vars.outputs.PKG_BASENAME }}'/* ;;
885756 esac
886757 popd >/dev/null
758+ - name : Package individual binaries
759+ if : matrix.job.individual != ''
760+ run : |
761+ mkdir -p individual
762+ (cd target/${{ matrix.job.target }}/release && mv $(./coreutils --list) -t ../../../individual ||:)
763+ individual/true --version
764+ ZSTD_CLEVEL=19 tar --zstd -caf individual-${{ matrix.job.target }}.tar.zst individual
887765 - name : Package manpages and completions
888766 if : matrix.job.target == 'x86_64-unknown-linux-gnu' && matrix.job.features == 'feat_os_unix,uudoc'
889767 run : |
@@ -906,6 +784,7 @@ jobs:
906784 files : |
907785 ${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_NAME }}
908786 docs.tar.zst
787+ individual-${{ matrix.job.target }}.tar.zst
909788 env :
910789 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
911790 - name : Publish latest commit
@@ -918,8 +797,92 @@ jobs:
918797 files : |
919798 ${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_NAME }}
920799 docs.tar.zst
800+ individual-${{ matrix.job.target }}.tar.zst
921801 env :
922802 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
803+ - name : Compute uutil release sizes
804+ if : matrix.job.individual != '' # todo: support all platforms
805+ shell : bash
806+ run : |
807+ ## Compute uutil release sizes
808+ DATE=$(date --rfc-email)
809+ find individual -type f -printf '%f\0' | sort -z |
810+ while IFS= read -r -d '' name; do
811+ size=$(du -s individual/$name | awk '{print $1}')
812+ echo "\"$name\""
813+ echo "$size"
814+ done | \
815+ jq -n \
816+ --arg date "$DATE" \
817+ --arg sha "$GITHUB_SHA" \
818+ 'reduce inputs as $name ({}; . + { ($name): input }) | { ($date): {sha: $sha, sizes: map_values(.)} }' > individual-size-result.json
819+ SIZE=$(cat individual-size-result.json | jq '[.[] | .sizes | .[]] | reduce .[] as $num (0; . + $num)')
820+ SIZE_MULTI=$(du -s target/${{ matrix.job.target }}/release/coreutils | awk '{print $1}')
821+ jq -n \
822+ --arg date "$DATE" \
823+ --arg sha "$GITHUB_SHA" \
824+ --arg size "$SIZE" \
825+ --arg multisize "$SIZE_MULTI" \
826+ '{($date): { sha: $sha, size: $size, multisize: $multisize, }}' > size-result.json
827+ - name : Download the previous individual size result
828+ if : matrix.job.individual != ''
829+ uses : dawidd6/action-download-artifact@v12
830+ with :
831+ workflow : CICD.yml
832+ name : individual-size-result
833+ repo : uutils/coreutils
834+ path : dl
835+ - name : Download the previous size result
836+ if : matrix.job.individual != ''
837+ uses : dawidd6/action-download-artifact@v12
838+ with :
839+ workflow : CICD.yml
840+ name : size-result
841+ repo : uutils/coreutils
842+ path : dl
843+ - name : Check uutil release sizes
844+ if : matrix.job.individual != ''
845+ shell : bash
846+ run : |
847+ check() {
848+ # Warn if the size increases by more than 5%
849+ threshold='1.05'
850+
851+ if [[ "$2" -eq 0 || "$3" -eq 0 ]]; then
852+ echo "::warning file=$4::Invalid size for $1. Sizes cannot be 0."
853+ return
854+ fi
855+
856+ ratio=$(jq -n "$2 / $3")
857+ echo "$1: size=$2, previous_size=$3, ratio=$ratio, threshold=$threshold"
858+ if [[ "$(jq -n "$ratio > $threshold")" == 'true' ]]; then
859+ echo "::warning file=$4::Size of $1 increases by more than 5%"
860+ fi
861+ }
862+ ## Check individual size result
863+ while read -r name previous_size; do
864+ size=$(cat individual-size-result.json | jq -r ".[] | .sizes | .\"$name\"")
865+ check "\`$name\` binary" "$size" "$previous_size" 'individual-size-result.json'
866+ done < <(cat dl/individual-size-result.json | jq -r '.[] | .sizes | to_entries[] | "\(.key) \(.value)"')
867+ ## Check size result
868+ size=$(cat size-result.json | jq -r '.[] | .size')
869+ previous_size=$(cat dl/size-result.json | jq -r '.[] | .size')
870+ check 'multiple binaries' "$size" "$previous_size" 'size-result.json'
871+ multisize=$(cat size-result.json | jq -r '.[] | .multisize')
872+ previous_multisize=$(cat dl/size-result.json | jq -r '.[] | .multisize')
873+ check 'multicall binary' "$multisize" "$previous_multisize" 'size-result.json'
874+ - name : Upload the individual size result
875+ if : matrix.job.individual != ''
876+ uses : actions/upload-artifact@v6
877+ with :
878+ name : individual-size-result
879+ path : individual-size-result.json
880+ - name : Upload the size result
881+ if : matrix.job.individual != ''
882+ uses : actions/upload-artifact@v6
883+ with :
884+ name : size-result
885+ path : size-result.json
923886
924887 test_busybox :
925888 name : Tests/BusyBox test suite
0 commit comments