Skip to content

Commit f72130e

Browse files
authored
GnuTests: Caches for faster configure and skipping make (#9627)
1 parent 3de9411 commit f72130e

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

.github/workflows/GnuTests.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: GnuTests
22

33
# spell-checker:ignore (abbrev/names) CodeCov gnulib GnuTests Swatinem
44
# spell-checker:ignore (jargon) submodules devel
5-
# spell-checker:ignore (libs/utils) autopoint chksum dpkg getenforce gperf lcov libexpect limactl pyinotify setenforce shopt texinfo valgrind libattr libcap taiki-e
5+
# spell-checker:ignore (libs/utils) autopoint chksum dpkg getenforce getlimits gperf lcov libexpect limactl pyinotify setenforce shopt texinfo valgrind libattr libcap taiki-e
66
# spell-checker:ignore (options) Ccodegen Coverflow Cpanic Zpanic
77
# spell-checker:ignore (people) Dawid Dziurla * dawidd dtolnay
88
# spell-checker:ignore (vars) FILESET SUBDIRS XPASS
@@ -51,7 +51,17 @@ jobs:
5151
workspaces: "./uutils -> target"
5252
- name: Checkout code (GNU coreutils)
5353
run: (mkdir -p gnu && cd gnu && bash ../uutils/util/fetch-gnu.sh)
54-
54+
- name: Restore files for faster configure and skipping make
55+
uses: actions/cache@v5
56+
id: cache-config-gnu
57+
with:
58+
path: |
59+
gnu/config.cache
60+
gnu/src/getlimits
61+
key: ${{ runner.os }}-gnu-config-${{ env.REPO_GNU_REF }}-${{ hashFiles('gnu/configure') }}
62+
restore-keys: |
63+
${{ runner.os }}-gnu-config-${{ env.REPO_GNU_REF }}-
64+
${{ runner.os }}-gnu-config-
5565
#### Build environment setup
5666
- name: Install dependencies
5767
shell: bash
@@ -94,6 +104,15 @@ jobs:
94104
## Build binaries
95105
cd 'uutils'
96106
env PROFILE=release-small bash util/build-gnu.sh
107+
108+
- name: Save files for faster configure and skipping make
109+
uses: actions/cache/save@v5
110+
if: always() && steps.cache-config-gnu.outputs.cache-hit != 'true'
111+
with:
112+
path: |
113+
gnu/config.cache
114+
gnu/src/getlimits
115+
key: ${{ runner.os }}-gnu-config-${{ env.REPO_GNU_REF }}-${{ hashFiles('gnu/configure') }}
97116

98117
### Run tests as user
99118
- name: Run GNU tests

util/build-gnu.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,21 +120,24 @@ done
120120

121121
if test -f gnu-built; then
122122
echo "GNU build already found. Skip"
123-
echo "'rm -f $(pwd)/gnu-built' to force the build"
123+
echo "'rm -f $(pwd)/{gnu-built,src/getlimits}' to force the build"
124124
echo "Note: the customization of the tests will still happen"
125125
else
126126
# Disable useless checks
127127
"${SED}" -i 's|check-texinfo: $(syntax_checks)|check-texinfo:|' doc/local.mk
128128
# Use CFLAGS for best build time since we discard GNU coreutils
129-
CFLAGS="${CFLAGS} -pipe -O0 -s" ./configure --quiet --disable-gcc-warnings --disable-nls --disable-dependency-tracking --disable-bold-man-page-references \
129+
CFLAGS="${CFLAGS} -pipe -O0 -s" ./configure -C --quiet --disable-gcc-warnings --disable-nls --disable-dependency-tracking --disable-bold-man-page-references \
130130
--enable-single-binary=symlinks \
131131
"$([ "${SELINUX_ENABLED}" = 1 ] && echo --with-selinux || echo --without-selinux)"
132132
#Add timeout to to protect against hangs
133133
"${SED}" -i 's|^"\$@|'"${SYSTEM_TIMEOUT}"' 600 "\$@|' build-aux/test-driver
134134
# Use a better diff
135135
"${SED}" -i 's|diff -c|diff -u|g' tests/Coreutils.pm
136+
137+
# Skip make if possible
136138
# Use our nproc for *BSD and macOS
137-
"${MAKE}" -j "$("${UU_BUILD_DIR}/nproc")"
139+
test -f src/getlimits || "${MAKE}" -j "$("${UU_BUILD_DIR}/nproc")"
140+
cp -f src/getlimits "${UU_BUILD_DIR}"
138141

139142
# Handle generated factor tests
140143
t_first=00
@@ -219,8 +222,6 @@ sed -i -e "s|---dis ||g" tests/tail/overlay-headers.sh
219222
-e "s|strace -e inotify_add_watch|strace -f -e inotify_add_watch|" \
220223
tests/tail/inotify-dir-recreate.sh
221224

222-
test -f "${UU_BUILD_DIR}/getlimits" || cp src/getlimits "${UU_BUILD_DIR}"
223-
224225
# pr produces very long log and this command isn't super interesting
225226
# SKIP for now
226227
"${SED}" -i -e "s|my \$prog = 'pr';$|my \$prog = 'pr';CuSkip::skip \"\$prog: SKIP for producing too long logs\";|" tests/pr/pr-tests.pl

0 commit comments

Comments
 (0)