diff --git a/.github/workflows/GnuTests.yml b/.github/workflows/GnuTests.yml index c8070f629cb..6c528dbd32a 100644 --- a/.github/workflows/GnuTests.yml +++ b/.github/workflows/GnuTests.yml @@ -2,7 +2,7 @@ name: GnuTests # spell-checker:ignore (abbrev/names) CodeCov gnulib GnuTests Swatinem # spell-checker:ignore (jargon) submodules devel -# spell-checker:ignore (libs/utils) autopoint chksum dpkg getenforce gperf lcov libexpect limactl pyinotify setenforce shopt texinfo valgrind libattr libcap taiki-e +# spell-checker:ignore (libs/utils) autopoint chksum dpkg getenforce getlimits gperf lcov libexpect limactl pyinotify setenforce shopt texinfo valgrind libattr libcap taiki-e # spell-checker:ignore (options) Ccodegen Coverflow Cpanic Zpanic # spell-checker:ignore (people) Dawid Dziurla * dawidd dtolnay # spell-checker:ignore (vars) FILESET SUBDIRS XPASS @@ -51,7 +51,17 @@ jobs: workspaces: "./uutils -> target" - name: Checkout code (GNU coreutils) run: (mkdir -p gnu && cd gnu && bash ../uutils/util/fetch-gnu.sh) - + - name: Restore files for faster configure and skipping make + uses: actions/cache@v5 + id: cache-config-gnu + with: + path: | + gnu/config.cache + gnu/src/getlimits + key: ${{ runner.os }}-gnu-config-${{ env.REPO_GNU_REF }}-${{ hashFiles('gnu/configure') }} + restore-keys: | + ${{ runner.os }}-gnu-config-${{ env.REPO_GNU_REF }}- + ${{ runner.os }}-gnu-config- #### Build environment setup - name: Install dependencies shell: bash @@ -94,6 +104,15 @@ jobs: ## Build binaries cd 'uutils' env PROFILE=release-small bash util/build-gnu.sh + + - name: Save files for faster configure and skipping make + uses: actions/cache/save@v5 + if: always() && steps.cache-config-gnu.outputs.cache-hit != 'true' + with: + path: | + gnu/config.cache + gnu/src/getlimits + key: ${{ runner.os }}-gnu-config-${{ env.REPO_GNU_REF }}-${{ hashFiles('gnu/configure') }} ### Run tests as user - name: Run GNU tests diff --git a/util/build-gnu.sh b/util/build-gnu.sh index 5bb1c34f010..6d5f622d137 100755 --- a/util/build-gnu.sh +++ b/util/build-gnu.sh @@ -120,21 +120,24 @@ done if test -f gnu-built; then echo "GNU build already found. Skip" - echo "'rm -f $(pwd)/gnu-built' to force the build" + echo "'rm -f $(pwd)/{gnu-built,src/getlimits}' to force the build" echo "Note: the customization of the tests will still happen" else # Disable useless checks "${SED}" -i 's|check-texinfo: $(syntax_checks)|check-texinfo:|' doc/local.mk # Use CFLAGS for best build time since we discard GNU coreutils - CFLAGS="${CFLAGS} -pipe -O0 -s" ./configure --quiet --disable-gcc-warnings --disable-nls --disable-dependency-tracking --disable-bold-man-page-references \ + CFLAGS="${CFLAGS} -pipe -O0 -s" ./configure -C --quiet --disable-gcc-warnings --disable-nls --disable-dependency-tracking --disable-bold-man-page-references \ --enable-single-binary=symlinks \ "$([ "${SELINUX_ENABLED}" = 1 ] && echo --with-selinux || echo --without-selinux)" #Add timeout to to protect against hangs "${SED}" -i 's|^"\$@|'"${SYSTEM_TIMEOUT}"' 600 "\$@|' build-aux/test-driver # Use a better diff "${SED}" -i 's|diff -c|diff -u|g' tests/Coreutils.pm + + # Skip make if possible # Use our nproc for *BSD and macOS - "${MAKE}" -j "$("${UU_BUILD_DIR}/nproc")" + test -f src/getlimits || "${MAKE}" -j "$("${UU_BUILD_DIR}/nproc")" + cp -f src/getlimits "${UU_BUILD_DIR}" # Handle generated factor tests t_first=00 @@ -219,8 +222,6 @@ sed -i -e "s|---dis ||g" tests/tail/overlay-headers.sh -e "s|strace -e inotify_add_watch|strace -f -e inotify_add_watch|" \ tests/tail/inotify-dir-recreate.sh -test -f "${UU_BUILD_DIR}/getlimits" || cp src/getlimits "${UU_BUILD_DIR}" - # pr produces very long log and this command isn't super interesting # SKIP for now "${SED}" -i -e "s|my \$prog = 'pr';$|my \$prog = 'pr';CuSkip::skip \"\$prog: SKIP for producing too long logs\";|" tests/pr/pr-tests.pl