mirror of
https://github.com/fastapi/full-stack-fastapi-template.git
synced 2026-09-22 13:48:42 +00:00
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
51 lines
1.6 KiB
YAML
51 lines
1.6 KiB
YAML
name: Test Backend
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- synchronize
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
test-backend:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
- name: Set up Python
|
|
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
|
with:
|
|
python-version: "3.10"
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
|
with:
|
|
# Before upgrading uv version, make sure astral-sh/setup-uv knows its checksum.
|
|
# See: https://github.com/astral-sh/setup-uv/issues/851#issuecomment-4282017837
|
|
version: "0.11.4"
|
|
- run: docker compose down -v --remove-orphans
|
|
- run: docker compose up -d db mailcatcher
|
|
- name: Migrate DB
|
|
run: uv run bash scripts/prestart.sh
|
|
working-directory: backend
|
|
- name: Run tests
|
|
run: uv run bash scripts/tests-start.sh "Coverage for ${{ github.sha }}"
|
|
working-directory: backend
|
|
- run: docker compose down -v --remove-orphans
|
|
- name: Store coverage files
|
|
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
|
with:
|
|
name: coverage-html
|
|
path: backend/htmlcov
|
|
include-hidden-files: true
|
|
- name: Coverage report
|
|
run: uv run coverage report --fail-under=90
|
|
working-directory: backend
|