From e7619184f25803eaee1c0706c4ff028f7d2a85ea Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 8 Aug 2026 01:12:58 +0200 Subject: [PATCH] ci: install a WASI sysroot so expr builds for wasm --- .github/workflows/CICD.yml | 7 ++++++- .github/workflows/code-quality.yml | 10 +++++++++- .github/workflows/wasi.yml | 9 +++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 72147c4721..63fd24bb2e 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -5,7 +5,7 @@ name: CICD # spell-checker:ignore (jargon) SHAs deps dequote softprops subshell toolchain fuzzers dedupe devel profdata profraw # spell-checker:ignore (people) Peltoche rivy Anson dawidd # spell-checker:ignore (shell/tools) binutils choco clippy dmake esac fakeroot fdesc fdescfs gmake grcov halium lcov libclang libcrypto libfuse libssl limactl nextest nocross pacman popd printf pushd redoxer rsync rustc rustfmt rustup shopt sccache setfacl utmpdump xargs zstd -# 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 tempfile testsuite toybox uutils libsystemd codspeed wasip libexecinfo +# 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 tempfile testsuite toybox uutils libsystemd codspeed wasip libexecinfo oniguruma sysroot env: PROJECT_NAME: coreutils @@ -543,6 +543,11 @@ jobs: sudo apt-get -y update sudo apt-get -y install fuse3 libfuse-dev ;; + wasm32-wasi*) + # expr depends on oniguruma, a C library, so cross-compiling needs a WASI sysroot + sudo apt-get -y update + sudo apt-get -y install clang wasi-libc + ;; esac case '${{ matrix.job.os }}' in macos-latest) brew install coreutils ;; # needed for testing diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index e2abcf45a3..3d5340b62f 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -1,7 +1,7 @@ name: Code Quality # spell-checker:ignore (people) juliangruber pell reactivecircus taiki-e taplo -# spell-checker:ignore (misc) TERMUX noaudio pkill swiftshader esac sccache pcoreutils shopt subshell dequote libsystemd +# spell-checker:ignore (misc) TERMUX noaudio pkill swiftshader esac sccache pcoreutils shopt subshell dequote libsystemd oniguruma sysroot wasi on: pull_request: @@ -119,6 +119,14 @@ jobs: sudo apt-get -y install libselinux1-dev libsystemd-dev ;; esac + - name: Install/setup WASI prerequisites + if: startsWith(matrix.job.target, 'wasm32-wasi') + shell: bash + run: | + ## Install/setup WASI prerequisites + # expr depends on oniguruma, a C library, so cross-compiling needs a WASI sysroot + sudo apt-get -y update + sudo apt-get -y install clang wasi-libc - name: "`cargo clippy` lint testing" uses: nick-fields/retry@v4 with: diff --git a/.github/workflows/wasi.yml b/.github/workflows/wasi.yml index 5072ccc573..a52dd8a700 100644 --- a/.github/workflows/wasi.yml +++ b/.github/workflows/wasi.yml @@ -1,4 +1,4 @@ -# spell-checker:ignore wasip wasmtime +# spell-checker:ignore wasip wasmtime oniguruma sysroot name: WASI # spell-checker:ignore TRIGGERPATH @@ -36,6 +36,11 @@ jobs: - uses: Swatinem/rust-cache@v2 with: key: "${{ matrix.job.target }}" + - name: Install WASI sysroot + run: | + # expr depends on oniguruma, a C library, so cross-compiling needs a WASI sysroot + sudo apt-get -y update + sudo apt-get -y install clang wasi-libc - name: Install wasmtime run: | curl https://wasmtime.dev/install.sh -sSf | bash @@ -46,7 +51,7 @@ jobs: CARGO_TARGET_WASM32_WASIP2_RUNNER: wasmtime run: | # Get all utilities and exclude ones that don't compile for ${{ matrix.job.target }} - EXCLUDE="df|du|env|expr|more|tac|test" + EXCLUDE="df|du|env|more|tac|test" UTILS=$(./util/show-utils.sh | tr ' ' '\n' | grep -vE "^($EXCLUDE)$" | sed 's/^/-p uu_/' | tr '\n' ' ') cargo test --target ${{ matrix.job.target }} --no-default-features $UTILS - name: Run integration tests via wasmtime