Skip to content

Backend CI

Backend CI #1

Workflow file for this run

name: Backend CI
on:
push:
branches:
- main
paths:
- 'backend/**'
- '.github/workflows/backend-ci.yml'
pull_request:
branches:
- main
paths:
- 'backend/**'
workflow_dispatch:
jobs:
lint-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install common dependencies
run: |
cd backend/cab_common
pip install -r requirements.txt
pip install pytest pytest-cov flake8 black
- name: Run linting
run: |
flake8 backend --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 backend --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Run tests with coverage
run: |
cd backend
pytest --cov=. --cov-report=xml --cov-report=html -v
- name: Upload coverage reports
uses: codecov/codecov-action@v3
with:
files: ./backend/coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false