Skip to content

Commit 46572f2

Browse files
committed
trying new codecov config
1 parent 10337d0 commit 46572f2

File tree

4 files changed

+47
-176
lines changed

4 files changed

+47
-176
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -8,146 +8,37 @@ on:
88

99
jobs:
1010
test:
11+
name: test
1112
runs-on: ubuntu-latest
12-
1313
steps:
14-
- name: Check out repository
15-
uses: actions/checkout@v3
16-
17-
- name: Set up Python 3.13
18-
uses: actions/setup-python@v4
19-
with:
20-
python-version: "3.13"
21-
22-
- name: Install PDM
23-
run: |
24-
python -m pip install --upgrade pip
25-
pip install pdm
26-
27-
- name: Install dependencies
28-
run: |
29-
pdm install -G:all
30-
31-
- name: Run tests with coverage
32-
run: |
33-
pdm run pytest --cov-report=xml
34-
35-
- name: Upload coverage to Codecov
36-
uses: codecov/codecov-action@v3
37-
with:
38-
token: ${{ secrets.CODECOV_TOKEN }}
39-
file: ./coverage.xml
40-
fail_ci_if_error: true
41-
verbose: true
42-
43-
format:
44-
runs-on: ubuntu-latest
45-
46-
steps:
47-
- name: Check out repository
48-
uses: actions/checkout@v3
49-
50-
- name: Set up Python 3.13
51-
uses: actions/setup-python@v4
52-
with:
53-
python-version: "3.13"
54-
55-
- name: Install PDM
56-
run: |
57-
python -m pip install --upgrade pip
58-
pip install pdm
59-
60-
- name: Install dependencies
61-
run: |
62-
pdm install -G:all
63-
64-
- name: Check Black formatting
65-
run: |
66-
pdm run black --check
67-
68-
- name: Check isort
69-
run: |
70-
pdm run isort --check
71-
72-
- name: Check unused imports with autoflake
73-
run: |
74-
pdm run autoflake
75-
76-
type-check:
77-
runs-on: ubuntu-latest
78-
79-
steps:
80-
- name: Check out repository
81-
uses: actions/checkout@v3
82-
83-
- name: Set up Python 3.13
84-
uses: actions/setup-python@v4
85-
with:
86-
python-version: "3.13"
87-
88-
- name: Install PDM
89-
run: |
90-
python -m pip install --upgrade pip
91-
pip install pdm
92-
93-
- name: Install dependencies
94-
run: |
95-
pdm install -G:all
96-
97-
- name: Run mypy
98-
run: |
99-
pdm run mypy
100-
101-
docs:
102-
runs-on: ubuntu-latest
103-
104-
steps:
105-
- name: Check out repository
106-
uses: actions/checkout@v3
107-
108-
- name: Set up Python 3.13
109-
uses: actions/setup-python@v4
110-
with:
111-
python-version: "3.13"
112-
113-
- name: Install PDM
114-
run: |
115-
python -m pip install --upgrade pip
116-
pip install pdm
117-
118-
- name: Install dependencies
119-
run: |
120-
pdm install -G:all
121-
122-
- name: Check markdown formatting
123-
run: |
124-
echo "Markdown format checking temporarily disabled"
125-
exit 0
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Set up Python 3.13
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: "3.13"
23+
24+
- name: Install PDM
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install pdm
28+
29+
- name: Install dependencies
30+
run: |
31+
pdm install -G:all
32+
33+
- name: Run tests with coverage
34+
run: |
35+
pdm run pytest --cov=fitbit_client --cov-report=xml:coverage.xml
12636
127-
# todo: https://github.com/ydah/mdformat-action
128-
129-
# build:
130-
# runs-on: ubuntu-latest
131-
# needs: [test, format, type-check, docs]
132-
133-
# steps:
134-
# - name: Check out repository
135-
# uses: actions/checkout@v3
136-
137-
# - name: Set up Python 3.13
138-
# uses: actions/setup-python@v4
139-
# with:
140-
# python-version: "3.13"
141-
142-
# - name: Install PDM
143-
# run: |
144-
# python -m pip install --upgrade pip
145-
# pip install pdm
146-
147-
# - name: Install dependencies
148-
# run: |
149-
# pdm install -G:all
150-
151-
# - name: Build package
152-
# run: |
153-
# pdm build
37+
- name: Upload coverage to Codecov
38+
uses: codecov/codecov-action@v5
39+
with:
40+
token: ${{ secrets.CODECOV_TOKEN }}
41+
files: ./coverage.xml
42+
# fail_ci_if_error: false
43+
name: codecov-umbrella
44+
verbose: true

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Fitbit Client
44

55
[![CI](https://github.com/jpstroop/fitbit-client/actions/workflows/ci.yml/badge.svg)](https://github.com/jpstroop/fitbit-client/actions/workflows/ci.yml)
6-
[![codecov](https://codecov.io/gh/jpstroop/fitbit-client/branch/main/graph/badge.svg)](https://codecov.io/gh/jpstroop/fitbit-client)
6+
[![codecov](https://codecov.io/gh/jpstroop/fitbit-client-python/graph/badge.svg?token=DM0JD8VKZ4)](https://codecov.io/gh/jpstroop/fitbit-client-python)
77
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
88
[![Python 3.13+](https://img.shields.io/badge/python-3.13+-blue.svg)](https://www.python.org/downloads/release/python-3130/)
99
[![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)

codecov.yml

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,22 @@
11
codecov:
22
require_ci_to_pass: yes
33
strict_yaml_branch: main
4+
notify:
5+
wait_for_ci: false
6+
after_n_builds: 1
47

58
coverage:
6-
precision: 2
7-
round: down
8-
range: "95...100"
99
status:
10-
project:
10+
project: #add everything under here, more options at https://docs.codecov.com/docs/commit-status
1111
default:
1212
target: 100%
1313
threshold: 0%
14-
base: auto
15-
branches:
16-
- main
17-
if_not_found: failure
18-
if_ci_failed: error
19-
informational: false
20-
only_pulls: false
21-
patch:
22-
default:
23-
target: 100%
24-
threshold: 0%
25-
base: auto
26-
branches:
27-
- main
28-
if_not_found: failure
29-
if_ci_failed: error
30-
informational: false
31-
only_pulls: false
32-
33-
parsers:
34-
gcov:
35-
branch_detection:
36-
conditional: yes
37-
loop: yes
38-
method: no
39-
macro: no
14+
base: auto
4015

41-
comment:
42-
layout: "reach,diff,flags,files,footer"
16+
comment: #this is a top-level key
17+
layout: " diff, flags, files"
4318
behavior: default
44-
require_changes: no
19+
require_changes: false # if true: only post the comment if coverage changes
20+
require_base: false # [true :: must have a base report to post]
21+
require_head: true # [true :: must have a head report to post]
22+
hide_project_coverage: false # [true :: only show coverage on the git diff aka patch coverage]

fitbit_client/resources/nutrition.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,12 @@ def create_food(
103103
error_type="client_validation",
104104
field_name="CALORIES_FROM_FAT",
105105
)
106-
# Handle both enum and string nutritional values
107106
for key, value in nutritional_values.items():
108107
if isinstance(key, NutritionalValue):
109-
params[key.value] = float(value)
108+
if key == NutritionalValue.CALORIES_FROM_FAT:
109+
params[key.value] = int(value)
110+
else:
111+
params[key.value] = float(value)
110112
else:
111113
params[str(key)] = float(value)
112114

0 commit comments

Comments
 (0)