Skip to content
This repository was archived by the owner on Oct 3, 2025. It is now read-only.

Commit fee68d0

Browse files
chore: update deps, improve contributing guidelines, improve ci
Signed-off-by: Henry Gressmann <[email protected]>
1 parent 4238c92 commit fee68d0

File tree

18 files changed

+271
-341
lines changed

18 files changed

+271
-341
lines changed

.github/workflows/test.yaml

Lines changed: 50 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -24,132 +24,73 @@ jobs:
2424
name: wasm
2525
path: examples/rust/out
2626

27-
test-std:
27+
run-tests:
2828
needs: build-wasm
29-
name: Test with default features on stable Rust
30-
runs-on: ubuntu-latest
31-
29+
strategy:
30+
matrix:
31+
include:
32+
- os: ubuntu-latest
33+
rust: stable
34+
name: "Linux (stable)"
35+
- os: ubuntu-latest
36+
rust: nightly
37+
name: "Linux (nightly)"
38+
- os: ubuntu-latest
39+
rust: stable
40+
name: "Linux (stable, no default features)"
41+
args: "--no-default-features"
42+
- os: ubuntu-latest
43+
rust: nightly
44+
name: "Linux (nightly, no default features)"
45+
args: "--no-default-features"
46+
- os: macos-14
47+
rust: stable
48+
name: "macOS arm64 (Apple M1)"
49+
- os: ubuntu-latest
50+
rust: stable
51+
name: "armv7 (32-Bit Raspberry Pi)"
52+
target: armv7-unknown-linux-gnueabihf
53+
54+
runs-on: ${{ matrix.os }}
3255
steps:
33-
- uses: actions/checkout@v4
56+
- name: Checkout code
57+
uses: actions/checkout@v4
3458
with:
3559
submodules: true
3660

37-
- name: Install latest stable Rust toolchain
38-
run: rustup update stable
39-
40-
- name: Load wasm
41-
uses: actions/download-artifact@v4
42-
with:
43-
name: wasm
44-
path: examples/rust/out
45-
46-
- name: Build (stable)
47-
run: cargo +stable build --workspace
48-
49-
- name: Run tests (stable)
50-
run: cargo +stable test --workspace && cargo +stable run --example wasm-rust all
51-
52-
- name: Run MVP testsuite
53-
run: cargo +stable test-wasm-1
54-
55-
- name: Run 2.0 testsuite
56-
run: cargo +stable test-wasm-2
57-
58-
test-no-std:
59-
needs: build-wasm
60-
name: Test without default features on nightly Rust
61-
runs-on: ubuntu-latest
62-
63-
steps:
64-
- uses: actions/checkout@v4
61+
- name: Install Rust toolchain
62+
uses: actions-rust-lang/setup-rust-toolchain@v1
6563
with:
66-
submodules: true
67-
68-
- name: Install latest nightly Rust toolchain
69-
run: rustup update nightly
64+
toolchain: ${{ matrix.rust }}
65+
rustflags: ""
66+
components: rustfmt, clippy
67+
if: matrix.target == ''
7068

7169
- name: Load wasm
7270
uses: actions/download-artifact@v4
7371
with:
7472
name: wasm
75-
path: examples/rust/out
76-
77-
- name: Build (nightly, no default features)
78-
run: cargo +nightly build --workspace --no-default-features
7973

80-
- name: Run tests (nightly, no default features)
81-
run: cargo +nightly test --workspace --no-default-features && cargo +nightly run --example wasm-rust all
74+
- name: Run tests
75+
run: cargo test --workspace ${{ matrix.args }} && cargo run --example wasm-rust all
76+
if: matrix.target == ''
8277

83-
- name: Run MVP testsuite
84-
run: cargo +nightly test-wasm-1
85-
86-
- name: Run 2.0 testsuite
87-
run: cargo +nightly test-wasm-2
88-
89-
test-m1:
90-
needs: build-wasm
91-
name: Test on arm64 (Apple M1)
92-
runs-on: macos-14
93-
steps:
94-
- uses: actions/checkout@v4
95-
with:
96-
submodules: true
97-
- name: Install stable Rust toolchain
98-
run: rustup update stable
78+
- name: Run clippy
79+
run: cargo clippy --workspace --all-targets --all-features
80+
if: matrix.target == ''
9981

