0

I'm trying to test my react app with yarn using Github Actions, I need to have Django running for some tests, however Django has the

Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
October 15, 2021 - 03:32:25
Django version 3.2.6, using settings 'controller.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

message which locks bash, any ideas how I can start Django inside the action so that the action continues to run?

This is currently my action

name: CI
on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

  workflow_dispatch:

jobs:
  tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Installing dependecies
        run:
          ./install.sh
        shell:
          bash
      - name: Testing backend
        run:
          ./backend-test.sh
        shell:
          bash
      - name: Starting backend
        run:
          ./backend.sh > /dev/null 2>&1
        shell:
          bash
      - name: Testing frontend
        run:
          ./frontend-test.sh
        shell:
          bash

And backend.sh does this

# Backend test script
cd backend/ && \
    sudo service postgresql start && \
    source .venv/bin/activate && \
    python3 manage.py test

1 Answers1

0

you should add & at the end of your command running backend.sh script to run it in the background. The process ID will printed to screen and you can run others scripts/commands

- name: Starting backend
  run:
    ./backend.sh > /dev/null 2>&1 &
  shell:
    bash
Gers
  • 572
  • 1
  • 4
  • 15