-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (84 loc) · 2.26 KB
/
python-check.yml
File metadata and controls
101 lines (84 loc) · 2.26 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Python checks 🐍
on:
push:
branches:
- master
pull_request:
branches:
- master
paths:
- movie_catalog/**
jobs:
run-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version-file: ".python-version"
- name: Setup UV
uses: astral-sh/setup-uv@v5
- name: Install the project
run: uv sync --locked --all-extras --dev
- name: Run ruff
uses: astral-sh/ruff-action@v3
with:
version-file: 'pyproject.toml'
- name: Run mypy
run: uv run mypy movie_catalog
run-tests:
runs-on: ubuntu-latest
container: node:20-bookworm-slim
needs:
- run-checks
services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version-file: ".python-version"
- name: Setup UV
uses: astral-sh/setup-uv@v5
- name: Install dependencies
run: uv sync --locked --all-extras --dev
- name: Run python tests
run: |
uv run pytest \
--cov=movie_catalog \
--cov-report=term-missing \
--cov-report=xml:coverage.xml
env:
TESTING: 1
MOVIE_CATALOG__REDIS__CONNECTION__HOST: redis
MOVIE_CATALOG__REDIS__CONNECTION__PORT: 6379
MOVIE_CATALOG__SESSION__SECRET_KEY: "abc"
- name: Upload artefacts
uses: actions/upload-artifact@v4
with:
name: coverage-reports
path: |
coverage.xml
retention-days: 1
upload-report-to-codcov:
runs-on: ubuntu-latest
needs:
- run-tests
steps:
- uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: coverage-reports
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
fail_ci_if_error: 'true'