Skip to content

Fix using invalidated Wasm memory (#2047) #6113

Fix using invalidated Wasm memory (#2047)

Fix using invalidated Wasm memory (#2047) #6113

Workflow file for this run

# Smoldot
# Copyright (C) 2019-2022 Parity Technologies (UK) Ltd.
# SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
name: continuous-integration
on:
pull_request:
merge_group:
push:
branches:
- main # Running the CI on the main branch is important in order to fill the caches that pull requests will pick up.
permissions: read-all
jobs:
test-64bits:
runs-on: ubuntu-latest
container:
image: rust:1.82
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- run: RUSTFLAGS=-Dwarnings cargo test --locked --workspace --all-features
test-32bits:
runs-on: ubuntu-latest
container:
image: rust:1.82
steps:
- run: apt-get update && apt install -y libc6-dev-i386
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- run: rustup target add i686-unknown-linux-gnu
- run: RUSTFLAGS=-Dwarnings cargo test --target i686-unknown-linux-gnu --locked --workspace --all-features
wasm-node-check:
runs-on: ubuntu-latest
container:
image: rust:1.82
steps:
- uses: actions/checkout@v4
- run: rustup target add wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-node@v4.0.3
with:
# Set to the oldest version still maintained, in order to ensure compatibility. See <https://nodejs.dev/en/about/releases/>
node-version: '18'
- uses: denoland/setup-deno@v2
with:
deno-version: v1.x
- run: cd wasm-node/javascript && RUSTFLAGS=-Dwarnings npm install-ci-test
check-features:
runs-on: ubuntu-latest
container:
image: rust:1.82
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- run: apt-get update && apt install -y libc6-dev-i386
- run: rustup target add i686-unknown-linux-gnu
# We test for both x86_64 and i686 because there is some `cfg(target_arch = "x86_64")`
# conditional compilation within the source code.
- run: RUSTFLAGS=-Dwarnings cargo check --target x86_64-unknown-linux-gnu --package smoldot --locked --no-default-features
- run: RUSTFLAGS=-Dwarnings cargo check --target i686-unknown-linux-gnu --package smoldot --locked --no-default-features
- run: RUSTFLAGS=-Dwarnings cargo check --target x86_64-unknown-linux-gnu --package smoldot --locked --no-default-features --features database-sqlite
- run: RUSTFLAGS=-Dwarnings cargo check --target i686-unknown-linux-gnu --package smoldot --locked --no-default-features --features database-sqlite
- run: RUSTFLAGS=-Dwarnings cargo check --target x86_64-unknown-linux-gnu --package smoldot --locked --no-default-features --features std
- run: RUSTFLAGS=-Dwarnings cargo check --target i686-unknown-linux-gnu --package smoldot --locked --no-default-features --features std
- run: RUSTFLAGS=-Dwarnings cargo check --target x86_64-unknown-linux-gnu --package smoldot --locked --no-default-features --features database-sqlite --features std
- run: RUSTFLAGS=-Dwarnings cargo check --target i686-unknown-linux-gnu --package smoldot --locked --no-default-features --features database-sqlite --features std
- run: RUSTFLAGS=-Dwarnings cargo check --target x86_64-unknown-linux-gnu --package smoldot --locked --no-default-features --features database-sqlite --features wasmtime
- run: RUSTFLAGS=-Dwarnings cargo check --target i686-unknown-linux-gnu --package smoldot --locked --no-default-features --features database-sqlite --features wasmtime
- run: RUSTFLAGS=-Dwarnings cargo check --target x86_64-unknown-linux-gnu --package smoldot --locked --no-default-features --features std --features wasmtime
- run: RUSTFLAGS=-Dwarnings cargo check --target i686-unknown-linux-gnu --package smoldot --locked --no-default-features --features std --features wasmtime
- run: RUSTFLAGS=-Dwarnings cargo check --target x86_64-unknown-linux-gnu --package smoldot --locked --no-default-features --features database-sqlite --features std --features wasmtime
- run: RUSTFLAGS=-Dwarnings cargo check --target i686-unknown-linux-gnu --package smoldot --locked --no-default-features --features database-sqlite --features std --features wasmtime
- run: RUSTFLAGS=-Dwarnings cargo check --target x86_64-unknown-linux-gnu --package smoldot-light --locked --no-default-features
- run: RUSTFLAGS=-Dwarnings cargo check --target i686-unknown-linux-gnu --package smoldot-light --locked --no-default-features
- run: RUSTFLAGS=-Dwarnings cargo check --target x86_64-unknown-linux-gnu --package smoldot-light --locked --no-default-features --features std
- run: RUSTFLAGS=-Dwarnings cargo check --target i686-unknown-linux-gnu --package smoldot-light --locked --no-default-features --features std
- run: RUSTFLAGS=-Dwarnings cargo check --target x86_64-unknown-linux-gnu --package smoldot-light --locked --no-default-features --features wasmtime
- run: RUSTFLAGS=-Dwarnings cargo check --target i686-unknown-linux-gnu --package smoldot-light --locked --no-default-features --features wasmtime
- run: RUSTFLAGS=-Dwarnings cargo check --target x86_64-unknown-linux-gnu --package smoldot-light --locked --no-default-features --features std --features wasmtime
- run: RUSTFLAGS=-Dwarnings cargo check --target i686-unknown-linux-gnu --package smoldot-light --locked --no-default-features --features std --features wasmtime
check-no-std:
runs-on: ubuntu-latest
container:
image: rust:1.82
steps:
- uses: actions/checkout@v4
- run: rustup target add thumbv7m-none-eabi
- uses: Swatinem/rust-cache@v2
# We use `thumbv7m-none-eabi` as this target seems to generally work fine and doesn't support `std`. Many targets unfortunately have Rust/LLVM bugs preventing compilation.
- run: RUSTFLAGS=-Dwarnings cargo build --package smoldot --locked --no-default-features --target=thumbv7m-none-eabi
- run: RUSTFLAGS=-Dwarnings cargo build --package smoldot-light --locked --no-default-features --target=thumbv7m-none-eabi
check-rustdoc-links:
runs-on: ubuntu-latest
container:
image: rust:1.82
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- run: RUSTDOCFLAGS=-Dwarnings cargo doc --verbose --workspace --all-features --no-deps --document-private-items
fmt:
runs-on: ubuntu-latest
container:
image: rust:1.82
steps:
# Checks `rustfmt` formatting
- uses: actions/checkout@v4
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
# TODO: as explained in the official repo (https://github.com/actions-rs/clippy), this action uses unstable GH actions features, but has the huge advantage of not requiring `GITHUB_TOKEN` and working on PRs from forked repositories ; should eventually replace `actions-rs/clippy@master` with a specific version
clippy:
runs-on: ubuntu-latest
container:
image: rust:1.82
steps:
- uses: actions/checkout@v4
# Since build artifacts are specific to a nightly version, we pin the specific nightly
# version to use in order to not invalidate the build cache every day. The exact version
# is completely arbitrary.
- run: rustup default nightly-2023-07-15
- uses: Swatinem/rust-cache@v2 # Note that this is done after switching the compiler version to nightly
- uses: actions-rs/clippy@master
with:
args: --all-features --all-targets
cargo-deny:
runs-on: ubuntu-latest
strategy:
matrix:
# The `advisories` check isn't done, because pragmatically speaking it fails CI too often.
# See `audit.yml` instead.
checks:
- bans licenses sources
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check --config .github/cargo-deny.toml ${{ matrix.checks }}
arguments: --workspace --all-features
cargo-spellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: sudo apt-get update && sudo apt install -y libclang-dev # Required by cargo-spellcheck
- uses: baptiste0928/cargo-install@v3 # This action ensures that the compilation is cached.
with:
crate: cargo-spellcheck
version: 0.11.2
- run: cargo spellcheck -m 99
wasm-node-versions-match:
runs-on: ubuntu-latest
container:
image: rust:1.82
steps:
- uses: actions/checkout@v4
- run: apt-get update && apt install -y jq
# Compares whether the version in `package.json` matches the version in `Cargo.toml`.
- id: js-version
run: echo "version=`jq .version ./wasm-node/javascript/package.json`" >> $GITHUB_OUTPUT
- id: rust-version
run: echo "version=`cargo read-manifest --manifest-path=./wasm-node/rust/Cargo.toml | jq .version`" >> $GITHUB_OUTPUT
- run: exit 1
if: ${{ steps.js-version.outputs.version == '' }} # Defensive test against mistakes in the CI script
- run: exit 1
if: ${{ steps.js-version.outputs.version != steps.rust-version.outputs.version }}
all-ci:
# This dummy job depends on all the mandatory checks. It succeeds if and only if CI is
# considered successful.
needs: [test-64bits, test-32bits, wasm-node-check, check-features, check-no-std, check-rustdoc-links, fmt, clippy, cargo-deny, cargo-spellcheck, wasm-node-versions-match]
runs-on: ubuntu-latest
steps:
- run: echo Success