in my GitHub action yaml file, I have two commands at the end. The first one is yarn start
(which starts the server) and the second one is for running a test file.
from my local server I usually run yarn start
, then wait until frontend and backend port to be run, then only I run the test from another terminal
but from GitHub action, it runs the yarn start
command then immediately runs the test script, so when the test file is run, server is not listening on port. thats why my test scripts are failed. how can I ensure that the test script will run after the yarn start
is finished?
here is my action.yml
file
name: "Github Actions Test"
on:
push:
branches:
- wip/checkout2
jobs:
test:
runs-on: ubuntu-latest
env:
PRISMA_ENDPOINT: ${{secrets.PRISMA_ENDPOINT}}
PRISMA_SECRET: ${{secrets.PRISMA_SECRET}}
steps:
- uses: actions/checkout@v1
- name: "Install Node"
uses: actions/setup-node@v1
with:
node-version: "12.x"
- name: "Install global packages"
run: npm install -g yarn prisma-cli concurrently mocha
- name: "Run docker Container"
run: docker-compose -f docker-compose.yml up --build -d
- name: "Install deps"
run: yarn install
- name: "prisma deploy"
run: yarn deploy:backend
- name: "Seed Backend"
run: yarn seed:backend
- name: "Build app"
run: yarn build
- name: "Start backend and frontend concurrently on background and run tests"
run: |
yarn start &
yarn test