молимся? #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Backend CI | |
on: | |
push: | |
branches: [ "master" ] | |
paths: | |
- 'backend/**' | |
pull_request: | |
branches: [ "master" ] | |
paths: | |
- 'backend/**' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 pytest | |
if [ -f backend/requirements.txt ]; then pip install -r backend/requirements.txt; fi | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 backend --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings | |
flake8 backend --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Run tests | |
run: | | |
cd backend | |
pytest | |
- name: Run API | |
run: | | |
cd backend | |
nohup python main.py > /dev/null 2>&1 & | |
sleep 5 | |
- name: Check API health | |
run: | | |
curl http://localhost:5000/health || exit 1 |