From c469c6998afe83b6ccadfd62af394506ac778dd1 Mon Sep 17 00:00:00 2001 From: Adyanth Hosavalike Date: Fri, 18 Oct 2024 23:18:55 +0530 Subject: [PATCH 1/2] Fix --- .github/workflows/{ci.yaml => docker.yaml} | 0 .github/workflows/test.yaml | 16 +++++++++++----- .gitignore | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-) rename .github/workflows/{ci.yaml => docker.yaml} (100%) diff --git a/.github/workflows/ci.yaml b/.github/workflows/docker.yaml similarity index 100% rename from .github/workflows/ci.yaml rename to .github/workflows/docker.yaml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 7d83c95..ac6e2e8 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,13 +1,13 @@ name: Python Test on: - workflow_dispatch: - push: - branches: - - 'main' pull_request: branches: - '*' +permissions: + contents: write + checks: write + pull-requests: write # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: @@ -30,4 +30,10 @@ jobs: python -m pip install --upgrade pip pip install -r requirements-dev.txt - name: Test - run: python -m pytest --junitxml=junit/test-results.xml --cov=main --cov-report=xml --cov-report=html + run: python -m pytest --junitxml=pytest.xml --cov=main --cov-report=xml:coverage.xml | tee pytest-coverage.txt + - name: Pytest coverage comment + uses: MishaKav/pytest-coverage-comment@main + with: + pytest-coverage-path: ./pytest-coverage.txt + pytest-xml-coverage-path: ./coverage.xml + junitxml-path: ./pytest.xml diff --git a/.gitignore b/.gitignore index 9ee25b3..25b6f4c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ venv/ __pycache__/ .coverage coverage.xml -htlmcov/ -junit/ +pytest.xml +pytest-coverage.txt .ruff_cache .DS_Store From c26fc64daa25f5e6a6cc9426aa29f97c5756bff0 Mon Sep 17 00:00:00 2001 From: Adyanth Hosavalike Date: Fri, 18 Oct 2024 23:26:57 +0530 Subject: [PATCH 2/2] Fix display only once --- .github/workflows/test.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index ac6e2e8..5b3324c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -11,7 +11,7 @@ permissions: # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - build: + test: runs-on: ubuntu-latest strategy: matrix: @@ -24,7 +24,7 @@ jobs: python-version: ${{ matrix.python-version }} cache: 'pip' - name: Display Python version - run: python -c "import sys; print(sys.version)" + run: echo ${{ matrix.python-version }} && python -c "import sys; print(sys.version)" - name: Install dependencies run: | python -m pip install --upgrade pip @@ -33,6 +33,7 @@ jobs: run: python -m pytest --junitxml=pytest.xml --cov=main --cov-report=xml:coverage.xml | tee pytest-coverage.txt - name: Pytest coverage comment uses: MishaKav/pytest-coverage-comment@main + if: ${{ matrix.python-version }} == "3.13" with: pytest-coverage-path: ./pytest-coverage.txt pytest-xml-coverage-path: ./coverage.xml