Move all bindings-related code together (NFC) #1292
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push, pull_request] | |
jobs: | |
buildlibc: | |
name: Build libc | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
clang_version: [10.0.0] | |
# use different LLVM versions among oses because of the lack of | |
# official assets on github. | |
include: | |
- os: ubuntu-latest | |
clang_version: 10.0.0 | |
llvm_asset_suffix: x86_64-linux-gnu-ubuntu-18.04 | |
- os: macos-latest | |
clang_version: 10.0.0 | |
llvm_asset_suffix: x86_64-apple-darwin | |
- os: windows-latest | |
clang_version: 10.0.0 | |
- os: ubuntu-latest | |
clang_version: 16.0.0 | |
llvm_asset_suffix: x86_64-linux-gnu-ubuntu-18.04 | |
enable_pic: true | |
- os: macos-latest | |
clang_version: 15.0.7 | |
llvm_asset_suffix: x86_64-apple-darwin21.0 | |
- os: windows-latest | |
clang_version: 16.0.0 | |
enable_pic: true | |
steps: | |
- uses: actions/[email protected] | |
with: | |
submodules: true | |
- name: Install libtinfo5 | |
run: | | |
set -ex | |
sudo apt-get update | |
sudo apt-get install -y libtinfo5 | |
if: matrix.os == 'ubuntu-latest' | |
- name: Install LLVM tools (Windows) | |
shell: bash | |
run: | | |
curl -fsSLO https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ matrix.clang_version }}/LLVM-${{ matrix.clang_version }}-win64.exe | |
7z x LLVM-${{ matrix.clang_version }}-win64.exe -y -o"llvm" | |
echo "$(pwd)/llvm/bin" >> $GITHUB_PATH | |
echo "CC=$(pwd)/llvm/bin/clang.exe" >> $GITHUB_ENV | |
echo "AR=$(pwd)/llvm/bin/llvm-ar.exe" >> $GITHUB_ENV | |
echo "NM=$(pwd)/llvm/bin/llvm-nm.exe" >> $GITHUB_ENV | |
if: matrix.os == 'windows-latest' | |
- name: Override llvm-nm with one from rustup (Windows) | |
run: | | |
rustup update stable | |
rustup default stable | |
rustup component add llvm-tools-preview | |
echo "NM=$(rustc --print sysroot|sed 's|C:|/c|'|sed 's|\\|/|g')/lib/rustlib/x86_64-pc-windows-msvc/bin/llvm-nm.exe" >> $GITHUB_ENV | |
if: matrix.os == 'windows-latest' | |
- name: Install LLVM tools (MacOS) | |
shell: bash | |
run: | | |
curl -sSfL https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ matrix.clang_version }}/clang+llvm-${{ matrix.clang_version }}-${{ matrix.llvm_asset_suffix }}.tar.xz | tar xJf - | |
export CLANG_DIR=`pwd`/clang+llvm-${{ matrix.clang_version }}-${{ matrix.llvm_asset_suffix }}/bin | |
echo "$CLANG_DIR" >> $GITHUB_PATH | |
echo "CC=$CLANG_DIR/clang" >> $GITHUB_ENV | |
echo "AR=$CLANG_DIR/llvm-ar" >> $GITHUB_ENV | |
echo "NM=$CLANG_DIR/llvm-nm" >> $GITHUB_ENV | |
if: matrix.os == 'macos-latest' | |
- name: Install LLVM tools (Linux) | |
shell: bash | |
run: | | |
curl -sSfL https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ matrix.clang_version }}/clang+llvm-${{ matrix.clang_version }}-${{ matrix.llvm_asset_suffix }}.tar.xz | tar xJf - | |
export CLANG_DIR=`pwd`/clang+llvm-${{ matrix.clang_version }}-${{ matrix.llvm_asset_suffix }}/bin | |
echo "$CLANG_DIR" >> $GITHUB_PATH | |
echo "CLANG_DIR=$CLANG_DIR" >> $GITHUB_ENV | |
echo "CC=$CLANG_DIR/clang" >> $GITHUB_ENV | |
echo "AR=$CLANG_DIR/llvm-ar" >> $GITHUB_ENV | |
echo "NM=$CLANG_DIR/llvm-nm" >> $GITHUB_ENV | |
if: matrix.os == 'ubuntu-latest' | |
- name: Disable libsetjmp for old LLVM | |
shell: bash | |
run: | | |
echo "BUILD_LIBSETJMP=no" >> $GITHUB_ENV | |
if: matrix.clang_version == '10.0.0' | |
- name: Enable PIC build for new LLVM | |
shell: bash | |
run: | | |
echo "MAKE_TARGETS=default libc_so" >> $GITHUB_ENV | |
if: matrix.enable_pic | |
- name: Build libc | |
shell: bash | |
run: | | |
make -j4 TARGET_TRIPLE=wasm32-wasi $MAKE_TARGETS | |
make -j4 TARGET_TRIPLE=wasm32-wasip1 $MAKE_TARGETS | |
make -j4 TARGET_TRIPLE=wasm32-wasip2 WASI_SNAPSHOT=p2 $MAKE_TARGETS | |
- name: Build libc + threads | |
# Only build the thread-capable wasi-libc in the latest supported Clang | |
# version; the earliest version does not have all necessary builtins | |
# (e.g., `__builtin_wasm_memory_atomic_notify`). | |
if: matrix.clang_version != '10.0.0' | |
shell: bash | |
run: | | |
make -j4 THREAD_MODEL=posix TARGET_TRIPLE=wasm32-wasi-threads | |
make -j4 THREAD_MODEL=posix TARGET_TRIPLE=wasm32-wasip1-threads | |
- name: Test | |
shell: bash | |
# For Clang linking to work correctly, we need to place Clang's runtime | |
# library for `wasm32-wasi` in the right location (i.e., the `mkdir` and | |
# `cp` below). | |
run: | | |
cd test | |
make download | |
export WASI_DIR=$(realpath $($CLANG_DIR/clang -print-resource-dir)/lib/wasi/) | |
export WASIP1_DIR=$(realpath $($CLANG_DIR/clang -print-resource-dir)/lib/wasip1/) | |
export WASIP2_DIR=$(realpath $($CLANG_DIR/clang -print-resource-dir)/lib/wasip2/) | |
mkdir -p $WASI_DIR $WASIP1_DIR $WASIP2_DIR | |
cp download/libclang_rt.builtins-wasm32.a $WASI_DIR | |
cp download/libclang_rt.builtins-wasm32.a $WASIP1_DIR | |
cp download/libclang_rt.builtins-wasm32.a $WASIP2_DIR | |
TARGET_TRIPLE=wasm32-wasi make test | |
rm -r build | |
TARGET_TRIPLE=wasm32-wasip1 make test | |
rm -r build | |
TARGET_TRIPLE=wasm32-wasip2 make test | |
rm -r build | |
TARGET_TRIPLE=wasm32-wasi-threads make test | |
rm -r build | |
TARGET_TRIPLE=wasm32-wasip1-threads make test | |
# The older version of Clang does not provide the expected symbol for the | |
# test entrypoints: `undefined symbol: __main_argc_argv`. | |
# The older (<15.0.7) version of wasm-ld does not provide `__heap_end`, | |
# which is required by our malloc implementation. | |
if: matrix.os == 'ubuntu-latest' && matrix.clang_version != '10.0.0' | |
- uses: actions/[email protected] | |
with: | |
# Upload the sysroot folder. To avoid action erros, we give it a unique | |
# name using the OS it was built for and the Clang version it was built | |
# with. | |
name: ${{ format( 'sysroot-{0}-clang-{1}.tgz', matrix.os, matrix.clang_version) }} | |
path: sysroot | |
# Disable the headerstest job for now, while WASI transitions from the | |
# witx snapshots to wit proposals, and we have a few manual edits to the | |
# generated header to make life easier for folks. | |
headerstest: | |
if: ${{ false }} # Disable the headers test for now. | |
name: wasi-headers test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- uses: actions/[email protected] | |
with: | |
submodules: true | |
- name: Install Rust (rustup) | |
shell: bash | |
run: rustup update stable --no-self-update && rustup default stable | |
if: matrix.os != 'macos-latest' | |
- name: Install Rust (macos) | |
run: | | |
curl https://sh.rustup.rs | sh -s -- -y | |
echo "$HOME/.cargo/bin" >> $GITHUB_PATH | |
if: matrix.os == 'macos-latest' | |
- run: cargo fetch | |
working-directory: tools/wasi-headers | |
- run: cargo build | |
working-directory: tools/wasi-headers | |
- run: cargo test | |
working-directory: tools/wasi-headers | |
rustfmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
with: | |
submodules: true | |
- name: Install Rust | |
run: rustup update stable && rustup default stable && rustup component add rustfmt | |
- run: cargo fmt -- --check | |
working-directory: tools/wasi-headers |