@@ -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/[email protected] 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,11 @@ 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 && mv $(target/${{ matrix.job.target }}/release/coreutils --list) -t individual ||:
762+ ZSTD_CLEVEL=19 tar --zstd -caf individual-${{ matrix.job.target }}.tar.zst individual
887763 - name : Package manpages and completions
888764 if : matrix.job.target == 'x86_64-unknown-linux-gnu' && matrix.job.features == 'feat_os_unix,uudoc'
889765 run : |
@@ -906,6 +782,7 @@ jobs:
906782 files : |
907783 ${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_NAME }}
908784 docs.tar.zst
785+ individual-${{ matrix.job.target }}.tar.zst
909786 env :
910787 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
911788 - name : Publish latest commit
@@ -918,8 +795,92 @@ jobs:
918795 files : |
919796 ${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_NAME }}
920797 docs.tar.zst
798+ individual-${{ matrix.job.target }}.tar.zst
921799 env :
922800 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
801+ - name : Compute uutil release sizes
802+ if : matrix.job.individual != '' # todo: support all platforms
803+ shell : bash
804+ run : |
805+ ## Compute uutil release sizes
806+ DATE=$(date --rfc-email)
807+ find individual -type f -printf '%f\0' | sort -z |
808+ while IFS= read -r -d '' name; do
809+ size=$(du -s individual/$name | awk '{print $1}')
810+ echo "\"$name\""
811+ echo "$size"
812+ done | \
813+ jq -n \
814+ --arg date "$DATE" \
815+ --arg sha "$GITHUB_SHA" \
816+ 'reduce inputs as $name ({}; . + { ($name): input }) | { ($date): {sha: $sha, sizes: map_values(.)} }' > individual-size-result.json
817+ SIZE=$(cat individual-size-result.json | jq '[.[] | .sizes | .[]] | reduce .[] as $num (0; . + $num)')
818+ SIZE_MULTI=$(du -s target/${{ matrix.job.target }}/release/coreutils | awk '{print $1}')
819+ jq -n \
820+ --arg date "$DATE" \
821+ --arg sha "$GITHUB_SHA" \
822+ --arg size "$SIZE" \
823+ --arg multisize "$SIZE_MULTI" \
824+ '{($date): { sha: $sha, size: $size, multisize: $multisize, }}' > size-result.json
825+ - name : Download the previous individual size result
826+ if : matrix.job.individual != ''
827+ uses : dawidd6/action-download-artifact@v12
828+ with :
829+ workflow : CICD.yml
830+ name : individual-size-result
831+ repo : uutils/coreutils
832+ path : dl
833+ - name : Download the previous size result
834+ if : matrix.job.individual != ''
835+ uses : dawidd6/action-download-artifact@v12
836+ with :
837+ workflow : CICD.yml
838+ name : size-result
839+ repo : uutils/coreutils
840+ path : dl
841+ - name : Check uutil release sizes
842+ if : matrix.job.individual != ''
843+ shell : bash
844+ run : |
845+ check() {
846+ # Warn if the size increases by more than 5%
847+ threshold='1.05'
848+
849+ if [[ "$2" -eq 0 || "$3" -eq 0 ]]; then
850+ echo "::warning file=$4::Invalid size for $1. Sizes cannot be 0."
851+ return
852+ fi
853+
854+ ratio=$(jq -n "$2 / $3")
855+ echo "$1: size=$2, previous_size=$3, ratio=$ratio, threshold=$threshold"
856+ if [[ "$(jq -n "$ratio > $threshold")" == 'true' ]]; then
857+ echo "::warning file=$4::Size of $1 increases by more than 5%"
858+ fi
859+ }
860+ ## Check individual size result
861+ while read -r name previous_size; do
862+ size=$(cat individual-size-result.json | jq -r ".[] | .sizes | .\"$name\"")
863+ check "\`$name\` binary" "$size" "$previous_size" 'individual-size-result.json'
864+ done < <(cat dl/individual-size-result.json | jq -r '.[] | .sizes | to_entries[] | "\(.key) \(.value)"')
865+ ## Check size result
866+ size=$(cat size-result.json | jq -r '.[] | .size')
867+ previous_size=$(cat dl/size-result.json | jq -r '.[] | .size')
868+ check 'multiple binaries' "$size" "$previous_size" 'size-result.json'
869+ multisize=$(cat size-result.json | jq -r '.[] | .multisize')
870+ previous_multisize=$(cat dl/size-result.json | jq -r '.[] | .multisize')
871+ check 'multicall binary' "$multisize" "$previous_multisize" 'size-result.json'
872+ - name : Upload the individual size result
873+ if : matrix.job.individual != ''
874+ uses : actions/upload-artifact@v6
875+ with :
876+ name : individual-size-result
877+ path : individual-size-result.json
878+ - name : Upload the size result
879+ if : matrix.job.individual != ''
880+ uses : actions/upload-artifact@v6
881+ with :
882+ name : size-result
883+ path : size-result.json
923884
924885 test_busybox :
925886 name : Tests/BusyBox test suite
0 commit comments