diff --git a/.circleci/config.yml b/.circleci/config.yml index a71bd52ed8..544f16c8c8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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: | diff --git a/.circleci/qa-wasm.ps1 b/.circleci/qa-wasm.ps1 new file mode 100644 index 0000000000..d854c110e9 --- /dev/null +++ b/.circleci/qa-wasm.ps1 @@ -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