From d15347d0690d4f2e81f770ae8ba9644a5cfe6242 Mon Sep 17 00:00:00 2001 From: chesedo Date: Mon, 24 Apr 2023 09:52:03 +0200 Subject: [PATCH] ci: windows qa --- .circleci/config.yml | 46 ++++++++++++++++++++------------------------ .circleci/qa.ps1 | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 25 deletions(-) create mode 100644 .circleci/qa.ps1 diff --git a/.circleci/config.yml b/.circleci/config.yml index 71e78fe888..cb9824b833 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -489,33 +489,29 @@ jobs: CARGO_NET_GIT_FETCH_WITH_CLI: "true" PATH: "$PATH:$USERPROFILE\\.cargo\\bin" steps: + - checkout - run: - name: "Test env var" + name: "Install Protobuf" command: | - echo "why $env:SHUTTLE_API_KEY" - # - checkout - # - run: - # name: "Install Protobuf" - # command: | - # brew install protobuf - # - 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 ${SHUTTLE_API_KEY} - # - run: - # name: QA - # command: ./.circleci/qa.sh windows - # environment: - # SHUTTLE_API: https://api.unstable.shuttle.rs + 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 # - run: diff --git a/.circleci/qa.ps1 b/.circleci/qa.ps1 new file mode 100644 index 0000000000..a673e9c849 --- /dev/null +++ b/.circleci/qa.ps1 @@ -0,0 +1,34 @@ +#! /usr/bin/env sh + +# Prepare directory +mkdir -p /tmp/qa-windows +cd /tmp/qa-windows + +# Add cargo to PATH +$env:Path += [IO.Path]::PathSeparator + "$env:USERPROFILE/.cargo/bin" + +# Init app +cargo shuttle init --name qa-windows --axum + +# # Start locally +Start-Job -Name "local-run" -ScriptBlock { cargo shuttle run } +Start-Sleep -Seconds 150 + +echo "Testing local hello endpoint" +$output=curl http://localhost:8000/hello | Select-Object -ExpandProperty Content +# [ "$output" != "Hello, world!" ] && ( echo "Did not expect output: $output"; exit 1 ) +echo "Did not expect output: $output" + +# killall cargo-shuttle + +# cargo shuttle project start + +# cargo shuttle deploy --allow-dirty + +# echo "Testing remote hello endpoint" +# output=$(curl --silent https://qa-windows.unstable.shuttleapp.rs/hello) +# [ "$output" != "Hello, world!" ] && ( echo "Did not expect output: $output"; exit 1 ) + +# cargo shuttle project stop + +# exit 0