[Python] How do I run a server concurrently in GitHub Actions

Discussão em 'Python' iniciado por Stack, Setembro 29, 2024.

  1. Stack

    Stack Membro Participativo

    I have configured the following workflow:

    name: Python application

    on:
    push:
    branches: [ "app" ]
    pull_request:
    branches: [ "app" ]

    permissions:
    contents: read

    jobs:
    build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4
    - name: Set up Python 3.10
    uses: actions/setup-python@v3
    with:
    python-version: "3.10"
    - name: Install dependencies
    run: |
    make install
    - name: Lint with pylint
    run: |
    make lint
    - name: Start Fastapi service
    run: |
    nohup make serve
    - name: Test with pytest
    run: |
    make test


    Here the Makefile for this is as follows:

    install:
    pip install -r requirements.txt

    lint:
    pylint --disable=R,C *.py

    serve:
    python app.py

    test:
    python -m pytest -vv test_app.py


    The problem is, when I run the make serve command, the server starts and then goes on infinitely and never reaches the testing part. How do I configure my workflow such that the server runs in the backend and the testing starts? I have tried using nohup and it didn't work. What other things can I do?

    Continue reading...

Compartilhe esta Página