Skip to content

Commit

Permalink
Introduce codecov (#96)
Browse files Browse the repository at this point in the history
* Update demo_notebook_08en_chicago.ipynb

* codecov

* e

* .coveragerc to exclude GUI

* separate tests

* up
  • Loading branch information
toruseo authored Jul 30, 2024
1 parent 71f5699 commit 54e01b2
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .github/.coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[run]
omit =
uxsim/ResultGUIViewer/*
35 changes: 35 additions & 0 deletions .github/workflows/measure-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Measure coverage

on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 6 * * 1'

jobs:
measure-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uxsim and dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
- name: Install pytest other dependencies
run: pip install pytest pytest-rerunfailures pytest-xdist pytest-cov setuptools osmnx requests
- name: Run verifications with pytest
run: pytest -n auto tests/test_verification_straight_road.py tests/test_verification_route_choice.py tests/test_verification_node.py tests/test_verification_exceptional.py tests/test_verification_sioux_falls.py tests/test_verification_multilane.py tests/test_verification_taxi.py tests/test_other_functions.py --durations=0 -v --cov=uxsim --cov-report=xml --cov-config=.github/.coveragerc
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
name: codecov-umbrella
fail_ci_if_error: true
verbose: true

2 changes: 1 addition & 1 deletion .github/workflows/run-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
- name: Install pytest other dependencies
run: pip install pytest pytest-xdist setuptools gymnasium torch osmnx deap
- name: Run examples with pytest
run: pytest -n auto tests/test_examples.py --durations=0 -v
run: pytest -n auto tests/test_examples.py --durations=0 -v
2 changes: 2 additions & 0 deletions .github/workflows/test-functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ jobs:
run: pip install pytest pytest-rerunfailures pytest-xdist setuptools osmnx requests
- name: Run tests with pytest
run: pytest -n auto tests/test_other_functions.py --durations=0 -v


2 changes: 1 addition & 1 deletion .github/workflows/verify-module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ jobs:
- name: Install pytest other dependencies
run: pip install pytest pytest-rerunfailures pytest-xdist setuptools
- name: Run verifications with pytest
run: pytest -n auto tests/test_verification_straight_road.py tests/test_verification_route_choice.py tests/test_verification_node.py tests/test_verification_exceptional.py tests/test_verification_sioux_falls.py tests/test_verification_multilane.py tests/test_verification_taxi.py --durations=0 -v
run: pytest -n auto tests/test_verification_straight_road.py tests/test_verification_route_choice.py tests/test_verification_node.py tests/test_verification_exceptional.py tests/test_verification_sioux_falls.py tests/test_verification_multilane.py tests/test_verification_taxi.py --durations=0 -v
6 changes: 4 additions & 2 deletions demos_and_examples/demo_notebook_08en_chicago.ipynb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/test_other_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,4 @@ def test_scenario_write_and_read():
df2 = W2.analyzer.basic_to_pandas()
print(df2)

assert df1["total_travel_time"][0] == df2["total_travel_time"][0]
assert df1["total_travel_time"][0] == df2["total_travel_time"][0]

0 comments on commit 54e01b2

Please sign in to comment.