-
Notifications
You must be signed in to change notification settings - Fork 6
70 lines (63 loc) · 2.05 KB
/
run_coverage.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
67
68
69
70
name: Run code coverage
on:
push:
branches:
- dev
tags-ignore: # exclude tags created by "ci_addons publish_github_release"
- 'latest'
- 'latest-tmp'
pull_request:
workflow_dispatch:
jobs:
run-coverage:
name: ${{ matrix.os }}, opt reqs ${{ matrix.opt_req }}
runs-on: ${{ matrix.os }}
# TODO
# run pipeline on either a push event or a PR event on a fork
# if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.opt_req }}
cancel-in-progress: true
strategy:
matrix:
include:
- { os: ubuntu-latest , opt_req: true }
- { os: ubuntu-latest , opt_req: false }
- { os: windows-latest, opt_req: false }
- { os: macos-latest , opt_req: false }
env: # used by codecov-action
OS: ${{ matrix.os }}
PYTHON: '3.13'
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON }}
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
- name: Install package
if: ! ${{ matrix.opt_req }}
run: |
python -m pip install ".[test]"
- name: Install package with optional dependencies
if: ${{ matrix.opt_req }}
run: python -m pip install ".[test,full]"
- name: Run tests and generate coverage report
run: |
# coverage is configured in pyproject.toml
# codecov uploader requires xml format
python -m pip list
pytest --cov --cov-report=xml --cov-report=term
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
files: ./coverage.xml
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}