From f875c01f04c4af61fad1477f9313b3beed324044 Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 12 Dec 2024 10:23:47 +0200 Subject: [PATCH 1/5] :construction_worker: Rearrange pytest report after comments Because pytest reports fail on errors, preventing comments of test failures being posted (we only ever see comments of successful test results) --- .github/workflows/continuous-deploy.yml | 40 ++++++++++++------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/continuous-deploy.yml b/.github/workflows/continuous-deploy.yml index 55ddbc637..59cb710d4 100644 --- a/.github/workflows/continuous-deploy.yml +++ b/.github/workflows/continuous-deploy.yml @@ -932,26 +932,6 @@ jobs: OUTPUT_FILE: test_output.xml COVERAGE_FILE: test_coverage.txt - - name: Publish Pytest Report - uses: mikepenz/action-junit-report@v5 - if: steps.pytest.outcome == 'success' - with: - check_name: JUnit Test Report - report_paths: "./pytest/test_output.xml" - fail_on_failure: true - detailed_summary: true - require_passed_tests: true - - - name: Publish Pytest Regression Report - uses: mikepenz/action-junit-report@v5 - if: steps.pytest-init-regression.outcome == 'success' || steps.pytest-run-regression.outcome == 'success' - with: - check_name: JUnit Test Report Regression - report_paths: "./pytest-regression/test_output.xml" - fail_on_failure: true - detailed_summary: true - require_passed_tests: true - - name: Pytest coverage comment if: steps.pytest.outcome == 'success' uses: MishaKav/pytest-coverage-comment@v1.1.53 @@ -976,6 +956,26 @@ jobs: hide-report: ${{ github.event_name != 'pull_request' }} hide-comment: ${{ github.event_name != 'pull_request' }} + - name: Publish Pytest Report + uses: mikepenz/action-junit-report@v5 + if: steps.pytest.outcome == 'success' + with: + check_name: JUnit Test Report + report_paths: "./pytest/test_output.xml" + fail_on_failure: true + detailed_summary: true + require_passed_tests: true + + - name: Publish Pytest Regression Report + uses: mikepenz/action-junit-report@v5 + if: steps.pytest-init-regression.outcome == 'success' || steps.pytest-run-regression.outcome == 'success' + with: + check_name: JUnit Test Report Regression + report_paths: "./pytest-regression/test_output.xml" + fail_on_failure: true + detailed_summary: true + require_passed_tests: true + - name: Helmfile destroy pytest uses: helmfile/helmfile-action@v2.0.2 if: always() From 5ee5d59b2319f5a1b0c8f3c89514280ae13a28bc Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 12 Dec 2024 12:51:33 +0200 Subject: [PATCH 2/5] :art: --- .vscode/settings.json | 3 +++ dockerfiles/tests/Dockerfile | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index dbcaa1af9..f4df5310a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -42,6 +42,7 @@ "isort", "jetstream", "jsonld", + "junitxml", "keyevent", "Lago", "levelname", @@ -68,7 +69,9 @@ "proposalsattach", "prover", "psubscribe", + "pycache", "pydantic", + "pyproject", "pytest", "PYTHONPATH", "reqs", diff --git a/dockerfiles/tests/Dockerfile b/dockerfiles/tests/Dockerfile index 65b7881f9..ea422f4c7 100644 --- a/dockerfiles/tests/Dockerfile +++ b/dockerfiles/tests/Dockerfile @@ -14,14 +14,14 @@ COPY endorser/poetry.lock endorser/ COPY trustregistry/poetry.lock trustregistry/ COPY waypoint/poetry.lock waypoint/ -# Install all depedencies +# Install all dependencies ARG POETRY_VERSION=1.8.4 RUN pip install --no-cache-dir poetry==${POETRY_VERSION} ENV POETRY_VIRTUALENVS_CREATE=false ARG MODULES="app endorser trustregistry waypoint" RUN for module in ${MODULES}; do \ - cd /tests/$module && poetry install; \ + cd /tests/$module && poetry install; \ done COPY . . From 97e5bce7684ba4c79cf766c04f86b8b148e6f2da Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 12 Dec 2024 12:51:59 +0200 Subject: [PATCH 3/5] :see_no_evil: Update .dockerignore to also copy pyproject.toml --- .dockerignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index 733b05b96..b60c7d6ae 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,6 +2,7 @@ ** # Except the following +!pyproject.toml !app/ !shared/ !endorser/ @@ -9,7 +10,6 @@ !waypoint/ !scripts/ !configuration/ - !LICENSE **/__pycache__/ From 11c6dedbb7ecedfb858aaf1688988940ffc8095a Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 12 Dec 2024 14:02:55 +0200 Subject: [PATCH 4/5] :wrench: Remove pytest.ini_options config from main pyproject.toml --- pyproject.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c0353eff8..231319b31 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,3 @@ omit = ["*/tests/*"] [tool.isort] profile = "black" - -[tool.pytest.ini_options] -addopts = "--junitxml=junit.xml -p no:cacheprovider --cov-report=xml --cov-report=term" -junit_family = "xunit2" From 23140033d903a86b0c4fed763324fd0e49e4fd51 Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 12 Dec 2024 14:54:44 +0200 Subject: [PATCH 5/5] :art: Change workdir name, since it clashes with omitting /tests/ dir in coverage report --- dockerfiles/tests/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dockerfiles/tests/Dockerfile b/dockerfiles/tests/Dockerfile index ea422f4c7..e0159ebc1 100644 --- a/dockerfiles/tests/Dockerfile +++ b/dockerfiles/tests/Dockerfile @@ -1,6 +1,6 @@ FROM python:3.12-slim -WORKDIR /tests +WORKDIR /cloudapi-tests # Copy the pyproject.toml for each submodule COPY app/pyproject.toml app/ @@ -21,7 +21,7 @@ RUN pip install --no-cache-dir poetry==${POETRY_VERSION} ENV POETRY_VIRTUALENVS_CREATE=false ARG MODULES="app endorser trustregistry waypoint" RUN for module in ${MODULES}; do \ - cd /tests/$module && poetry install; \ + cd /cloudapi-tests/$module && poetry install; \ done COPY . .