@@ -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 --config=profile.release.codegen-units=1 --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,8 @@ 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+ # libstdbuf is not stripped by cargo's config
720+ RUSTFLAGS="-C strip=symbols" ${{ steps.vars.outputs.CARGO_CMD }} ${{ steps.vars.outputs.CARGO_CMD_OPTIONS }} build --release ${{ matrix.job.individual }} \
844721 --target=${{ matrix.job.target }} ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} ${{ steps.vars.outputs.CARGO_DEFAULT_FEATURES_OPTION }}
845722 - name : Test
846723 if : matrix.job.skip-tests != true
@@ -852,11 +729,6 @@ jobs:
852729 ${{ steps.dep_vars.outputs.CARGO_UTILITY_LIST_OPTIONS }} -p coreutils
853730 env :
854731 RUST_BACKTRACE : " 1"
855- - name : Archive executable artifacts
856- uses : actions/upload-artifact@v6
857- with :
858- name : ${{ env.PROJECT_NAME }}-${{ matrix.job.target }}${{ steps.vars.outputs.ARTIFACTS_SUFFIX }}
859- path : target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}
860732 - name : Package
861733 if : matrix.job.skip-package != true
862734 shell : bash
@@ -876,6 +748,13 @@ jobs:
876748 *) tar czf '${{ steps.vars.outputs.PKG_NAME }}' '${{ steps.vars.outputs.PKG_BASENAME }}'/* ;;
877749 esac
878750 popd >/dev/null
751+ - name : Package individual binaries
752+ if : matrix.job.individual != ''
753+ run : |
754+ mkdir -p individual
755+ (cd target/${{ matrix.job.target }}/release && mv $(./coreutils --list) -t ../../../individual ||:)
756+ individual/true --version
757+ ZSTD_CLEVEL=19 tar --zstd -caf individual-${{ matrix.job.target }}.tar.zst individual
879758 - name : Package manpages and completions
880759 if : matrix.job.target == 'x86_64-unknown-linux-gnu' && matrix.job.features == 'feat_os_unix,uudoc'
881760 run : |
@@ -898,6 +777,7 @@ jobs:
898777 files : |
899778 ${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_NAME }}
900779 docs.tar.zst
780+ individual-${{ matrix.job.target }}.tar.zst
901781 env :
902782 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
903783 - name : Publish latest commit
@@ -910,8 +790,92 @@ jobs:
910790 files : |
911791 ${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_NAME }}
912792 docs.tar.zst
793+ individual-${{ matrix.job.target }}.tar.zst
913794 env :
914795 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
796+ - name : Compute uutil release sizes
797+ if : matrix.job.individual != '' # todo: support all platforms
798+ shell : bash
799+ run : |
800+ ## Compute uutil release sizes
801+ DATE=$(date --rfc-email)
802+ find individual -type f -printf '%f\0' | sort -z |
803+ while IFS= read -r -d '' name; do
804+ size=$(du -s individual/$name | awk '{print $1}')
805+ echo "\"$name\""
806+ echo "$size"
807+ done | \
808+ jq -n \
809+ --arg date "$DATE" \
810+ --arg sha "$GITHUB_SHA" \
811+ 'reduce inputs as $name ({}; . + { ($name): input }) | { ($date): {sha: $sha, sizes: map_values(.)} }' > individual-size-result.json
812+ SIZE=$(cat individual-size-result.json | jq '[.[] | .sizes | .[]] | reduce .[] as $num (0; . + $num)')
813+ SIZE_MULTI=$(du -s target/${{ matrix.job.target }}/release/coreutils | awk '{print $1}')
814+ jq -n \
815+ --arg date "$DATE" \
816+ --arg sha "$GITHUB_SHA" \
817+ --arg size "$SIZE" \
818+ --arg multisize "$SIZE_MULTI" \
819+ '{($date): { sha: $sha, size: $size, multisize: $multisize, }}' > size-result.json
820+ - name : Download the previous individual size result
821+ if : matrix.job.individual != ''
822+ uses : dawidd6/action-download-artifact@v12
823+ with :
824+ workflow : CICD.yml
825+ name : individual-size-result
826+ repo : uutils/coreutils
827+ path : dl
828+ - name : Download the previous size result
829+ if : matrix.job.individual != ''
830+ uses : dawidd6/action-download-artifact@v12
831+ with :
832+ workflow : CICD.yml
833+ name : size-result
834+ repo : uutils/coreutils
835+ path : dl
836+ - name : Check uutil release sizes
837+ if : matrix.job.individual != ''
838+ shell : bash
839+ run : |
840+ check() {
841+ # Warn if the size increases by more than 5%
842+ threshold='1.05'
843+
844+ if [[ "$2" -eq 0 || "$3" -eq 0 ]]; then
845+ echo "::warning file=$4::Invalid size for $1. Sizes cannot be 0."
846+ return
847+ fi
848+
849+ ratio=$(jq -n "$2 / $3")
850+ echo "$1: size=$2, previous_size=$3, ratio=$ratio, threshold=$threshold"
851+ if [[ "$(jq -n "$ratio > $threshold")" == 'true' ]]; then
852+ echo "::warning file=$4::Size of $1 increases by more than 5%"
853+ fi
854+ }
855+ ## Check individual size result
856+ while read -r name previous_size; do
857+ size=$(cat individual-size-result.json | jq -r ".[] | .sizes | .\"$name\"")
858+ check "\`$name\` binary" "$size" "$previous_size" 'individual-size-result.json'
859+ done < <(cat dl/individual-size-result.json | jq -r '.[] | .sizes | to_entries[] | "\(.key) \(.value)"')
860+ ## Check size result
861+ size=$(cat size-result.json | jq -r '.[] | .size')
862+ previous_size=$(cat dl/size-result.json | jq -r '.[] | .size')
863+ check 'multiple binaries' "$size" "$previous_size" 'size-result.json'
864+ multisize=$(cat size-result.json | jq -r '.[] | .multisize')
865+ previous_multisize=$(cat dl/size-result.json | jq -r '.[] | .multisize')
866+ check 'multicall binary' "$multisize" "$previous_multisize" 'size-result.json'
867+ - name : Upload the individual size result
868+ if : matrix.job.individual != ''
869+ uses : actions/upload-artifact@v6
870+ with :
871+ name : individual-size-result
872+ path : individual-size-result.json
873+ - name : Upload the size result
874+ if : matrix.job.individual != ''
875+ uses : actions/upload-artifact@v6
876+ with :
877+ name : size-result
878+ path : size-result.json
915879
916880 test_busybox :
917881 name : Tests/BusyBox test suite
0 commit comments