Skip to content

Commit 3328378

Browse files
authored
[Devops] update metrics ci with new tests (#1457)
* update metrics ci with new tests and move to poetry * addess deprecated use of --pr * no venv * remove python install * Update pyproject.toml * Update pyproject.toml * update lock * pip install poetry * fix poetry run * Update metrics.yml remove python install * remove poetry * fix typo
1 parent 951198d commit 3328378

4 files changed

Lines changed: 20 additions & 12 deletions

File tree

.github/workflows/metrics.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,22 @@ jobs:
1515
metrics:
1616
runs-on: ubuntu-latest
1717
container: docker://ghcr.io/iterative/cml:0-dvc2-base1
18+
env:
19+
POETRY_VIRTUALENVS_CREATE: false
1820
steps:
19-
- uses: actions/checkout@v3
21+
- name: Checkout
22+
uses: actions/checkout@v3
2023
with:
2124
ref: ${{ github.event.pull_request.head.sha }}
2225
- name: Install dependencies
2326
run: |
2427
python3 -m pip install --upgrade pip
25-
pip3 install -e .
28+
pip3 install .
2629
pip3 install pytest
2730
pip3 install tabulate # required to md export
2831
pip3 install kaleido # required for plotly export
2932
- name: Train model
30-
run: |
31-
pytest tests/test_model_performance.py
33+
run: pytest tests/test_model_performance.py
3234
- name: Download metrics from main
3335
uses: dawidd6/action-download-artifact@v2
3436
with:
@@ -49,13 +51,19 @@ jobs:
4951
echo "## Model Training" >> report.md
5052
echo "### PeytonManning" >> report.md
5153
cml asset publish tests/metrics/PeytonManning.svg --md >> report.md
54+
echo "### PeytonManning_test30" >> report.md
55+
cml asset publish tests/metrics/PeytonManning_test30.svg --md >> report.md
5256
echo "### YosemiteTemps" >> report.md
5357
cml asset publish tests/metrics/YosemiteTemps.svg --md >> report.md
58+
echo "### YosemiteTemps_test20" >> report.md
59+
cml asset publish tests/metrics/YosemiteTemps_test20.svg --md >> report.md
5460
echo "### AirPassengers" >> report.md
5561
cml asset publish tests/metrics/AirPassengers.svg --md >> report.md
62+
echo "### AirPassengers_test30" >> report.md
63+
cml asset publish tests/metrics/AirPassengers_test30.svg --md >> report.md
5664
echo "\n</details>" >> report.md
5765
# Post reports as comments in GitHub PRs
58-
cml comment update --pr report.md # post to PR
66+
cml comment update --target=pr report.md # post to PR
5967
cml check create --title=ModelReport report.md # update status of check in PR
6068
- name: Upload metrics if on main
6169
uses: actions/upload-artifact@v3

poetry.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ live = ["livelossplot"]
4141
black = { extras = ["jupyter"], version = "^23.1.0" }
4242
flake8 = "^5.0.4"
4343
isort = "^5.11.5"
44-
pytest = "^7.2.2"
45-
kaleido = "0.2.1"
46-
pytest-cov = "^4.0.0"
47-
tabulate = "^0.9" # Used in CI model metrics tests only, for PR bot
44+
pytest = "^7.2"
45+
pytest-cov = "^4.0"
46+
kaleido = "0.2.1" # required for plotly static image export
47+
tabulate = "^0.9" # Used in model metrics CI only; md export for github-actions bot
4848

4949
[tool.poetry.group.docs]
5050
optional = true

tests/test_model_performance.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,10 @@ def test_YosemiteTemps_test20():
208208
accuracy_metrics["time"] = round(end - start, 2)
209209
accuracy_metrics["system_performance"] = round(system_speed, 5)
210210
accuracy_metrics["system_std"] = round(std, 5)
211-
with open(os.path.join(DIR, "tests", "metrics", "YosemiteTemps_test30.json"), "w") as outfile:
211+
with open(os.path.join(DIR, "tests", "metrics", "YosemiteTemps_test20.json"), "w") as outfile:
212212
json.dump(accuracy_metrics, outfile)
213213

214-
create_metrics_plot(metrics).write_image(os.path.join(DIR, "tests", "metrics", "YosemiteTemps_test30.svg"))
214+
create_metrics_plot(metrics).write_image(os.path.join(DIR, "tests", "metrics", "YosemiteTemps_test20.svg"))
215215

216216

217217
def test_AirPassengers():

0 commit comments

Comments
 (0)