11name : CICD
22
33# spell-checker:ignore (abbrev/names) CACHEDIR CICD CodeCOV MacOS MinGW MSVC musl taiki
4- # spell-checker:ignore (env/flags) Awarnings Ccodegen Coverflow Cpanic Dwarnings RUSTDOCFLAGS RUSTFLAGS Zpanic CARGOFLAGS
4+ # spell-checker:ignore (env/flags) Awarnings Ccodegen Coverflow Cpanic Dwarnings RUSTDOCFLAGS RUSTFLAGS Zpanic CARGOFLAGS CLEVEL
55# spell-checker:ignore (jargon) SHAs deps dequote softprops subshell toolchain fuzzers dedupe devel profdata
66# spell-checker:ignore (people) Peltoche rivy dtolnay Anson dawidd
7- # spell-checker:ignore (shell/tools) binutils choco clippy dmake esac fakeroot fdesc fdescfs gmake grcov halium lcov libclang libfuse libssl limactl mkdir nextest nocross pacman popd printf pushd redoxer rsync rustc rustfmt rustup shopt sccache utmpdump xargs
7+ # spell-checker:ignore (shell/tools) binutils choco clippy dmake esac fakeroot fdesc fdescfs gmake grcov halium lcov libclang libfuse libssl limactl mkdir nextest nocross pacman popd printf pushd redoxer rsync rustc rustfmt rustup shopt sccache utmpdump xargs zstd
88# spell-checker:ignore (misc) aarch alnum armhf bindir busytest coreutils defconfig DESTDIR gecos getenforce gnueabihf issuecomment maint manpages msys multisize noconfirm nofeatures nullglob onexitbegin onexitend pell runtest Swatinem tempfile testsuite toybox uutils libsystemd codspeed
99
1010env :
@@ -196,7 +196,7 @@ jobs:
196196 ## Confirm MinSRV compatible '*/Cargo.lock'
197197 # * '*/Cargo.lock' is required to be in a format that `cargo` of MinSRV can interpret (eg, v1-format for MinSRV < v1.38)
198198 for dir in "." "fuzz"; do
199- ( cd "$dir" && cargo fetch --locked --quiet ) || { echo "::error file=$dir/Cargo.lock::Incompatible (or out-of-date) '$dir/Cargo.lock' file; update using \`cd '$dir' && cargo +${{ env.RUST_MIN_SRV }} update\`" ; exit 1 ; }
199+ ( cd "$dir" && cargo fetch --locked --quiet --target $(rustc --print host-tuple) ) || { echo "::error file=$dir/Cargo.lock::Incompatible (or out-of-date) '$dir/Cargo.lock' file; update using \`cd '$dir' && cargo +${{ env.RUST_MIN_SRV }} update\`" ; exit 1 ; }
200200 done
201201 - name : Install/setup prerequisites
202202 shell : bash
@@ -221,7 +221,7 @@ jobs:
221221 # dependencies
222222 echo "## dependency list"
223223 ## * using the 'stable' toolchain is necessary to avoid "unexpected '--filter-platform'" errors
224- RUSTUP_TOOLCHAIN=stable cargo fetch --locked --quiet
224+ RUSTUP_TOOLCHAIN=stable cargo fetch --locked --quiet --target $(rustc --print host-tuple)
225225 RUSTUP_TOOLCHAIN=stable cargo tree --no-dedupe --locked -e=no-dev --prefix=none ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} | grep -vE "$PWD" | sort --unique
226226 - name : Test
227227 run : cargo nextest run --hide-progress-bar --profile ci ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} -p uucore -p coreutils
@@ -259,7 +259,7 @@ jobs:
259259 ## `cargo update` testing
260260 # * convert any errors/warnings to GHA UI annotations; ref: <https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-a-warning-message>
261261 for dir in "." "fuzz"; do
262- ( cd "$dir" && cargo fetch --locked --quiet ) || { echo "::error file=$dir/Cargo.lock::'$dir/Cargo.lock' file requires update (use \`cd '$dir' && cargo +${{ env.RUST_MIN_SRV }} update\`)" ; exit 1 ; }
262+ ( cd "$dir" && cargo fetch --locked --quiet --target $(rustc --print host-tuple) ) || { echo "::error file=$dir/Cargo.lock::'$dir/Cargo.lock' file requires update (use \`cd '$dir' && cargo +${{ env.RUST_MIN_SRV }} update\`)" ; exit 1 ; }
263263 done
264264
265265 build_makefile :
@@ -297,7 +297,6 @@ jobs:
297297 mv -T target target.cache
298298 fi
299299 # Check that we don't cross-build uudoc
300- # also do not try to generate manpages for part of hashsum
301300 env CARGO_BUILD_TARGET=aarch64-unknown-linux-gnu make install-manpages PREFIX=/tmp/usr UTILS=true
302301 # build (host)
303302 make build
@@ -371,25 +370,19 @@ jobs:
371370 run : |
372371 set -x
373372 DESTDIR=/tmp/ make PROFILE=release MULTICALL=n install
374- # Check that the utils are present
375- test -f /tmp/usr/local/bin/hashsum
376- # Check that hashsum symlinks are present
377- test -h /tmp/usr/local/bin/b2sum
378- test -h /tmp/usr/local/bin/md5sum
379- test -h /tmp/usr/local/bin/sha1sum
380- test -h /tmp/usr/local/bin/sha224sum
381- test -h /tmp/usr/local/bin/sha256sum
382- test -h /tmp/usr/local/bin/sha384sum
383- test -h /tmp/usr/local/bin/sha512sum
373+ # Check that *sum are present
374+ for s in {md5,b2,sha1,sha224,sha256,sha384,sha512}sum
375+ do test -e /tmp/usr/local/bin/${s}
376+ done
384377 - name : " `make install MULTICALL=y LN=ln -svf`"
385378 shell : bash
386379 run : |
387380 set -x
388381 DESTDIR=/tmp/ make PROFILE=release MULTICALL=y LN="ln -svf" install
389- # Check that relative symlinks of hashsum are present
390- [ $(readlink /tmp/usr/local/bin/b2sum) = coreutils ]
391- [ $(readlink /tmp/usr/local/bin/md5sum ) = coreutils ]
392- [ $(readlink /tmp/usr/local/bin/sha512sum) = coreutils ]
382+ # Check that symlinks of *sum are present
383+ for s in {md5,b2,sha1,sha224,sha256,sha384,sha512}sum
384+ do test $(readlink /tmp/usr/local/bin/${s} ) = coreutils
385+ done
393386 - name : " `make UTILS=XXX`"
394387 shell : bash
395388 run : |
@@ -484,6 +477,8 @@ jobs:
484477 name : Binary sizes
485478 needs : [ min_version, deps ]
486479 runs-on : ${{ matrix.job.os }}
480+ permissions :
481+ contents : write
487482 env :
488483 SCCACHE_GHA_ENABLED : " true"
489484 RUSTC_WRAPPER : " sccache"
@@ -500,20 +495,25 @@ jobs:
500495 - uses : Swatinem/rust-cache@v2
501496 - name : Run sccache-cache
502497 uses : mozilla-actions/sccache-action@v0.0.9
503- - name : Install dependencies
498+ - name : " `make install PROFILE=release-fast` "
504499 shell : bash
505500 run : |
506- ## Install dependencies
507- sudo apt-get update
508- sudo apt-get install libselinux1-dev libsystemd-dev
509- - name : " `make install`"
510- shell : bash
511- run : |
512- ## `make install`
501+ export CARGO_TARGET_DIR=cargo-target RUSTFLAGS="${RUSTFLAGS} -C strip=symbols" PROFILE=release-fast MANPAGES=n COMPLETIONS=n LOCALES=n
502+ mkdir -p "${CARGO_TARGET_DIR}" && sudo mount -t tmpfs -o noatime,size=16G tmpfs "${CARGO_TARGET_DIR}"
513503 make install DESTDIR=target/size-release/
514- make install MULTICALL=y LN="ln -vf" DESTDIR=target/size-multi-release/
515- # strip the results
516- strip target/size*/usr/local/bin/*
504+ make install COMPLETIONS=n MULTICALL=y LN="ln -vf" DESTDIR=target/size-multi-release/
505+ ZSTD_CLEVEL=19 tar --zstd -caf individual-x86_64-unknown-linux-gnu.tar.zst -C target/size-release/usr/local bin
506+ - name : Publish
507+ uses : softprops/action-gh-release@v2
508+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
509+ with :
510+ tag_name : latest-commit
511+ draft : false
512+ prerelease : true
513+ files : |
514+ individual-x86_64-unknown-linux-gnu.tar.zst
515+ env :
516+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
517517 - name : Test for hardlinks
518518 shell : bash
519519 run : |
@@ -637,6 +637,8 @@ jobs:
637637 - uses : actions/checkout@v6
638638 with :
639639 persist-credentials : false
640+ - name : Avoid no space left on device
641+ run : sudo rm -rf /usr/share/dotnet /usr/local/lib/android &
640642 - uses : dtolnay/rust-toolchain@master
641643 with :
642644 toolchain : ${{ env.RUST_MIN_SRV }}
@@ -692,7 +694,7 @@ jobs:
692694 outputs TARGET_ARCH TARGET_OS
693695 # package name
694696 PKG_suffix=".tar.gz" ; case '${{ matrix.job.target }}' in *-pc-windows-*) PKG_suffix=".zip" ;; esac;
695- PKG_BASENAME=${PROJECT_NAME}-${REF_TAG:-$REF_SHAS}-${ { matrix.job.target }}
697+ PKG_BASENAME=${PROJECT_NAME}-${{ matrix.job.target }}
696698 PKG_NAME=${PKG_BASENAME}${PKG_suffix}
697699 outputs PKG_suffix PKG_BASENAME PKG_NAME
698700 # deployable tag? (ie, leading "vM" or "M"; M == version number)
@@ -737,16 +739,6 @@ jobs:
737739 CARGO_TEST_OPTIONS='--workspace'
738740 ;;
739741 esac
740- outputs CARGO_TEST_OPTIONS
741- # * executable for `strip`?
742- STRIP="strip"
743- case ${{ matrix.job.target }} in
744- aarch64-*-linux-*) STRIP="aarch64-linux-gnu-strip" ;;
745- riscv64gc-*-linux-*) STRIP="riscv64-linux-gnu-strip" ;;
746- arm-*-linux-gnueabihf) STRIP="arm-linux-gnueabihf-strip" ;;
747- *-pc-windows-msvc) STRIP="" ;;
748- esac;
749- outputs STRIP
750742 - uses : taiki-e/install-action@v2
751743 if : steps.vars.outputs.CARGO_CMD == 'cross'
752744 with :
@@ -840,13 +832,13 @@ jobs:
840832 cargo tree -V
841833 # dependencies
842834 echo "## dependency list"
843- cargo fetch --locked --quiet
835+ cargo fetch --locked --quiet --target $(rustc --print host-tuple)
844836 cargo tree --locked --target=${{ matrix.job.target }} ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} ${{ steps.vars.outputs.CARGO_DEFAULT_FEATURES_OPTION }} --no-dedupe -e=no-dev --prefix=none | grep -vE "$PWD" | sort --unique
845837 - name : Build
846838 shell : bash
847839 run : |
848840 ## Build
849- ${{ steps.vars.outputs.CARGO_CMD }} ${{ steps.vars.outputs.CARGO_CMD_OPTIONS }} build --release \
841+ ${{ steps.vars.outputs.CARGO_CMD }} ${{ steps.vars.outputs.CARGO_CMD_OPTIONS }} build --release --config=profile.release.strip=true \
850842 --target=${{ matrix.job.target }} ${{ matrix.job.cargo-options }} ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} ${{ steps.vars.outputs.CARGO_DEFAULT_FEATURES_OPTION }}
851843 - name : Test
852844 if : matrix.job.skip-tests != true
@@ -861,8 +853,6 @@ jobs:
861853 if : matrix.job.skip-tests != true
862854 shell : bash
863855 run : |
864- command -v sudo && sudo rm -rf /usr/local/lib/android /usr/share/dotnet # avoid no space left
865- df -h ||:
866856 ## Test individual utilities
867857 ${{ steps.vars.outputs.CARGO_CMD }} ${{ steps.vars.outputs.CARGO_CMD_OPTIONS }} test --target=${{ matrix.job.target }} \
868858 ${{ matrix.job.cargo-options }} ${{ steps.dep_vars.outputs.CARGO_UTILITY_LIST_OPTIONS }}
@@ -881,11 +871,6 @@ jobs:
881871 # binaries
882872 cp 'target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}' '${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}/'
883873 cp 'target/${{ matrix.job.target }}/release/uudoc${{ steps.vars.outputs.EXE_suffix }}' '${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}/' || :
884- # `strip` binary (if needed)
885- if [ -n "${{ steps.vars.outputs.STRIP }}" ]; then
886- "${{ steps.vars.outputs.STRIP }}" '${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}/${{ env.PROJECT_NAME }}${{ steps.vars.outputs.EXE_suffix }}'
887- "${{ steps.vars.outputs.STRIP }}" '${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}/uudoc' || :
888- fi
889874 # README and LICENSE
890875 # * spell-checker:ignore EADME ICENSE
891876 (shopt -s nullglob; for f in [R]"EADME"{,.*}; do cp $f '${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_BASENAME }}/' ; done)
@@ -897,25 +882,40 @@ jobs:
897882 *) tar czf '${{ steps.vars.outputs.PKG_NAME }}' '${{ steps.vars.outputs.PKG_BASENAME }}'/* ;;
898883 esac
899884 popd >/dev/null
885+ - name : Package manpages and completions
886+ if : matrix.job.target == 'x86_64-unknown-linux-gnu' && matrix.job.features == 'feat_os_unix,uudoc'
887+ run : |
888+ mkdir -p share/{man/man1,bash-completion/completions,fish/vendor_completions.d,zsh/site-functions,elvish/lib}
889+ _uudoc=target/${{ matrix.job.target }}/release/uudoc
890+ for bin in $('target/${{ matrix.job.target }}/release/coreutils' --list) coreutils;do
891+ ${_uudoc} manpage ${bin} > share/man/man1/${bin}.1
892+ ${_uudoc} completion ${bin} bash > share/bash-completion/completions/${bin}.bash
893+ ${_uudoc} completion ${bin} fish > share/fish/vendor_completions.d/${bin}.fish
894+ ${_uudoc} completion ${bin} zsh > share/zsh/site-functions/_${bin}
895+ ${_uudoc} completion ${bin} elvish > share/elvish/lib/${bin}.elv
896+ done
897+ rm share/zsh/site-functions/_[ # not supported
898+ tar --zstd -cf docs.tar.zst share
900899 - name : Publish
901900 uses : softprops/action-gh-release@v2
902901 if : steps.vars.outputs.DEPLOY && matrix.job.skip-publish != true
903902 with :
904903 draft : true
905904 files : |
906905 ${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_NAME }}
906+ docs.tar.zst
907907 env :
908908 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
909909 - name : Publish latest commit
910910 uses : softprops/action-gh-release@v2
911- if : steps.vars.outputs.DEPLOY && matrix.job.skip-publish != true
911+ if : github.event_name == 'push' && github.ref == 'refs/heads/main' && matrix.job.skip-publish != true
912912 with :
913913 tag_name : latest-commit
914- force_update : true
915914 draft : false
916915 prerelease : true
917916 files : |
918917 ${{ steps.vars.outputs.STAGING }}/${{ steps.vars.outputs.PKG_NAME }}
918+ docs.tar.zst
919919 env :
920920 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
921921
@@ -1264,13 +1264,13 @@ jobs:
12641264 - uses : actions/checkout@v6
12651265 with :
12661266 persist-credentials : false
1267+ - name : Avoid no space left on device
1268+ run : sudo rm -rf /usr/share/dotnet /usr/local/lib/android &
12671269 - uses : dtolnay/rust-toolchain@stable
12681270 - uses : Swatinem/rust-cache@v2
12691271 - name : build and test all features individually
12701272 shell : bash
12711273 run : |
1272- command -v sudo && sudo rm -rf /usr/local/lib/android /usr/share/dotnet # avoid no space left
1273- df -h ||:
12741274 CARGO_FEATURES_OPTION='--features=${{ matrix.job.features }}' ;
12751275 for f in $(util/show-utils.sh ${CARGO_FEATURES_OPTION})
12761276 do
0 commit comments