diff --git a/.github/workflows/metrics.yml b/.github/workflows/metrics.yml index 5510a13c7..885b35e38 100644 --- a/.github/workflows/metrics.yml +++ b/.github/workflows/metrics.yml @@ -15,20 +15,22 @@ jobs: metrics: runs-on: ubuntu-latest container: docker://ghcr.io/iterative/cml:0-dvc2-base1 + env: + POETRY_VIRTUALENVS_CREATE: false steps: - - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} - name: Install dependencies run: | python3 -m pip install --upgrade pip - pip3 install -e . + pip3 install . pip3 install pytest pip3 install tabulate # required to md export pip3 install kaleido # required for plotly export - name: Train model - run: | - pytest tests/test_model_performance.py + run: pytest tests/test_model_performance.py - name: Download metrics from main uses: dawidd6/action-download-artifact@v2 with: @@ -49,13 +51,19 @@ jobs: echo "## Model Training" >> report.md echo "### PeytonManning" >> report.md cml asset publish tests/metrics/PeytonManning.svg --md >> report.md + echo "### PeytonManning_test30" >> report.md + cml asset publish tests/metrics/PeytonManning_test30.svg --md >> report.md echo "### YosemiteTemps" >> report.md cml asset publish tests/metrics/YosemiteTemps.svg --md >> report.md + echo "### YosemiteTemps_test20" >> report.md + cml asset publish tests/metrics/YosemiteTemps_test20.svg --md >> report.md echo "### AirPassengers" >> report.md cml asset publish tests/metrics/AirPassengers.svg --md >> report.md + echo "### AirPassengers_test30" >> report.md + cml asset publish tests/metrics/AirPassengers_test30.svg --md >> report.md echo "\n" >> report.md # Post reports as comments in GitHub PRs - cml comment update --pr report.md # post to PR + cml comment update --target=pr report.md # post to PR cml check create --title=ModelReport report.md # update status of check in PR - name: Upload metrics if on main uses: actions/upload-artifact@v3 diff --git a/poetry.lock b/poetry.lock index 53d195e19..fee1ecb84 100644 --- a/poetry.lock +++ b/poetry.lock @@ -4314,4 +4314,4 @@ live = ["livelossplot"] [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.11" -content-hash = "cf9b835b7aa3ca7b8f63cd6830a39930caec05b12688652b715faf55d35b235f" +content-hash = "e9101b1a0eb4ed0cc7cd2d81f3dc43740bf74c6faab62a55e8d6e34734084a4c" diff --git a/pyproject.toml b/pyproject.toml index ba05b7a22..5fa023d22 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,10 +41,10 @@ live = ["livelossplot"] black = { extras = ["jupyter"], version = "^23.1.0" } flake8 = "^5.0.4" isort = "^5.11.5" -pytest = "^7.2.2" -kaleido = "0.2.1" -pytest-cov = "^4.0.0" -tabulate = "^0.9" # Used in CI model metrics tests only, for PR bot +pytest = "^7.2" +pytest-cov = "^4.0" +kaleido = "0.2.1" # required for plotly static image export +tabulate = "^0.9" # Used in model metrics CI only; md export for github-actions bot [tool.poetry.group.docs] optional = true diff --git a/tests/test_model_performance.py b/tests/test_model_performance.py index 22fa9697d..f3ba7d1bc 100644 --- a/tests/test_model_performance.py +++ b/tests/test_model_performance.py @@ -208,10 +208,10 @@ def test_YosemiteTemps_test20(): accuracy_metrics["time"] = round(end - start, 2) accuracy_metrics["system_performance"] = round(system_speed, 5) accuracy_metrics["system_std"] = round(std, 5) - with open(os.path.join(DIR, "tests", "metrics", "YosemiteTemps_test30.json"), "w") as outfile: + with open(os.path.join(DIR, "tests", "metrics", "YosemiteTemps_test20.json"), "w") as outfile: json.dump(accuracy_metrics, outfile) - create_metrics_plot(metrics).write_image(os.path.join(DIR, "tests", "metrics", "YosemiteTemps_test30.svg")) + create_metrics_plot(metrics).write_image(os.path.join(DIR, "tests", "metrics", "YosemiteTemps_test20.svg")) def test_AirPassengers():