Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GH Action tests and CodeCov #99

Merged
merged 33 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
7140140
Updated build_and_test.yml
rickecon Apr 11, 2024
9189b7c
Updated deploy_docs.yml
rickecon Apr 11, 2024
f2ff9c4
Updated docs_check.yml
rickecon Apr 11, 2024
f69ace2
Updated version
rickecon Apr 11, 2024
9cacbe1
Remove Windows tests from build_and_test.yml
rickecon Apr 11, 2024
3ae55c0
Added file path triggers to build_and_test.yml
rickecon Apr 11, 2024
76fd382
Updated GH Action triggers
rickecon Apr 11, 2024
0c53c19
Update deploy_docs.yml triggers
rickecon Apr 11, 2024
0bac47c
Fixed typos in GH Action triggers
rickecon Apr 11, 2024
5a554e6
Updated mtr_combined_capinc_for_tests.csv
rickecon Apr 11, 2024
3fb35eb
Updated tax_dict_for_tests.pkl
rickecon Apr 11, 2024
0d5944f
Updated test_get_data() and corresponding data in test_get_micro_data.py
rickecon Apr 11, 2024
d2645d7
Temporary file delete
rickecon Apr 12, 2024
1873195
Updated test data files
rickecon Apr 12, 2024
e80f841
Black formatted files
rickecon Apr 12, 2024
7bf6c6b
Removed ' ,' space before comma
rickecon Apr 12, 2024
eaac70d
Removed pytest-pep8 from env and added windows-latest to build_and_te…
rickecon Apr 12, 2024
9f8dd67
Fixed pytest line to just 'not local' in build_and_test.yml
rickecon Apr 12, 2024
79f988a
Updated pytest line in build_and_test.yml
rickecon Apr 12, 2024
d486785
Updated event triggers in docs_check.yml
rickecon Apr 12, 2024
7fd2f4c
Updated event triggers in deploy_docs.yml
rickecon Apr 12, 2024
308c5fe
Updated pytest line in build_and_test.yml
rickecon Apr 12, 2024
173430f
Updated pytest line in build_and_test.yml
rickecon Apr 12, 2024
0a7af99
Update build_and_test.yml and environment.yml
rickecon Apr 12, 2024
14b08cb
Removed Windows tests from build_and_test.yml
rickecon Apr 12, 2024
de79ca3
Updated mtr_combined_capinc_for_tests.csv
rickecon Apr 12, 2024
94d52a7
Updated CHANGELOG.md
rickecon Apr 12, 2024
6bf5e72
Updated environment.yml and setup.py
rickecon Apr 12, 2024
fa30855
Update .gitignore
rickecon Apr 12, 2024
08d2444
Updated pytest.ini and added Windows to build_and_test.yml
rickecon Apr 12, 2024
180a13c
Black formatted setup.py
rickecon Apr 12, 2024
b9c4b91
Updated pyproject.toml
rickecon Apr 12, 2024
415df86
Remove windows-latest from build_and_test.yml
rickecon Apr 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 29 additions & 11 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
name: Build and test [Python 3.9, 3.10]

on: [push, pull_request]

name: Build and test
on:
push:
paths:
- '**.yml'
- '**.toml'
- '**.ini'
- '**.py'
- '**.json'
- '**.R'
- '**.RData'
- '**.csv'
- '**.pkl'
pull_request:
paths:
- '**.yml'
- '**.toml'
- '**.ini'
- '**.py'
- '**.json'
- '**.R'
- '**.RData'
- '**.csv'
- '**.pkl'
jobs:
build:
runs-on: ${{ matrix.os }}
Expand All @@ -15,33 +35,31 @@ jobs:
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Miniconda using Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
auto-update-conda: true
activate-environment: ogusa-dev
environment-file: environment.yml
python-version: ${{ matrix.python-version }}
auto-activate-base: false

- name: Build
shell: bash -l {0}
run: |
pip install -e .
pip install pytest-cov
pip install pytest-pycodestyle
- name: Test
shell: bash -l {0}
working-directory: ./
run: |
pytest -m 'not local and not regression' --cov=./ --cov-report=xml
python -m pytest -m "not local" --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true
11 changes: 10 additions & 1 deletion .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ on:
push:
branches:
- master
paths:
- './docs/**.png'
- './docs/book/content/calibration/images/**.png'
- './docs/README.md'
- './docs/book/**.yml'
- './docs/book/**.bib'
- '**.md'
- './docs/book/content/api/**.rst'
- './ogusa/**.py'
jobs:
build-and-deploy:
if: github.repository == 'PSLmodels/OG-USA'
Expand All @@ -14,7 +23,7 @@ jobs:
persist-credentials: false

- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
activate-environment: ogusa-dev
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/docs_check.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
name: Check that docs build
on: [push, pull_request]
on:
pull_request:
paths:
- './docs/**.png'
- './docs/book/content/calibration/images/**.png'
- './docs/README.md'
- './docs/book/**.yml'
- './docs/book/**.bib'
- '**.md'
- './docs/book/content/api/**.rst'
- './ogusa/**.py'

jobs:
build:
Expand All @@ -11,7 +21,7 @@ jobs:
persist-credentials: false

- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
activate-environment: ogusa-dev
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ envs/
*/__pycache__/*
docs/book/_build/*
docs/build*
*micro_data_*.pkl
examples/OG-USA_example_plots/*
examples/ogusa_example_output.csv
examples/OG-USA-Example/*
cs-config/cs_config/OUTPUT_BASELINE/*
data/csv_output_files/*
data/images/*
ogusa/csv_output_files/*
ogusa/images/*
.vscode/
*default.profraw
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.5] - 2024-04-12 10:00:00

### Added

- Adds a list of file change event triggers to `build_and_test.yml` so that those tests only run when one of those files is changed.
- Updates the codecov GH Action to version 4 and adds a secret token.
- Adds a list of file change event triggers to `deploy_docs.yml` and `docs_check.yml`, and limits `docs_check.yml` to only run on pull requests.
- Fixes a small typo in `tax_functions.md` in order to test if the event triggers worked properly (yes, they worked)
- Updated some dependencies in `environment.yml`.
- Updated three data files in the `/tests/test_io_data/` file that used output from the taxcalc package. This package was recently updated. I also changed the `test_get_data()` test in the `test_get_micro_data.py` file because the new taxcalc data included four years instead of two years. In order to conserve repo memory footprint, we deleted the last two years of the output.

## [0.1.4] - 2024-04-03 15:00:00

### Added
Expand Down Expand Up @@ -68,6 +79,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0



[0.1.5]: https://github.com/PSLmodels/OG-USA/compare/v0.1.4...v0.1.5
[0.1.4]: https://github.com/PSLmodels/OG-USA/compare/v0.1.3...v0.1.4
[0.1.3]: https://github.com/PSLmodels/OG-USA/compare/v0.1.2...v0.1.3
[0.1.2]: https://github.com/PSLmodels/OG-USA/compare/v0.1.1...v0.1.2
[0.1.1]: https://github.com/PSLmodels/OG-USA/compare/v0.1.0...v0.1.1
25 changes: 25 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
codecov:
require_ci_to_pass: yes

coverage:
precision: 2
round: down
range: "70...100"

parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no

comment:
layout: "reach, diff, flags, files"
behavior: default
require_changes: false

ignore:
- "setup.py"
- "./cs-config/**/*" # ignore folders and all its contents
- "./tests/" # ignore folders and all its contents
2 changes: 1 addition & 1 deletion docs/book/content/calibration/tax_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ The second difficulty in modeling realistic tax and incentive detail is the need
\tau^{mtry} \equiv \frac{\partial T_{s,t}}{\partial r_{hh,t}b_{j,s,t}} = \frac{\partial T_{s,t}}{\partial y_{j,s,t}} \qquad\quad\forall j,t \quad\text{and}\quad E+1\leq s\leq E+S
```

As we show in Section [Optimality Conditions](https://pslmodels.github.io/OG-Core/content/theory/households.html#optimality-conditions) of the Households chapter of the `OG-Core` repository documentation, the derivative of total tax liability with respect to labor supply $\frac{\partial T_{s,t}}{n_{j,s,t}}$ and the derivative of total tax liability next period with respect to savings $\frac{\partial T_{s+1,t+1}}{b_{j,s+1,t+1}}$ show up in the household Euler equations for labor supply and savings , respectively, in the `OG-Core` documentation. It is valuable to be able to express those marginal tax rates, for which we have no data, as marginal tax rates for which we do have data. The following two expressions show how the marginal tax rates of labor supply can be expressed as the marginal tax rate on labor income times the household-specific wage and how the marginal tax rate of savings can be expressed as the marginal tax rate of capital income times the interest rate.
As we show in Section [Optimality Conditions](https://pslmodels.github.io/OG-Core/content/theory/households.html#optimality-conditions) of the Households chapter of the `OG-Core` repository documentation, the derivative of total tax liability with respect to labor supply $\frac{\partial T_{s,t}}{n_{j,s,t}}$ and the derivative of total tax liability next period with respect to savings $\frac{\partial T_{s+1,t+1}}{b_{j,s+1,t+1}}$ show up in the household Euler equations for labor supply and savings, respectively, in the `OG-Core` documentation. It is valuable to be able to express those marginal tax rates, for which we have no data, as marginal tax rates for which we do have data. The following two expressions show how the marginal tax rates of labor supply can be expressed as the marginal tax rate on labor income times the household-specific wage and how the marginal tax rate of savings can be expressed as the marginal tax rate of capital income times the interest rate.

```{math}
:label: EqMTRx_derive
Expand Down
11 changes: 6 additions & 5 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,22 @@ channels:
dependencies:
- python>=3.7.7,<3.12
- numpy
- setuptools
- numba>=0.54
- scipy>=1.5.0
- scipy>=1.7.1
- pandas>=1.2.5
- matplotlib
- dask>=2.30.0
- dask-core>=2.30.0
- distributed>=2.30.1
- paramtools>=0.15.0
- taxcalc>=3.0.0
- sphinx>=3.5.4
- sphinx-book-theme>=0.1.3
- pip
- jupyter-book>=0.11.3
- pytest>=6.0
- pytest-pep8
- pytest-cov
- pytest-xdist
- pycodestyle
- pylint
- coverage
- requests
Expand All @@ -27,8 +28,8 @@ dependencies:
- linearmodels
- rpy2<=3.5.11
- black>=24.1.1
- pip
- pip:
- jupyter-book>=0.9.1
- openpyxl>=3.1.2
- cs-kit
- cs2tc
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ build-backend = "setuptools.build_meta"

[tool.black]
line-length = 79
target-version = ["py39", "py310", "py311"]
target-version = ["py39", "py310"]
include = '\.pyi?$'
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
[pytest]
minversion = 6.0
testpaths =
ogusa/tests
./tests
markers =
local: marks tests that are run locally only and not on GH Actions
Loading
Loading