-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (52 loc) · 1.75 KB
/
build.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
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
name: build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-in-project: true
virtualenvs-path: .venv
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'poetry'
- name: Cache pre-commit
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Cache mypy
uses: actions/cache@v4
with:
path: .mypy_cache/
key: mypy_cache-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root --with dev
- name: pre-commit
run: |
poetry run pre-commit run -a
- name: Mypy
run: |
poetry run mypy --incremental --no-install-types --show-error-codes --pretty src tests
- name: Tests
run: |
poetry run coverage run -m pytest --cov-config=.coveragerc
- name: Tests coverage
run: |
poetry run coverage html
poetry run coverage xml
poetry run coverage report --show-missing
# Requires CODECOV_TOKEN in repository secrets
- name: Upload codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # Only required for private repositories
file: ./coverage.xml
fail_ci_if_error: true