-
Notifications
You must be signed in to change notification settings - Fork 365
32 lines (29 loc) · 1.03 KB
/
backend_tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
name: Pytest
on:
push:
branches: [main]
pull_request: {}
jobs:
pytest:
permissions: write-all
environment: development
runs-on: ubuntu-latest
env:
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
NEXT_PUBLIC_API_HOSTNAME: ${{ secrets.NEXT_PUBLIC_API_HOSTNAME }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Docker
run: docker compose up test_db -d
- name: Run tests
run: |
mkdir -p coverage
docker compose build --build-arg INSTALL_COMMUNITY_DEPS=true backend
docker compose run --name backend-container -v $(pwd)/coverage:/app/coverage -e COHERE_API_KEY=$COHERE_API_KEY backend poetry run pytest --cov=src/backend --cov-report=xml:/app/coverage/coverage.xml src/backend/tests/
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage/coverage.xml