mirror of
https://github.com/fastapi/full-stack-fastapi-template.git
synced 2026-09-24 06:30:19 +00:00
48 lines
1.6 KiB
YAML
48 lines
1.6 KiB
YAML
name: Test Backend
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
test-backend:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
with:
|
|
persist-credentials: false
|
|
- name: Set up Python
|
|
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
|
|
with:
|
|
python-version-file: .python-version
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@d31148d669074a8d0a63714ba94f3201e7020bc3 # v8.3.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.18"
|
|
- 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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
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
|