100-
- name: Load wasm
101-
uses: actions/download-artifact@v4
102-
with:
103-
name: wasm
104-
path: examples/rust/out
105-
106-
- name: Build (stable)
107-
run: cargo +stable build
108-
109-
- name: Run tests (stable)
110-
run: cargo +stable test
111-
112-
- name: Run MVP testsuite
113-
run: cargo +stable test-wasm-1
114-
115-
- name: Run 2.0 testsuite
116-
run: cargo +stable test-wasm-2
117-
118-
test-armv7:
119-
needs: build-wasm
120-
name: Test on armv7 (32-Bit Raspberry Pi)
121-
runs-on: ubuntu-latest
122-
123-
steps:
124-
- uses: actions/checkout@v4
125-
with:
126-
submodules: true
127-
128-
- name: Load wasm
129-
uses: actions/download-artifact@v4
130-
with:
131-
name: wasm
132-
path: examples/rust/out
133-
134-
- name: Run all tests (for the default workspace members)
82+
- name: Run tests (${{ matrix.target }})
13583
uses: houseabsolute/[email protected]
13684
with:
13785
command: test
138-
target: armv7-unknown-linux-gnueabihf
139-
toolchain: nightly
86+
target: ${{ matrix.target }}
87+
toolchain: ${{ matrix.rust }}
88+
if: matrix.target != ''
14089

141-
- name: Run MVP testsuite
90+
- name: Run clippy (${{ matrix.target }})
14291
uses: houseabsolute/[email protected]
14392
with:
144-
command: test
145-
args: "-p tinywasm --test test-wasm-1 --release"
146-
target: armv7-unknown-linux-gnueabihf
147-
toolchain: nightly
148-
149-
- name: Run 2.0 testsuite
150-
uses: houseabsolute/[email protected]
151-
with:
152-
command: test
153-
args: "-p tinywasm --test test-wasm-2 --release"
154-
target: armv7-unknown-linux-gnueabihf
155-
toolchain: nightly
93+
command: clippy
94+
target: ${{ matrix.target }}
95+
toolchain: ${{ matrix.rust }}
96+
if: matrix.target != ''

CONTRIBUTING.md

Lines changed: 65 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,69 @@
1-
# Scripts and Commands
1+
# Contributing
22

3-
> 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>`.
3+
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).
44

5-
- **`cargo test-wasm-1`**\
6-
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`
5+
## 1. Clone the Repository
76

8-
- **`cargo test-wasm-2`**\
9-
Run the full WebAssembly test suite (2.0)
7+
Ensure you clone this repository with the `--recursive` flag to include the submodules:
108

11-
- **`cargo test-wast <path>`**\
12-
Run a single WAST test file. e.g. `cargo test-wast ./examples/wast/i32.wast`. Useful for debugging failing test-cases.
9+
```bash
10+
git clone --recursive https://github.com/explodingcamera/tinywasm.git
11+
```
12+
13+
If you have already cloned the repository, you can initialize the submodules with:
14+
15+
```bash
16+
git submodule update --init --recursive
17+
```
18+
19+
This is required to run the WebAssembly test suite.
20+
21+
## 2. Set up the Development Environment
22+
23+
This project mostly uses a pretty standard Rust setup. Some common tasks:
24+
25+
```bash
26+
# Run a specific benchmark (run without arguments to see available benchmarks)
27+
$ cargo bench --bench {bench_name}
28+
29+
# Run all tests
30+
$ cargo test
31+
32+
# Run only the WebAssembly MVP (1.0) test suite
33+
$ cargo test-wasm-1
34+
35+
# Run only the full WebAssembly test suite (2.0)
36+
$ cargo test-wasm-2
37+
38+
# Run a specific test (run without arguments to see available tests)
39+
$ cargo test --test {test_name}
40+
41+
# Run a single WAST test file
42+
$ cargo test-wast {path}
43+
44+
# Run a specific example (run without arguments to see available examples)
45+
# The wasm test files required to run the `wasm-rust` examples are not
46+
# included in the main repository.
47+
# To build these, you will need to run `./examples/rust/build.sh`.
48+
$ cargo run --example {example_name}
49+
```
50+
51+
### Profiling
52+
53+
Either [samply](https://github.com/mstange/samply/) or [cargo-flamegraph](https://github.com/flamegraph-rs/flamegraph) are recommended for profiling.
54+
55+
Example usage:
56+
57+
```bash
58+
cargo install --locked samply
59+
cargo samply --example wasm-rust -- selfhosted
60+
```
61+
62+
# Commits
63+
64+
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.
65+
66+
# Branches
67+
68+
- `main`: The main branch. This branch is used for the latest stable release.
69+
- `next`: The next branch. Development happens here.

0 commit comments

Comments
 (0)