From a3bf27a2129851d7696d7a5f43206b92de562fb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Witkowski?= Date: Sat, 3 Aug 2024 16:56:25 +0200 Subject: [PATCH] Dev: publish backend test results to Github Actions (#20) --- .github/workflows/cd-backend.yaml | 8 ++++++++ .gitignore | 3 ++- backend/run_tests.sh | 2 +- backend/tests/requirements.txt | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd-backend.yaml b/.github/workflows/cd-backend.yaml index 0273c67..61451a6 100644 --- a/.github/workflows/cd-backend.yaml +++ b/.github/workflows/cd-backend.yaml @@ -17,6 +17,7 @@ env: jobs: build-api: runs-on: ubuntu-latest + permissions: write-all steps: - uses: actions/checkout@v4 @@ -40,6 +41,13 @@ jobs: run: | ./run_tests.sh + - name: 'Publish Test Results' + uses: EnricoMi/publish-unit-test-result-action@v2 + if: always() + with: + files: | + ./backend/test-results/**/*.xml + - name: 'Build Backend API' working-directory: ./backend run: | diff --git a/.gitignore b/.gitignore index 7b560d6..256b001 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ *.log __pycache__ node_modules -db/prod_dump_2024_06_31.sql \ No newline at end of file +db/prod_dump_2024_06_31.sql +backend/test-results \ No newline at end of file diff --git a/backend/run_tests.sh b/backend/run_tests.sh index 03aa415..d312621 100755 --- a/backend/run_tests.sh +++ b/backend/run_tests.sh @@ -1,6 +1,6 @@ export PYTHONPATH=$PYTHONPATH':./' -python3 -m unittest -v +python3 -m xmlrunner -o ./test-results if [[ $? -ne 0 ]]; then exit 1 diff --git a/backend/tests/requirements.txt b/backend/tests/requirements.txt index fa1c1a0..816f614 100644 --- a/backend/tests/requirements.txt +++ b/backend/tests/requirements.txt @@ -2,3 +2,4 @@ ddt==1.7.2 psycopg==3.2.1 pytest==8.3.2 testcontainers[postgres]==4.7.2 +unittest-xml-reporting==3.2.0