Skip to content

Commit

Permalink
Add GitHub Actions CI workflow for backend tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan-Kim2028 committed Oct 21, 2024
1 parent 5d213c4 commit d239f56
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/ci-backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# .github/workflows/ci-backend.yml

name: CI Backend

on:
push:
paths:
- 'backend/**'
pull_request:
paths:
- 'backend/**'

jobs:
build-and-test:
runs-on: ubuntu-22.04 # Specify the Ubuntu version explicitly

strategy:
matrix:
python-version: [3.12]

steps:
# Step 1: Checkout the repository
- name: Checkout Repository
uses: actions/checkout@v3

# Step 2: Set up Python environment with pip caching
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # Enables pip caching

# Step 3: Install dependencies
- name: Install Dependencies
working-directory: backend
run: |
python -m pip install --upgrade pip
pip install -r requirements.lock
# Step 4: Run Linting with ruff
- name: Lint with ruff
working-directory: backend
run: |
ruff check api tests
# Step 5: Run Tests with Pytest and Coverage
- name: Run Pytest
working-directory: backend
run: |
pytest --cov=api --cov=tests --cov-report=xml

0 comments on commit d239f56

Please sign in to comment.