I have a github actions file. I am just building the go application, which is a rest API server and running couple of tests in the test folder. But in github actions runner, it is stuck on the "start server" step indefinitely.It is not going to the test step. If I understand it correctly, the api server is running indefinitely listening to requests and not not going to next step. Kindly assist how I can run the below tests step.
name: Continuous Integration
on:
push:
branches:
- "main"
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.20.7
- name: build
run: go build -o main
- name: change permissions
run: chmod +x main
- name: start server
run: ./main
- name: test
run: go test -v ./tests
Below is the output of the actions runner.
>Solution :
Seems the start server
step will lock the execution (active wait). so the test
step is never reached (and a timeout is fired). In that case you can execute the server command in background like ./main &