generated from WebAssembly/wasi-proposal-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9dfd9d5
commit 1980cea
Showing
30 changed files
with
2,441 additions
and
65 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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
BasedOnStyle: LLVM | ||
PointerAlignment: Right | ||
ColumnLimit: 79 | ||
IndentWidth: 8 | ||
TabWidth: 8 | ||
ContinuationIndentWidth: 8 | ||
ConstructorInitializerIndentWidth: 8 | ||
AlwaysBreakAfterReturnType: TopLevelDefinitions | ||
BreakBeforeBraces: Linux | ||
IndentGotoLabels: false | ||
ForEachMacros: ["ARRAY_FOREACH", "LIST_FOREACH", "LIST_FOREACH_REVERSE", "VEC_FOREACH", "VEC_FOREACH_IDX"] | ||
SpaceBeforeParens: ControlStatementsExceptControlMacros |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM ubuntu:22.04 | ||
|
||
WORKDIR /home/ | ||
|
||
COPY . . | ||
|
||
ENV PATH="/root/.cargo/bin:$PATH" | ||
|
||
RUN bash ./setup.sh |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"name": "Codespaces Rust Starter", | ||
"extensions": [ | ||
"matklad.rust-analyzer", | ||
"serayuzgur.crates", | ||
"vadimcn.vscode-lldb", | ||
"ms-vscode.makefile-tools", | ||
"ms-vscode.cpptools-extension-pack" | ||
], | ||
"dockerFile": "Dockerfile", | ||
"initCommands": [ | ||
"settings set target.disable-aslr false" | ||
], | ||
"settings": { | ||
"editor.formatOnSave": true, | ||
"terminal.integrated.profiles.linux": { | ||
"zsh": { | ||
"path": "/usr/bin/zsh", | ||
"environment": [ | ||
"RUST_BACKTRACE=1", | ||
"RUST_LOG=debug", | ||
"RUST_LOG_STYLE=always" | ||
] | ||
} | ||
}, | ||
"terminal.integrated.defaultProfile.linux": "zsh", | ||
"files.exclude": { | ||
"**/CONTRIBUTING.md": true, | ||
"**/LICENSE": true | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
## update and install 1st level of packages | ||
apt-get update | ||
apt-get install -y \ | ||
curl \ | ||
git \ | ||
gnupg2 \ | ||
jq \ | ||
sudo \ | ||
zsh \ | ||
build-essential \ | ||
cmake \ | ||
libssl-dev \ | ||
openssl \ | ||
unzip \ | ||
g++-12 \ | ||
|
||
update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-12 50 | ||
|
||
## Add package directories to PATH | ||
export PATH="/usr/bin:/usr/local/bin:$PATH" | ||
|
||
## update and install 2nd level of packages | ||
apt-get install -y pkg-config | ||
|
||
## install rustup and common components | ||
curl https://sh.rustup.rs -sSf | sh -s -- -y | ||
|
||
source $HOME/.cargo/env |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# A hack to enable some degree of syntax highlighting on GitHub. Should be removed if GitHub ever receives native support for Wit files. | ||
*.wit linguist-language=Rust |
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
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 |
---|---|---|
@@ -0,0 +1,130 @@ | ||
name: Wasmtime | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
tags: | ||
- "v*" | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
concurrency: | ||
group: cmake-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-and-run: | ||
env: | ||
CC: ${{matrix.compiler}} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
runs-on: ${{matrix.os}} | ||
|
||
steps: | ||
- name: Install dependencies (rustup) | ||
run: | | ||
rustup target add wasm32-wasi | ||
- name: Install dependencies (cargo) | ||
run: | | ||
cargo install --version 1.0.51 wasm-tools | ||
cargo install --version 0.14.0 wit-bindgen-cli | ||
- name: Install dependencies (ubuntu) | ||
if: startsWith(matrix.os, 'ubuntu-') | ||
run: sudo apt-get update && sudo apt-get install -y pax | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install wasmtime (ubuntu) | ||
if: startsWith(matrix.os, 'ubuntu-') | ||
run: | | ||
curl -O -L https://github.com/bytecodealliance/wasmtime/releases/download/v14.0.4/wasmtime-v14.0.4-x86_64-linux.tar.xz | ||
tar xvJf wasmtime-v14.0.4-x86_64-linux.tar.xz | ||
echo "WASMTIME=$(pwd -P)/wasmtime-v14.0.4-x86_64-linux/wasmtime" >> ${GITHUB_ENV} | ||
- name: Install wasmtime (macOS) | ||
if: startsWith(matrix.os, 'macos-') | ||
run: | | ||
curl -O -L https://github.com/bytecodealliance/wasmtime/releases/download/v14.0.4/wasmtime-v14.0.4-x86_64-macos.tar.xz | ||
tar xvzf wasmtime-v14.0.4-x86_64-macos.tar.xz | ||
echo "WASMTIME=$(pwd -P)/wasmtime-v14.0.4-x86_64-macos/wasmtime" >> ${GITHUB_ENV} | ||
- name: Build guest (Rust) | ||
run: | | ||
./build.sh | ||
working-directory: ${{github.workspace}}/guest | ||
|
||
- name: Build guest (C) | ||
run: | | ||
./build.sh | ||
working-directory: ${{github.workspace}}/guest_c | ||
|
||
- name: Build host | ||
run: | | ||
cargo build | ||
working-directory: ${{github.workspace}}/host | ||
|
||
- name: Run (component) | ||
run: | | ||
cargo run ../guest/guest-component.wasm | ||
working-directory: ${{github.workspace}}/host | ||
|
||
- name: Check the output (component) | ||
run: | | ||
test $(ls *.jpg|wc -l) -eq 60 | ||
working-directory: ${{github.workspace}}/host | ||
|
||
- name: Clean up the output (component) | ||
run: | | ||
rm *.jpg | ||
working-directory: ${{github.workspace}}/host | ||
|
||
- name: Run (wasmtime precompiled component) | ||
run: | | ||
cargo run ../guest/guest-component.cwasm | ||
working-directory: ${{github.workspace}}/host | ||
|
||
- name: Check the output (wasmtime precompiled component) | ||
run: | | ||
test $(ls *.jpg|wc -l) -eq 60 | ||
working-directory: ${{github.workspace}}/host | ||
|
||
- name: Clean up the output (wasmtime precompiled component) | ||
run: | | ||
rm *.jpg | ||
working-directory: ${{github.workspace}}/host | ||
|
||
- name: Run (C, component) | ||
run: | | ||
cargo run ../guest_c/guest-component.wasm | ||
working-directory: ${{github.workspace}}/host | ||
|
||
- name: Check the output (C, component) | ||
run: | | ||
test $(ls *.jpg|wc -l) -eq 60 | ||
working-directory: ${{github.workspace}}/host | ||
|
||
- name: Clean up the output (C, component) | ||
run: | | ||
rm *.jpg | ||
working-directory: ${{github.workspace}}/host | ||
|
||
- name: Run (C, wasmtime precompiled component) | ||
run: | | ||
cargo run ../guest_c/guest-component.cwasm | ||
working-directory: ${{github.workspace}}/host | ||
|
||
- name: Check the output (C, precompiled component) | ||
run: | | ||
test $(ls *.jpg|wc -l) -eq 60 | ||
working-directory: ${{github.workspace}}/host | ||
|
||
- name: Clean up the output (C, precompiled component) | ||
run: | | ||
rm *.jpg | ||
working-directory: ${{github.workspace}}/host |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*/target/* | ||
*.lock |
Oops, something went wrong.