-
Notifications
You must be signed in to change notification settings - Fork 3
61 lines (54 loc) · 1.69 KB
/
coverage.yml
File metadata and controls
61 lines (54 loc) · 1.69 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
name: Code Coverage
on:
push:
branches:
- main
# filter on files that should trigger this workflow
paths:
- "pyproject.toml"
- "**.py"
- ".github/workflows/coverage.yml"
pull_request:
# filter on files that should trigger this workflow
paths:
- "pyproject.toml"
- "**.py"
- ".github/workflows/coverage.yml"
workflow_dispatch:
# Only cancel concurrent runs of the same workflow
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-coverage
cancel-in-progress: true
jobs:
code_coverage:
name: Calculate Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3.5.2
- name: Setup Python
uses: actions/setup-python@v4.5.0
with:
python-version: "3.7"
cache: "pip" # cache dependencies
cache-dependency-path: "pyproject.toml"
- name: Install Project Dependencies
run: |
pip install .[tests]
- name: Calculate coverage
run: |
# Config in pyproject.toml
# Calling via python adds the current directory to sys path
# Prevents module not found errors
pytest --cov --cov-report "xml:coverage.xml"
env:
WIKIFIER_API_KEY: ${{ secrets.WIKIFIER_API_KEY }}
- name: Update CodeCov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: ./coverage.xml
flags: Unit_Tests # optional
# name: codecov-umbrella # optional
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)