Skip to content

Commit

Permalink
ci: test wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
chesedo committed Apr 25, 2023
1 parent 6d217bc commit 7da635a
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 25 deletions.
50 changes: 25 additions & 25 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -490,33 +490,33 @@ jobs:
PATH: "$PATH:$USERPROFILE\\.cargo\\bin"
steps:
- checkout
# - run:
# name: "Install Protobuf"
# command: |
# choco install -y protoc
# - run:
# name: Install Rust
# command: |
# wget -OutFile "C:\rustup-init.exe" https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe
# C:\rustup-init.exe -y --default-toolchain 1.68.0 --target x86_64-pc-windows-msvc
# - run:
# name: "Install Shuttle"
# command: ..\.cargo\bin\cargo.exe install cargo-shuttle --path ./cargo-shuttle
# - run: ..\.cargo\bin\cargo.exe shuttle --version
# - run:
# name: Login
# command: |
# ..\.cargo\bin\cargo.exe shuttle login --api-key $env:SHUTTLE_API_KEY
- run:
name: QA
command: ./.circleci/qa.ps1
environment:
SHUTTLE_API: https://api.unstable.shuttle.rs
# - run: git submodule sync
# - run: git submodule update --init
name: "Install Protobuf"
command: |
choco install -y protoc
- run:
name: Install Rust
command: |
wget -OutFile "C:\rustup-init.exe" https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe
C:\rustup-init.exe -y --default-toolchain 1.68.0 --target x86_64-pc-windows-msvc
- run:
name: "Install Shuttle"
command: ..\.cargo\bin\cargo.exe install cargo-shuttle --path ./cargo-shuttle
- run: ..\.cargo\bin\cargo.exe shuttle --version
- run:
name: Login
command: |
..\.cargo\bin\cargo.exe shuttle login --api-key $env:SHUTTLE_API_KEY
# - run:
# name: Test WASM
# command: ./.circleci/qa-wasm.sh
# name: QA
# command: ./.circleci/qa.ps1
# environment:
# SHUTTLE_API: https://api.unstable.shuttle.rs
- run: git submodule sync
- run: git submodule update --init
- run:
name: Test WASM
command: ./.circleci/qa-wasm.sh
# - run:
# name: "Install Docker"
# command: |
Expand Down
30 changes: 30 additions & 0 deletions .circleci/qa-wasm.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Would actually like to error on all errors, but `Enable-ExperimentalFeature`
# does not work for this version of Windows
# https://github.com/PowerShell/PowerShell/issues/3415#issuecomment-1354457563
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"

# Add cargo to PATH
$env:Path += [IO.Path]::PathSeparator + "$env:USERPROFILE/.cargo/bin"

# Install the WASM target
rustup target add wasm32-wasi

# Install wasm runtime from checked out code
cargo install shuttle-runtime --path runtime --bin shuttle-next --features next

# Start locally
$job = Start-Job -Name "local-run" -ScriptBlock { cd examples/next/hello-world; cargo shuttle run }
Start-Sleep -Seconds 70

echo "Testing local wasm endpoint"
$output=curl http://localhost:8000/hello | Select-Object -ExpandProperty Content
if ( $output -ne "Hello, world!")
{
echo "Did not expect output: $output"
exit 1
}

Stop-Job $job

exit 0

0 comments on commit 7da635a

Please sign in to comment.