diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md new file mode 100644 index 00000000..694ae5de --- /dev/null +++ b/DEVELOPMENT.md @@ -0,0 +1,142 @@ +# Developing homestar + +## Outline + +- [Testing the Project](#testing-the-project) +- [Running the Runtime on Docker](#running-the-runtime-on-docker) +- [Nix](#nix) +- [Formatting](#formatting) +- [Pre-commit Hook](#pre-commit-hook) +- [Recommended Development Flow](#recommended-development-flow) +- [Conventional Commits](#conventional-commits) + +## Testing the Project + +- Running the tests: + +We recommend using [cargo nextest][cargo-nextest], which is installed by default +in our [Nix flake](#nix) or can be [installed separately][cargo-nextest-install]. + + ```console + cargo nextest run --all-features --no-capture + ``` + +The above command translates to this using the default `cargo test`: + + ```console + cargo test --all-features -- --nocapture + ``` + +## Running the Runtime on Docker + +We recommend setting your [Docker Engine][docker-engine] configuration +with `experimental` and `buildkit` set to `true`, for example: + +``` json +{ + "builder": { + "gc": { + "defaultKeepStorage": "20GB", + "enabled": true + } + }, + "experimental": true, + "features": { + "buildkit": true + } +} +``` + +- Build a multi-plaform Docker image via [buildx][buildx]: + + ```console + docker buildx build --file docker/Dockerfile --platform=linux/amd64,linux/arm64 -t homestar --progress=plain . + ``` + +- Run a Docker image (depending on your platform): + + ```console + docker run --platform=linux/arm64 -t homestar + ``` + +## Nix +This repository contains a [Nix flake][nix-flake] that initiates both the Rust +toolchain set in [rust-toolchain.toml](./rust-toolchain.toml) and a +[pre-commit hook](#pre-commit-hook). It also installs +[external dependencies](#external-dependencies), as well as helpful cargo +binaries for development. Please install [nix][nix] and [direnv][direnv] to get +started. + +Run `nix develop` or `direnv allow` to load the `devShell` flake output, +according to your preference. + +## Formatting + +For formatting Rust in particular, we automatically format on `nightly`, as it +uses specific nightly features we recommend by default. + +## Pre-commit Hook + +This project recommends using [pre-commit][pre-commit] for running pre-commit +hooks. Please run this before every commit and/or push. + +- If you are doing interim commits locally, and you want to skip the pre-commit checks + you can run + `git commit -a -m "Your message here" --no-verify`. + +## Recommended Development Flow + +- We recommend leveraging [cargo-watch][cargo-watch], + [cargo-expand][cargo-expand] and [irust][irust] for Rust development. +- We also recommend using [cargo-udeps][cargo-udeps] for removing unused + dependencies before commits and pull-requests. +- If using our [Nix flake](./flake.nix), there are a number of handy + command shortcuts available for working with `cargo-watch`, `diesel`, and + other items, including: + * **`ci`**, which runs a sequence of commands to check formatting, lints, + release builds, and tests + * **`db`** and **`db-reset`** for running `diesel` setup and migrations + * **`doc`** for generating cargo docs with private-items documented + * **`docker-`** for running docker builds + * **`nx-test`**, which translates to + `cargo nextest run --workspace && cargo test --workspace --doc` + * **`x-test`** for testing continuously as files change, translating to + `cargo watch -c -s "cargo nextest run --workspace --nocapture && cargo test --doc"` + * **`x-`** for running a variety of `cargo watch` + execution stages + * **`nx-test-`**, which is just like `nx-test`, but adds `all` or `0` + for running tests either with the `all-features` flag or + `no-default-features` flag, respectively + * **`x--`** for + package-specific builds, tests, etc. + +## Conventional Commits + +This project *lightly* follows the [Conventional Commits convention][commit-spec-site] +to help explain commit history and tie in with our release process. The full specification +can be found [here][commit-spec]. We recommend prefixing your commits with +a type of `fix`, `feat`, `docs`, `ci`, `refactor`, etc..., structured like so: + +``` +[optional scope]: + +[optional body] + +[optional footer(s)] +``` + +[buildx]: https://docs.docker.com/engine/reference/commandline/buildx/ +[cargo-expand]: https://github.com/dtolnay/cargo-expand +[cargo-nextest]: https://nexte.st/index.html +[cargo-nextest-install]: https://nexte.st/book/installation.html +[cargo-udeps]: https://github.com/est31/cargo-udeps +[cargo-watch]: https://github.com/watchexec/cargo-watch +[commit-spec]: https://www.conventionalcommits.org/en/v1.0.0/#specification +[commit-spec-site]: https://www.conventionalcommits.org/ +[docker-engine]: https://docs.docker.com/engine/ +[irust]: https://github.com/sigmaSd/IRust +[direnv]:https://direnv.net/ +[nix]:https://nixos.org/download.html +[nix-flake]: https://nixos.wiki/wiki/Flakes +[pre-commit]: https://pre-commit.com/ +[wit-bindgen]: https://github.com/bytecodealliance/wit-bindgen diff --git a/README.md b/README.md index 8c8d0793..a6ec168d 100644 --- a/README.md +++ b/README.md @@ -51,18 +51,54 @@ ## Outline +- [Quickstart](#quickstart) +- [Running Examples](#running-examples) - [Workspace](#workspace) -- [Testing the Project](#testing-the-project) -- [Running the Runtime on Docker](#running-the-runtime-on-docker) - [Contributing](#contributing) +- [Releases](#releases) - [Getting Help](#getting-help) - [External Resources](#external-resources) - [License](#license) +## Quickstart + +If you're looking to help develop `homestar`, please dive right into our +[development](./DEVELOPMENT.md) guide. Otherwise, the easiest way +to get started and see `homestar` in action is to follow-along and run our +image-processing [websocket relay](./examples/websocket-relay) example, +which integrates `homestar` with a browser application to run a +statically-configured workflow. The associated `README.md` walks through +what to install (i.e. `rust`, `node/npm`, `ipfs`), what commands +to run, and embeds a video demonstrating its usage. + +Throughout the `homestar` ecosystem and documentation, we'll draw a distinction +between the [host runtime][host-runtime] and the support for different +[guest languages and bindings][guest]. If you're mainly interested in +learning how to write and build-out Wasm components (in Rust), please jump +into our [`homestar-functions`](./homestar-functions) directory +and check out our examples there. + +## Running Examples + +All [examples](./examples) contain instructions for running +them, including what to install and how to run them. Please clone this repo, +and get started! + +Each example showcases something specific and interesting about `homestar` +as a system. + +Our current list includes: + +- [websocket relay](./examples/websocket-relay) - An example (browser-based) + application that connects to the `homestar-runtime` over a websocket + connection in order to run a couple static Wasm-based, image processing + workflows that chain inputs and outputs. + ## Workspace -This repository is comprised of a few library packages and a binary that -represents the `homestar` runtime. +This repository is comprised of a few library packages and a library/binary that +represents the `homestar` runtime. We recommend diving into each package's own +`README.md` for more information when available. ### Core Crates @@ -70,7 +106,8 @@ represents the `homestar` runtime. The *core* library implements much of the [Ucan Invocation][ucan-invocation] and [Ipvm Workflow][ipvm-workflow-spec] specifications and is used as the - foundation for other packages in this `workspace` and within the runtime engine. + foundation for other packages in this `workspace` and within the runtime + engine. - [homestar-wasm](./homestar-wasm) @@ -86,137 +123,30 @@ represents the `homestar` runtime. and executing workflows as well as tasks within workflows, handling retries and failure modes, etc. -### Non-published, Helper Crates - -- [homestar-functions](./homestar-functions) - - Currently, this is a helper and example crate for writing and compiling - [Wasm components][wasm-component] using [wit-bindgen][wit-bindgen]. - - **It will be expanded upon as a default set of Wasm mods and functions.** +### Non-published Crates -## Testing the Project +- [homestar-functions/*](./homestar-functions) -- Running the tests: + `homestar-functions` is a directory of helper, test, and example crates for + writing and compiling [Wasm component][wasm-component] modules using + [wit-bindgen][wit-bindgen]. -We recommend using [cargo nextest][cargo-nextest], which is installed by default -in our [Nix flake](#nix) or can be [installed separately][cargo-nextest-install]. +- [examples/*](./examples) - ```console - cargo nextest run --all-features --no-capture - ``` - -The above command translates to this using the default `cargo test`: - - ```console - cargo test --all-features -- --nocapture - ``` - -## Running the Runtime on Docker - -We recommend setting your [Docker Engine][docker-engine] configuration -with `experimental` and `buildkit` set to `true`, for example: - -``` json -{ - "builder": { - "gc": { - "defaultKeepStorage": "20GB", - "enabled": true - } - }, - "experimental": true, - "features": { - "buildkit": true - } -} -``` - -- Build a multi-plaform Docker image via [buildx][buildx]: - - ```console - docker buildx build --file docker/Dockerfile --platform=linux/amd64,linux/arm64 -t homestar-runtime --progress=plain . - ``` - -- Run a Docker image (depending on your platform): - - ```console - docker run --platform=linux/arm64 -t homestar-runtime - ``` + `examples` contains examples and demos showcasing `homestar` packages + and the `homestar runtime`. Each example is set up as its own crate, + demonstrating the necessary dependencies and setup(s). ## Contributing :balloon: We're thankful for any feedback and help in improving our project! -We have a [contributing guide](./CONTRIBUTING.md) to help you get involved. We -also adhere to our [Code of Conduct](./CODE_OF_CONDUCT.md). - -### Nix -This repository contains a [Nix flake][nix-flake] that initiates both the Rust -toolchain set in [rust-toolchain.toml](./rust-toolchain.toml) and a -[pre-commit hook](#pre-commit-hook). It also installs -[external dependencies](#external-dependencies), as well as helpful cargo -binaries for development. Please install [nix][nix] and [direnv][direnv] to get -started. - -Run `nix develop` or `direnv allow` to load the `devShell` flake output, -according to your preference. - -### Formatting - -For formatting Rust in particular, we automatically format on `nightly`, as it -uses specific nightly features we recommend by default. - -### Pre-commit Hook - -This project recommends using [pre-commit][pre-commit] for running pre-commit -hooks. Please run this before every commit and/or push. - -- If you are doing interim commits locally, and for some reason if you _don't_ - want pre-commit hooks to fire, you can run - `git commit -a -m "Your message here" --no-verify`. - -### Recommended Development Flow - -- We recommend leveraging [cargo-watch][cargo-watch], - [cargo-expand][cargo-expand] and [irust][irust] for Rust development. -- We also recommend using [cargo-udeps][cargo-udeps] for removing unused - dependencies before commits and pull-requests. -- If using our [Nix flake](./flake.nix), there are a number of handy - command shortcuts available for working with `cargo-watch`, `diesel`, and - other items, including: - * **`ci`**, which runs a sequence of commands to check formatting, lints, release - builds, and tests - * **`db`** and **`db-reset`** for running `diesel` setup and migrations - * **`doc`** for generating cargo docs with private-items documented - * **`compile-wasm`** for compiling [homestar-functions](./homestar-functions), - a [wit-bindgen][wit-bindgen]-driven example, to the `wasm32-unknown-unknown` target - * **`docker-`** for running docker builds - * **`nx-test`**, which translates to `cargo nextest run && cargo test --doc` - * **`x-test`** for testing continuously as files change, translating to - `cargo watch -c -s "cargo nextest run && cargo test --doc"` - * **`x-`** for running a variety of `cargo watch` - execution stages - * **`nx-test-`**, which is just like `nx-test`, but adds `all` or `0` - for running tests either with the `all-features` flag or - `no-default-features` flag, respectively - * **`x--`** for package-specific - builds, tests, etc. - -### Conventional Commits - -This project *lightly* follows the [Conventional Commits -convention][commit-spec-site] to help explain -commit history and tie in with our release process. The full specification -can be found [here][commit-spec]. We recommend prefixing your commits with -a type of `fix`, `feat`, `docs`, `ci`, `refactor`, etc..., structured like so: - -``` -[optional scope]: - -[optional body] - -[optional footer(s)] -``` +We have a focused [development](./DEVELOPMENT.md) guide, as well as a +more general [contributing](./CONTRIBUTING.md) guide to help you get involved. +We always adhere to our [Code of Conduct](./CODE_OF_CONDUCT.md). + +## Releases + +TBA ## Getting Help @@ -251,28 +181,17 @@ conditions. [apache]: https://www.apache.org/licenses/LICENSE-2.0 [blog-1]: https://fission.codes/blog/ipfs-thing-breaking-down-ipvm/ -[buildx]: https://docs.docker.com/engine/reference/commandline/buildx/ -[cargo-expand]: https://github.com/dtolnay/cargo-expand -[cargo-nextest]: https://nexte.st/index.html -[cargo-nextest-install]: https://nexte.st/book/installation.html -[cargo-udeps]: https://github.com/est31/cargo-udeps -[cargo-watch]: https://github.com/watchexec/cargo-watch [cod-ipvm]: https://www.youtube.com/watch?v=3y1RB8wt_YY -[commit-spec]: https://www.conventionalcommits.org/en/v1.0.0/#specification -[commit-spec-site]: https://www.conventionalcommits.org/ [demo-1]: https://www.loom.com/share/3204037368fe426ba3b4c952b0691c5c -[direnv]:https://direnv.net/ [foundations-for-openworld-compute]: https://youtu.be/dRz5mau6fsY +[guest]: https://github.com/bytecodealliance/wit-bindgen#supported-guest-languages +[host-runtime]: https://github.com/bytecodealliance/wit-bindgen#host-runtimes-for-components [ipfs-thing-ipvm]: https://www.youtube.com/watch?v=rzJWk1nlYvs [ipld]: https://ipld.io/ [ipvm-spec]: https://github.com/ipvm-wg/spec [ipvm-wg]: https://github.com/ipvm-wg [ipvm-workflow-spec]: https://github.com/ipvm-wg/workflow -[irust]: https://github.com/sigmaSd/IRust [mit]: http://opensource.org/licenses/MIT -[nix]:https://nixos.org/download.html -[nix-flake]: https://nixos.wiki/wiki/Flakes -[pre-commit]: https://pre-commit.com/ [research]: https://github.com/ipvm-wg/research [seamless-services]: https://youtu.be/Kr3B3sXh_VA [ucan-invocation]: https://github.com/ucan-wg/invocation diff --git a/examples/README.md b/examples/README.md index db9ecfb3..b0766833 100644 --- a/examples/README.md +++ b/examples/README.md @@ -4,9 +4,9 @@ This folder contains examples and demos showcasing `homestar` packages and the `homestar runtime`. Each example is set up as its own crate, demonstrating the necessary dependencies and setup(s). -* [websocket relay](./websocket-relay) - An example application that connects to - the `homestar-runtime` over a websocket connection in order to run a - couple static Wasm-based, image processing workflows that chain inputs and - outputs using [inlined promises][pipelines]. +* [websocket relay](./websocket-relay) - An example (browser-based) application + that connects to the `homestar-runtime` over a websocket connection in order + to run a couple static Wasm-based, image processing workflows that chain + inputs and outputs using [inlined promises][pipelines]. [pipelines]: https://github.com/ucan-wg/invocation#9-pipelines diff --git a/examples/websocket-relay/README.md b/examples/websocket-relay/README.md index 039625b9..41d06baa 100644 --- a/examples/websocket-relay/README.md +++ b/examples/websocket-relay/README.md @@ -15,6 +15,20 @@ processing workflows that chain inputs and outputs using * the [WIT][wit] + [Ipld][ipld] interpreter for [Wasm(time)][wasmtime] embedded execution within a `homestar` runner. +## Install + +To get started, please install: + +* [rust][install-rust], unless you're running `homestar` [as a binary][rust-binary] +* [node & npm][install-npm] +* [kubo/ipfs installed][install-ipfs] + +If you're using our [nix file](../../flake.nix)], you get these installs for +free. + +*Note*: you **do not** have to start-up `kubo`/`ipfs` on your own. The example +will do this for you. + ## Usage 1. Run `cargo run -- start -c config/settings.toml` to start the runtime and @@ -32,9 +46,13 @@ processing workflows that chain inputs and outputs using Note that IPFS may attempt to upgrade to a new version and produce an error after the update. Delete the `tmp/.ipfs/` directory and restart to reset the IPFS repo state. +[install-ipfs]: https://docs.ipfs.tech/install/ +[install-npm]: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm +[install-rust]: https://www.rust-lang.org/tools/install [ipfs]: https://ipfs.tech/ [ipld]: https://ipld.io/ [pipelines]: https://github.com/ucan-wg/invocation#9-pipelines +[rust-binary]: https://doc.rust-lang.org/book/ch01-03-hello-cargo.html#building-for-release [spec-receipts]: https://github.com/ucan-wg/invocation#8-receipt [wasmtime]: https://github.com/bytecodealliance/wasmtime [wit]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md diff --git a/examples/websocket-relay/relay-app/package-lock.json b/examples/websocket-relay/relay-app/package-lock.json index 9efcc1a7..94687b3b 100644 --- a/examples/websocket-relay/relay-app/package-lock.json +++ b/examples/websocket-relay/relay-app/package-lock.json @@ -79,54 +79,6 @@ "resolved": "https://registry.npmjs.org/@egjs/list-differ/-/list-differ-1.0.1.tgz", "integrity": "sha512-OTFTDQcWS+1ZREOdCWuk5hCBgYO4OsD30lXcOCyVOAjXMhgL5rBRDnt/otb6Nz8CzU0L/igdcaQBDLWc4t9gvg==" }, - "node_modules/@esbuild/android-arm": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", - "integrity": "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz", - "integrity": "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.20.tgz", - "integrity": "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, "node_modules/@esbuild/darwin-arm64": { "version": "0.18.20", "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz", @@ -143,294 +95,6 @@ "node": ">=12" } }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz", - "integrity": "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz", - "integrity": "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz", - "integrity": "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz", - "integrity": "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz", - "integrity": "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz", - "integrity": "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz", - "integrity": "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==", - "cpu": [ - "loong64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz", - "integrity": "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==", - "cpu": [ - "mips64el" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz", - "integrity": "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==", - "cpu": [ - "ppc64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz", - "integrity": "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==", - "cpu": [ - "riscv64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz", - "integrity": "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==", - "cpu": [ - "s390x" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz", - "integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz", - "integrity": "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz", - "integrity": "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz", - "integrity": "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz", - "integrity": "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz", - "integrity": "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz", - "integrity": "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -4421,27 +4085,6 @@ "resolved": "https://registry.npmjs.org/@egjs/list-differ/-/list-differ-1.0.1.tgz", "integrity": "sha512-OTFTDQcWS+1ZREOdCWuk5hCBgYO4OsD30lXcOCyVOAjXMhgL5rBRDnt/otb6Nz8CzU0L/igdcaQBDLWc4t9gvg==" }, - "@esbuild/android-arm": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", - "integrity": "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==", - "dev": true, - "optional": true - }, - "@esbuild/android-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz", - "integrity": "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==", - "dev": true, - "optional": true - }, - "@esbuild/android-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.20.tgz", - "integrity": "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==", - "dev": true, - "optional": true - }, "@esbuild/darwin-arm64": { "version": "0.18.20", "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz", @@ -4449,132 +4092,6 @@ "dev": true, "optional": true }, - "@esbuild/darwin-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz", - "integrity": "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==", - "dev": true, - "optional": true - }, - "@esbuild/freebsd-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz", - "integrity": "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==", - "dev": true, - "optional": true - }, - "@esbuild/freebsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz", - "integrity": "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==", - "dev": true, - "optional": true - }, - "@esbuild/linux-arm": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz", - "integrity": "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==", - "dev": true, - "optional": true - }, - "@esbuild/linux-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz", - "integrity": "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==", - "dev": true, - "optional": true - }, - "@esbuild/linux-ia32": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz", - "integrity": "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==", - "dev": true, - "optional": true - }, - "@esbuild/linux-loong64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz", - "integrity": "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==", - "dev": true, - "optional": true - }, - "@esbuild/linux-mips64el": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz", - "integrity": "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==", - "dev": true, - "optional": true - }, - "@esbuild/linux-ppc64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz", - "integrity": "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==", - "dev": true, - "optional": true - }, - "@esbuild/linux-riscv64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz", - "integrity": "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==", - "dev": true, - "optional": true - }, - "@esbuild/linux-s390x": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz", - "integrity": "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==", - "dev": true, - "optional": true - }, - "@esbuild/linux-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz", - "integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==", - "dev": true, - "optional": true - }, - "@esbuild/netbsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz", - "integrity": "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==", - "dev": true, - "optional": true - }, - "@esbuild/openbsd-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz", - "integrity": "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==", - "dev": true, - "optional": true - }, - "@esbuild/sunos-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz", - "integrity": "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==", - "dev": true, - "optional": true - }, - "@esbuild/win32-arm64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz", - "integrity": "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==", - "dev": true, - "optional": true - }, - "@esbuild/win32-ia32": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz", - "integrity": "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==", - "dev": true, - "optional": true - }, - "@esbuild/win32-x64": { - "version": "0.18.20", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz", - "integrity": "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==", - "dev": true, - "optional": true - }, "@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", diff --git a/flake.nix b/flake.nix index aa60c0ec..26abb28e 100644 --- a/flake.nix +++ b/flake.nix @@ -60,7 +60,7 @@ ci = pkgs.writeScriptBin "ci" '' #!${pkgs.stdenv.shell} cargo fmt --check - cargo --workspace clippy + cargo clippy cargo build --release nx-test nx-test-0 diff --git a/homestar-functions/README.md b/homestar-functions/README.md index 64b01c90..8fe8b181 100644 --- a/homestar-functions/README.md +++ b/homestar-functions/README.md @@ -19,9 +19,9 @@ ## -This is a template-like, example-driven crate (non-published) used for building -Wasm components in order to run and test them on the latest [wasmtime][wasmtime] -runtime, with the `component-model` feature turned on. +This is a template-like, example-driven set of non-published crates used for +building Wasm components in order to run and test them on the latest +[wasmtime][wasmtime] runtime, with the `component-model` feature turned on. We use the components compiled from this crate as fixtures for our execution-and-[IPLD][ipld]-focused [homestar-wasm crate](../homestar-wasm). We @@ -42,19 +42,19 @@ We then implement these functions in [lib.rs](./src/lib.rs) using ## Build Once functions are implemented, we can build the component in release-mode, -targetting [`wasm32-unknown-unknown`][wasm32], using feature-flags for different -module output(s): +targetting [`wasm32-unknown-unknown`][wasm32], : ```console # from this directory: -cargo build --features example-add --target wasm32-unknown-unknown --release +cd test && cargo build --target wasm32-unknown-unknown --profile release-wasm-fn # or from the top-level workspace: -cargo build -p homestar-functions --features example-add --target wasm32-unknown-unknown --release +cargo build -p homestar-functions-test --target wasm32-unknown-unknown --profile release-wasm-fn ``` -The guest Wasm module will be generated at -`../target/wasm32-unknown-unknown/release/homestar_functions.wasm`. +Guest Wasm modules will be generated within the +`../target/wasm32-unknown-unknown/release` directory, e.g. +`../target/wasm32-unknown-unknown/release-wasm-fn/homestar_functions_test.wasm`. Sadly, this module is **not yet** an actual `component`. But, we can leverage the [wasm-tools][wasm-tools] tooling ([wit-component][wit-component] in @@ -63,7 +63,7 @@ it in a different directory: ```console wasm-tools component new / -../target/wasm32-unknown-unknown/release/homestar_functions.wasm -o ../homestar-wasm/fixtures/ +../target/wasm32-unknown-unknown/release-wasm-fn/homestar_functions_test.wasm -o ../homestar-wasm/fixtures/ ``` *Of note*, [homestar-wasm's](../homestar-wasm) execution model will do