This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
TC CI #139
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: TC CI | |
on: | |
# Run CI for PRs to `main` and to release branches. | |
# | |
# Note that PRs to `main` will run a subset of tests and PRs to the | |
# `release-*` branches will run full CI. | |
pull_request: | |
branches: | |
- 'typed-continuations' | |
# Run full CI on the `typed-continuations` branch once a day to prime the GitHub Actions | |
# caches used by PRs and the merge queue. | |
schedule: | |
- cron: '13 4 * * *' | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
# Check Code style quickly by running `rustfmt` over all code | |
rustfmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: ./.github/actions/install-rust | |
- run: rustup component add rustfmt | |
- run: cargo fmt --all -- --check | |
# Checks of various feature combinations and whether things | |
# compile. The goal here isn't to run tests, mostly just serve as a | |
# double-check that Rust code compiles and is likely to work everywhere else. | |
checks: | |
name: Check | |
runs-on: ubuntu-latest | |
env: | |
CARGO_NDK_VERSION: 2.12.2 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: ./.github/actions/install-rust | |
# Check some feature combinations of the `wasmtime` crate | |
- run: cargo check -p wasmtime --no-default-features | |
- run: cargo check -p wasmtime --no-default-features --features wat | |
- run: cargo check -p wasmtime --no-default-features --features jitdump | |
- run: cargo check -p wasmtime --no-default-features --features vtune | |
- run: cargo check -p wasmtime --no-default-features --features cache | |
- run: cargo check -p wasmtime --no-default-features --features async | |
- run: cargo check -p wasmtime --no-default-features --features pooling-allocator | |
- run: cargo check -p wasmtime --no-default-features --features cranelift | |
- run: cargo check -p wasmtime --no-default-features --features component-model | |
- run: cargo check -p wasmtime --no-default-features --features cranelift,wat,async,cache | |
- run: cargo check -p wasmtime --no-default-features --features winch | |
- run: cargo check --features component-model | |
- run: cargo check -p wasmtime --features incremental-cache | |
# Check that benchmarks of the cranelift project build | |
- run: cargo check --benches -p cranelift-codegen | |
# Check some feature combinations of the `wasmtime-c-api` crate | |
- run: cargo check -p wasmtime-c-api --no-default-features | |
- run: cargo check -p wasmtime-c-api --no-default-features --features wat | |
- run: cargo check -p wasmtime-c-api --no-default-features --features wasi | |
# Check a few builds of the cranelift backend | |
# - only x86 backend support, | |
# - only arm64 backend support, | |
# - no debug_assertions. | |
- run: cargo check --manifest-path=./cranelift/Cargo.toml --bin clif-util --no-default-features --features=cranelift-codegen/arm64 | |
- run: cargo check --manifest-path=./cranelift/Cargo.toml --bin clif-util --no-default-features --features=cranelift-codegen/x86 | |
- run: cargo check --manifest-path=./cranelift/Cargo.toml --bin clif-util | |
env: | |
CARGO_PROFILE_DEV_DEBUG_ASSERTIONS: false | |
# Verify all fuzz targets compile successfully | |
fuzz_targets: | |
name: Fuzz Targets | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
# Note that building with fuzzers requires nightly since it uses unstable | |
# flags to rustc. | |
- uses: ./.github/actions/install-rust | |
with: | |
toolchain: nightly-2023-07-02 | |
- run: cargo install cargo-fuzz --vers "^0.11" | |
# Install the OCaml packages necessary for fuzz targets that use the | |
# `wasm-spec-interpreter`. | |
- run: sudo apt install -y ocaml-nox ocamlbuild ocaml-findlib libzarith-ocaml-dev | |
- run: cargo fetch | |
working-directory: ./fuzz | |
- run: cargo fuzz build --dev -s none | |
# Check that the ISLE fuzz targets build too. | |
- run: cargo fuzz build --dev -s none --fuzz-dir ./cranelift/isle/fuzz | |
# Perform all tests (debug mode) for `wasmtime`. | |
# | |
# Note that the full matrix for what may run here is defined within | |
# `./ci/build-test-matrix.js` and the execution of the `determine` step will | |
# calculate whether the tests are actually run as part of PRs and such. | |
test: | |
name: ${{ matrix.name }} | |
runs-on: ${{ matrix.os }} | |
env: | |
QEMU_BUILD_VERSION: 7.2.0 | |
strategy: | |
fail-fast: true | |
matrix: | |
os: | |
- ubuntu-latest | |
name: | |
- "Test Linux x86_64" | |
filter: | |
- "linux-x64" | |
isa: | |
- "x64" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: ./.github/actions/install-rust | |
# Install targets in order to build various tests throughout the repo | |
- run: rustup target add wasm32-wasi wasm32-unknown-unknown ${{ matrix.target }} | |
- run: echo CARGO_BUILD_TARGET=${{ matrix.target }} >> $GITHUB_ENV | |
if: matrix.target != '' | |
- run: cargo fetch --locked | |
- run: cargo fetch --locked --manifest-path crates/test-programs/wasi-tests/Cargo.toml | |
- run: cargo fetch --locked --manifest-path crates/test-programs/wasi-http-tests/Cargo.toml | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ runner.tool_cache }}/qemu | |
key: qemu-${{ matrix.target }}-${{ env.QEMU_BUILD_VERSION }}-patchcpuinfo | |
if: matrix.target != '' && matrix.os == 'ubuntu-latest' | |
- name: Install cross-compilation tools | |
run: | | |
set -ex | |
sudo apt-get update | |
sudo apt-get install -y ${{ matrix.gcc_package }} ninja-build | |
# Configure Cargo for cross compilation and tell it how it can run | |
# cross executables | |
upcase=$(echo ${{ matrix.target }} | awk '{ print toupper($0) }' | sed 's/-/_/g') | |
echo CARGO_TARGET_${upcase}_RUNNER=${{ runner.tool_cache }}/qemu/bin/${{ matrix.qemu }} >> $GITHUB_ENV | |
echo CARGO_TARGET_${upcase}_LINKER=${{ matrix.gcc }} >> $GITHUB_ENV | |
# QEMU emulation is not always the speediest, so total testing time | |
# goes down if we build the libs in release mode when running tests. | |
echo CARGO_PROFILE_DEV_OPT_LEVEL=2 >> $GITHUB_ENV | |
# See comments in the source for why we enable this during QEMU | |
# emulation. | |
echo WASMTIME_TEST_NO_HOG_MEMORY=1 >> $GITHUB_ENV | |
# See if qemu is already in the cache | |
if [ -f ${{ runner.tool_cache }}/qemu/built ]; then | |
exit 0 | |
fi | |
# Download and build qemu from source since the most recent release is | |
# way faster at arm emulation than the current version github actions' | |
# ubuntu image uses. Disable as much as we can to get it to build | |
# quickly. | |
curl https://download.qemu.org/qemu-$QEMU_BUILD_VERSION.tar.xz | tar xJf - | |
cd qemu-$QEMU_BUILD_VERSION | |
patch -p1 < $GITHUB_WORKSPACE/ci/qemu-cpuinfo.patch | |
./configure --target-list=${{ matrix.qemu_target }} --prefix=${{ runner.tool_cache}}/qemu --disable-tools --disable-slirp --disable-fdt --disable-capstone --disable-docs | |
ninja -C build install | |
touch ${{ runner.tool_cache }}/qemu/built | |
if: matrix.gcc != '' | |
# Build and test the C API with example C programs along with the example | |
# Rust programs. Note that this only executes if the `determine` step told | |
# us to test the capi which is off-by-default for PRs. | |
- run: cmake -Sexamples -Bexamples/build -DBUILD_SHARED_LIBS=OFF | |
if: matrix.target == '' | |
- run: cmake --build examples/build --config Debug | |
if: matrix.target == '' | |
# Build and test all features | |
- run: ./ci/run-tests.sh --locked | |
env: | |
RUST_BACKTRACE: 1 | |
# Test debug (DWARF) related functionality. | |
- run: | | |
sudo apt-get update && sudo apt-get install -y gdb lldb llvm | |
cargo test test_debug_dwarf -- --ignored --test-threads 1 | |
if: matrix.os == 'ubuntu-latest' && matrix.target == '' | |
env: | |
RUST_BACKTRACE: 1 |