forked from eugeneyan/python-collab-template
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (41 loc) · 1.47 KB
/
tests.yml
File metadata and controls
52 lines (41 loc) · 1.47 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
name: Code Quality Checks
on:
pull_request:
jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install uv
run: pip install uv
- name: Install dependencies
run: |
uv venv
uv sync --all-extras
- name: Determine module name
id: module
run: |
if [ -d "src" ]; then
echo "name=src" >> $GITHUB_OUTPUT
else
MODULE_NAME=$(basename $(find . -maxdepth 1 -type d -not -path "*/\.*" -not -path "./tests" -not -path "./scripts" -not -path "./docker" -not -path "." | sort | head -1))
echo "name=$MODULE_NAME" >> $GITHUB_OUTPUT
fi
- name: Run Linter
run: uv run -m ruff check --fix ${{ steps.module.outputs.name }}
- name: Run Formatter
run: uv run -m ruff format ${{ steps.module.outputs.name }}
- name: Run Tests
run: uv run -m pytest tests --cov=${{ steps.module.outputs.name }} --cov-report=term-missing --cov-report=xml
- name: Run ty
run: uv run ty check ${{ steps.module.outputs.name }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
continue-on-error: true
with:
files: coverage.xml
fail_ci_if_error: false