-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (39 loc) · 1.35 KB
/
upload-code-coverage.yaml
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
name: Upload Code Coverage
on: [ workflow_dispatch ]
concurrency:
group: upload-code-coverage
jobs:
upload-code-coverage:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- id: cache-venv
uses: actions/cache@v4
with:
path: .venv
key: upload-code-coverage/runner/${{ runner.os }}/python/${{ steps.setup-python.outputs.python-version }}/hash/${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cache-venv.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root --with=test --with=pydantic --with=requests --with=aiohttp --with=httpx
- run: poetry install --no-interaction --only-root
- run: poetry run coverage run -m pytest
- run: poetry run coverage xml --include="src/*"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
file: coverage.xml
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}