I have a scenario where in, I want to run the server in the background and run the unit tests that are dependent on the server. Problem is, if I remove shell=cmd
and run, it runs fine in background but uses Windows Powershell as the default shell. In this case it clearly shows, running as background task.
But I don't want that. I want the shell to be cmd. When I specify shell=cmd
, the server operation just blocks.
I have created a sample project.
These are my entire actions:
name: Test unit tests CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
- name: setup Msbuild
uses: microsoft/[email protected]
- name: Setup VSTest Console
uses: darenm/[email protected]
#try nc -v -N 127.0.0.1 3334
#curl http://localhost:3333 -I
#vstest.console.exe ./Pico/Medman/FluidTransferTests/bin/Release/net481/FluidTransferTests.dll
#Start CoreServer.exe in background
- name: Start CoreServer.exe in the background
shell: cmd
run: |
echo git | .\Debug\CoreServer.exe -c -s &
vstest.console.exe .\Tests\FluidTransferTests.dll
You see it just keeps spinning shows "waiting for SSL client" and doesn't proceed further to execute the tests.
Edit
As per the suggestion, in my run step I tried the following but still won't help still gives the same output.
- name: Start CoreServer.exe in the background
shell: cmd
run: |
start /b echo git | .\Debug\CoreServer.exe -c -s
vstest.console.exe .\Tests\FluidTransferTests.dll
Also tried, and still the same.
- name: Start CoreServer.exe in the background
shell: cmd
run: |
start /B echo git | .\Debug\CoreServer.exe -c -s & start /B vstest.console.exe .\Tests\FluidTransferTests.dll
Edit
I have tried many ways one of them is,
start /B "echo git | CoreServer.exe -c -s"
When I try like above it says, (c) Microsoft Corporation. All rights reserved. But surely its not running the Server.
Also tried:
start /B "" echo git | CoreServer.exe -c -s
But doing so looks like its not starting the server in background.