-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update deps, improve contributing guidelines, improve ci
Signed-off-by: Henry Gressmann <[email protected]>
- Loading branch information
1 parent
4238c92
commit fee68d0
Showing
18 changed files
with
271 additions
and
341 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,132 +24,73 @@ jobs: | |
name: wasm | ||
path: examples/rust/out | ||
|
||
test-std: | ||
run-tests: | ||
needs: build-wasm | ||
name: Test with default features on stable Rust | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
rust: stable | ||
name: "Linux (stable)" | ||
- os: ubuntu-latest | ||
rust: nightly | ||
name: "Linux (nightly)" | ||
- os: ubuntu-latest | ||
rust: stable | ||
name: "Linux (stable, no default features)" | ||
args: "--no-default-features" | ||
- os: ubuntu-latest | ||
rust: nightly | ||
name: "Linux (nightly, no default features)" | ||
args: "--no-default-features" | ||
- os: macos-14 | ||
rust: stable | ||
name: "macOS arm64 (Apple M1)" | ||
- os: ubuntu-latest | ||
rust: stable | ||
name: "armv7 (32-Bit Raspberry Pi)" | ||
target: armv7-unknown-linux-gnueabihf | ||
|
||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Install latest stable Rust toolchain | ||
run: rustup update stable | ||
|
||
- name: Load wasm | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: wasm | ||
path: examples/rust/out | ||
|
||
- name: Build (stable) | ||
run: cargo +stable build --workspace | ||
|
||
- name: Run tests (stable) | ||
run: cargo +stable test --workspace && cargo +stable run --example wasm-rust all | ||
|
||
- name: Run MVP testsuite | ||
run: cargo +stable test-wasm-1 | ||
|
||
- name: Run 2.0 testsuite | ||
run: cargo +stable test-wasm-2 | ||
|
||
test-no-std: | ||
needs: build-wasm | ||
name: Test without default features on nightly Rust | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Rust toolchain | ||
uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: | ||
submodules: true | ||
|
||
- name: Install latest nightly Rust toolchain | ||
run: rustup update nightly | ||
toolchain: ${{ matrix.rust }} | ||
rustflags: "" | ||
components: rustfmt, clippy | ||
if: matrix.target == '' | ||
|
||
- name: Load wasm | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: wasm | ||
path: examples/rust/out | ||
|
||
- name: Build (nightly, no default features) | ||
run: cargo +nightly build --workspace --no-default-features | ||
|
||
- name: Run tests (nightly, no default features) | ||
run: cargo +nightly test --workspace --no-default-features && cargo +nightly run --example wasm-rust all | ||
- name: Run tests | ||
run: cargo test --workspace ${{ matrix.args }} && cargo run --example wasm-rust all | ||
if: matrix.target == '' | ||
|
||
- name: Run MVP testsuite | ||
run: cargo +nightly test-wasm-1 | ||
|
||
- name: Run 2.0 testsuite | ||
run: cargo +nightly test-wasm-2 | ||
|
||
test-m1: | ||
needs: build-wasm | ||
name: Test on arm64 (Apple M1) | ||
runs-on: macos-14 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- name: Install stable Rust toolchain | ||
run: rustup update stable | ||
- name: Run clippy | ||
run: cargo clippy --workspace --all-targets --all-features | ||
if: matrix.target == '' | ||
|
||
- name: Load wasm | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: wasm | ||
path: examples/rust/out | ||
|
||
- name: Build (stable) | ||
run: cargo +stable build | ||
|
||
- name: Run tests (stable) | ||
run: cargo +stable test | ||
|
||
- name: Run MVP testsuite | ||
run: cargo +stable test-wasm-1 | ||
|
||
- name: Run 2.0 testsuite | ||
run: cargo +stable test-wasm-2 | ||
|
||
test-armv7: | ||
needs: build-wasm | ||
name: Test on armv7 (32-Bit Raspberry Pi) | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Load wasm | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: wasm | ||
path: examples/rust/out | ||
|
||
- name: Run all tests (for the default workspace members) | ||
- name: Run tests (${{ matrix.target }}) | ||
uses: houseabsolute/[email protected] | ||
with: | ||
command: test | ||
target: armv7-unknown-linux-gnueabihf | ||
toolchain: nightly | ||
target: ${{ matrix.target }} | ||
toolchain: ${{ matrix.rust }} | ||
if: matrix.target != '' | ||
|
||
- name: Run MVP testsuite | ||
- name: Run clippy (${{ matrix.target }}) | ||
uses: houseabsolute/[email protected] | ||
with: | ||
command: test | ||
args: "-p tinywasm --test test-wasm-1 --release" | ||
target: armv7-unknown-linux-gnueabihf | ||
toolchain: nightly | ||
|
||
- name: Run 2.0 testsuite | ||
uses: houseabsolute/[email protected] | ||
with: | ||
command: test | ||
args: "-p tinywasm --test test-wasm-2 --release" | ||
target: armv7-unknown-linux-gnueabihf | ||
toolchain: nightly | ||
command: clippy | ||
target: ${{ matrix.target }} | ||
toolchain: ${{ matrix.rust }} | ||
if: matrix.target != '' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,69 @@ | ||
# Scripts and Commands | ||
# Contributing | ||
|
||
> To improve the development experience, a number of custom commands and aliases have been added to the `.cargo/config.toml` file. These can be run using `cargo <command>`. | ||
Thank you for considering contributing to this project! This document outlines the process for contributing to this project. For small changes or bug fixes, feel free to open a pull request directly. For larger changes, please open an issue first to discuss the proposed changes. Also, please ensure that you open up your pull request against the `next` branch and [allow maintainers of the project to edit your code](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork). | ||
|
||
- **`cargo test-wasm-1`**\ | ||
Run the WebAssembly MVP (1.0) test suite. Be sure to cloned this repo with `--recursive` or initialize the submodules with `git submodule update --init --recursive` | ||
## 1. Clone the Repository | ||
|
||
- **`cargo test-wasm-2`**\ | ||
Run the full WebAssembly test suite (2.0) | ||
Ensure you clone this repository with the `--recursive` flag to include the submodules: | ||
|
||
- **`cargo test-wast <path>`**\ | ||
Run a single WAST test file. e.g. `cargo test-wast ./examples/wast/i32.wast`. Useful for debugging failing test-cases. | ||
```bash | ||
git clone --recursive https://github.com/explodingcamera/tinywasm.git | ||
``` | ||
|
||
If you have already cloned the repository, you can initialize the submodules with: | ||
|
||
```bash | ||
git submodule update --init --recursive | ||
``` | ||
|
||
This is required to run the WebAssembly test suite. | ||
|
||
## 2. Set up the Development Environment | ||
|
||
This project mostly uses a pretty standard Rust setup. Some common tasks: | ||
|
||
```bash | ||
# Run a specific benchmark (run without arguments to see available benchmarks) | ||
$ cargo bench --bench {bench_name} | ||
|
||
# Run all tests | ||
$ cargo test | ||
|
||
# Run only the WebAssembly MVP (1.0) test suite | ||
$ cargo test-wasm-1 | ||
|
||
# Run only the full WebAssembly test suite (2.0) | ||
$ cargo test-wasm-2 | ||
|
||
# Run a specific test (run without arguments to see available tests) | ||
$ cargo test --test {test_name} | ||
|
||
# Run a single WAST test file | ||
$ cargo test-wast {path} | ||
|
||
# Run a specific example (run without arguments to see available examples) | ||
# The wasm test files required to run the `wasm-rust` examples are not | ||
# included in the main repository. | ||
# To build these, you will need to run `./examples/rust/build.sh`. | ||
$ cargo run --example {example_name} | ||
``` | ||
|
||
### Profiling | ||
|
||
Either [samply](https://github.com/mstange/samply/) or [cargo-flamegraph](https://github.com/flamegraph-rs/flamegraph) are recommended for profiling. | ||
|
||
Example usage: | ||
|
||
```bash | ||
cargo install --locked samply | ||
cargo samply --example wasm-rust -- selfhosted | ||
``` | ||
|
||
# Commits | ||
|
||
This project uses [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for commit messages. For pull requests, the commit messages will be squashed so you don't need to worry about this too much. However, it is still recommended to follow this convention for consistency. | ||
|
||
# Branches | ||
|
||
- `main`: The main branch. This branch is used for the latest stable release. | ||
- `next`: The next branch. Development happens here. |
Oops, something went wrong.