@@ -2,10 +2,11 @@ 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 getenforce gperf lcov libexpect limactl pyinotify setenforce shopt texinfo valgrind libattr libcap taiki-e
5+ # spell-checker:ignore (libs/utils) chksum dpkg getenforce getlimits gperf lcov libexpect limactl pyinotify setenforce shopt valgrind libattr libcap taiki-e zstd cpio
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
9+ # spell-checker:ignore userns
910
1011# * note: to run a single test => `REPO/util/run-gnu-test.sh PATH/TO/TEST/SCRIPT`
1112
3031 TEST_STTY_FULL_SUMMARY_FILE : ' gnu-stty-full-result.json'
3132 TEST_SELINUX_FULL_SUMMARY_FILE : ' selinux-gnu-full-result.json'
3233 TEST_SELINUX_ROOT_FULL_SUMMARY_FILE : ' selinux-root-gnu-full-result.json'
34+ TEST_SMACK_FULL_SUMMARY_FILE : ' smack-gnu-full-result.json'
3335
3436jobs :
3537 native :
@@ -42,38 +44,22 @@ jobs:
4244 with :
4345 path : ' uutils'
4446 persist-credentials : false
45- - name : Extract GNU version from build-gnu.sh
46- id : gnu-version
47- run : |
48- GNU_VERSION=$(grep '^release_tag_GNU=' uutils/util/build-gnu.sh | cut -d'"' -f2)
49- if [ -z "$GNU_VERSION" ]; then
50- echo "Error: Failed to extract GNU version from build-gnu.sh"
51- exit 1
52- fi
53- echo "REPO_GNU_REF=${GNU_VERSION}" >> $GITHUB_ENV
54- echo "Extracted GNU version: ${GNU_VERSION}"
5547 - uses : dtolnay/rust-toolchain@master
5648 with :
5749 toolchain : stable
58- components : rustfmt
5950 - uses : Swatinem/rust-cache@v2
6051 with :
6152 workspaces : " ./uutils -> target"
6253 - name : Checkout code (GNU coreutils)
63- uses : actions/checkout@v6
54+ run : (mkdir -p gnu && cd gnu && bash ../uutils/util/fetch-gnu.sh)
55+ - name : Restore files for faster configure and skipping make
56+ uses : actions/cache@v5
57+ id : cache-config-gnu
6458 with :
65- repository : ' coreutils/coreutils'
66- path : ' gnu'
67- ref : ${{ env.REPO_GNU_REF }}
68- submodules : false
69- persist-credentials : false
70- - name : Override submodule URL and initialize submodules
71- # Use github instead of upstream git server
72- run : |
73- git submodule sync --recursive
74- git config submodule.gnulib.url https://github.com/coreutils/gnulib.git
75- git submodule update --init --recursive --depth 1
76- working-directory : gnu
59+ path : |
60+ gnu/config.cache
61+ gnu/src/getlimits
62+ key : ${{ runner.os }}-gnu-config-${{ hashFiles('gnu/NEWS') }}-${{ hashFiles('uutils/util/build-gnu.sh') }} # use build-gnu.sh for extremely safe caching
7763
7864 # ### Build environment setup
7965 - name : Install dependencies
8268 ## Install dependencies
8369 sudo apt-get update
8470 ## Check that build-gnu.sh works on the non SELinux system by installing libselinux only on lima
85- sudo apt-get install -y autopoint gperf gdb python3-pyinotify valgrind libexpect-perl libacl1-dev libattr1-dev libcap-dev attr quilt
71+ sudo apt-get install -y gperf gdb python3-pyinotify valgrind libexpect-perl libacl1-dev libattr1-dev libcap-dev attr quilt
72+ curl http://launchpadlibrarian.net/831710181/automake_1.18.1-3_all.deb > automake-1.18.deb
73+ sudo dpkg -i --force-depends automake-1.18.deb
8674 - name : Add various locales
8775 shell : bash
8876 run : |
10492 sudo locale-gen --keep-existing am_ET.UTF-8 # Ethiopia
10593 sudo locale-gen --keep-existing th_TH.UTF-8 # Thailand
10694 sudo locale-gen --keep-existing ja_JP.UTF-8 # Japan
95+ sudo locale-gen --keep-existing zh_CN.GB18030 # China
10796
10897 sudo update-locale
10998 echo "After:"
@@ -117,10 +106,22 @@ jobs:
117106 cd 'uutils'
118107 env PROFILE=release-small bash util/build-gnu.sh
119108
109+ - name : Save files for faster configure and skipping make
110+ uses : actions/cache/save@v5
111+ if : always() && steps.cache-config-gnu.outputs.cache-hit != 'true'
112+ with :
113+ path : |
114+ gnu/config.cache
115+ gnu/src/getlimits
116+ key : ${{ runner.os }}-gnu-config-${{ hashFiles('gnu/NEWS') }}-${{ hashFiles('uutils/util/build-gnu.sh') }}
117+
120118 # ## Run tests as user
121119 - name : Run GNU tests
122120 shell : bash
123121 run : |
122+ ## Use unshare
123+ sudo sysctl -w kernel.unprivileged_userns_clone=1
124+ sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
124125 ## Run GNU tests
125126 path_GNU='gnu'
126127 path_UUTILS='uutils'
@@ -207,38 +208,14 @@ jobs:
207208 with :
208209 path : ' uutils'
209210 persist-credentials : false
210- - name : Extract GNU version from build-gnu.sh
211- id : gnu-version-selinux
212- run : |
213- GNU_VERSION=$(grep '^release_tag_GNU=' uutils/util/build-gnu.sh | cut -d'"' -f2)
214- if [ -z "$GNU_VERSION" ]; then
215- echo "Error: Failed to extract GNU version from build-gnu.sh"
216- exit 1
217- fi
218- echo "REPO_GNU_REF=${GNU_VERSION}" >> $GITHUB_ENV
219- echo "Extracted GNU version: ${GNU_VERSION}"
220211 - uses : dtolnay/rust-toolchain@master
221212 with :
222213 toolchain : stable
223- components : rustfmt
224214 - uses : Swatinem/rust-cache@v2
225215 with :
226216 workspaces : " ./uutils -> target"
227217 - name : Checkout code (GNU coreutils)
228- uses : actions/checkout@v6
229- with :
230- repository : ' coreutils/coreutils'
231- path : ' gnu'
232- ref : ${{ env.REPO_GNU_REF }}
233- submodules : false
234- persist-credentials : false
235- - name : Override submodule URL and initialize submodules
236- # Use github instead of upstream git server
237- run : |
238- git submodule sync --recursive
239- git config submodule.gnulib.url https://github.com/coreutils/gnulib.git
240- git submodule update --init --recursive --depth 1
241- working-directory : gnu
218+ run : (mkdir -p gnu && cd gnu && bash ../uutils/util/fetch-gnu.sh)
242219
243220 # ### Lima build environment setup
244221 - name : Setup Lima
@@ -269,8 +246,8 @@ jobs:
269246 - name : Install dependencies in VM
270247 run : |
271248 lima sudo dnf -y update
272- lima sudo dnf -y install git autoconf autopoint bison texinfo gperf gcc gdb jq libacl-devel libattr-devel libcap-devel libselinux-devel attr rustup clang-devel texinfo-tex automake patch quilt
273- lima rustup-init -y --default-toolchain stable
249+ lima sudo dnf -y install autoconf bison gperf gcc gdb jq libacl-devel libattr-devel libcap-devel libselinux-devel attr rustup clang-devel automake patch quilt
250+ lima rustup-init -y --profile=minimal -- default-toolchain stable
274251 - name : Copy the sources to VM
275252 run : |
276253 rsync -a -e ssh . lima-default:~/work/
@@ -341,8 +318,51 @@ jobs:
341318 gnu/tests-selinux/*.log
342319 gnu/tests-selinux/*/*.log.gz
343320
321+ smack :
322+ name : Run GNU tests (SMACK)
323+ runs-on : ubuntu-24.04
324+ steps :
325+ - name : Checkout code (uutils)
326+ uses : actions/checkout@v6
327+ with :
328+ path : ' uutils'
329+ persist-credentials : false
330+ - uses : dtolnay/rust-toolchain@master
331+ with :
332+ toolchain : stable
333+ - uses : Swatinem/rust-cache@v2
334+ with :
335+ workspaces : " ./uutils -> target"
336+ - name : Checkout code (GNU coreutils)
337+ run : (mkdir -p gnu && cd gnu && bash ../uutils/util/fetch-gnu.sh)
338+ - name : Install dependencies
339+ run : |
340+ sudo apt-get update
341+ sudo apt-get install -y qemu-system-x86 zstd cpio
342+ - name : Run GNU SMACK tests
343+ run : |
344+ cd uutils
345+ bash util/run-gnu-tests-smack-ci.sh "$GITHUB_WORKSPACE/gnu" "$GITHUB_WORKSPACE/gnu/tests-smack"
346+ - name : Extract testing info into JSON
347+ run : |
348+ python3 uutils/util/gnu-json-result.py gnu/tests-smack > ${{ env.TEST_SMACK_FULL_SUMMARY_FILE }}
349+ - name : Upload SMACK json results
350+ uses : actions/upload-artifact@v6
351+ with :
352+ name : smack-gnu-full-result
353+ path : ${{ env.TEST_SMACK_FULL_SUMMARY_FILE }}
354+ - name : Compress SMACK test logs
355+ run : gzip gnu/tests-smack/*/*.log 2>/dev/null || true
356+ - name : Upload SMACK test logs
357+ uses : actions/upload-artifact@v6
358+ with :
359+ name : smack-test-logs
360+ path : |
361+ gnu/tests-smack/*.log
362+ gnu/tests-smack/*/*.log.gz
363+
344364 aggregate :
345- needs : [native, selinux]
365+ needs : [native, selinux, smack ]
346366 permissions :
347367 actions : read # for dawidd6/action-download-artifact to query and download artifacts
348368 contents : read # for actions/checkout to fetch code
@@ -367,7 +387,7 @@ jobs:
367387 path : ' uutils'
368388 persist-credentials : false
369389 - name : Retrieve reference artifacts
370- uses : dawidd6/action-download-artifact@v11
390+ uses : dawidd6/action-download-artifact@v12
371391 # ref: <https://github.com/dawidd6/action-download-artifact>
372392 continue-on-error : true # # don't break the build for missing reference artifacts (may be expired or just not generated yet)
373393 with :
@@ -407,6 +427,12 @@ jobs:
407427 name : selinux-root-gnu-full-result
408428 path : results
409429 merge-multiple : true
430+ - name : Download smack json results
431+ uses : actions/download-artifact@v7
432+ with :
433+ name : smack-gnu-full-result
434+ path : results
435+ merge-multiple : true
410436 - name : Extract/summarize testing info
411437 id : summary
412438 shell : bash
@@ -417,8 +443,8 @@ jobs:
417443 path_UUTILS='uutils'
418444
419445 json_count=$(ls -l results/*.json | wc -l)
420- if [[ "$json_count" -ne 5 ]]; then
421- echo "::error ::Failed to download all results json files (expected 4 files, found $json_count); failing early"
446+ if [[ "$json_count" -ne 6 ]]; then
447+ echo "::error ::Failed to download all results json files (expected 6 files, found $json_count); failing early"
422448 ls -lR results || true
423449 exit 1
424450 fi
0 commit comments