From b1ffbc1de8f05819d37062700440e3c8a16baf55 Mon Sep 17 00:00:00 2001 From: amasson Date: Mon, 3 Nov 2025 22:01:31 +0000 Subject: [PATCH] Update .gitea/workflows/publish-pytest-result --- .gitea/workflows/publish-pytest-result | 53 +++++++++++++++----------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/.gitea/workflows/publish-pytest-result b/.gitea/workflows/publish-pytest-result index bc6a216..ac37b5e 100644 --- a/.gitea/workflows/publish-pytest-result +++ b/.gitea/workflows/publish-pytest-result @@ -1,34 +1,43 @@ -name: Run UI Tests and Publish HTML Report - +name: Python Version Check on: push: branches: - main + - master pull_request: + workflow_dispatch: # Allows manual triggering jobs: - ui-test: - runs-on: [docker] - + print-python-version: + runs-on: docker container: image: python:3.11-slim - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Install dependencies + - name: Print Python Version + run: python --version + + - name: Install pytest and pytest-html + run: pip install pytest pytest-html + + - name: Create a dummy test file run: | - apt-get update && apt-get install -y chromium-driver firefox-esr - pip install --no-cache-dir selenium pytest pytest-html - - - name: Run pytest (generate HTML report) - run: | - mkdir -p reports - pytest tests/ --html=reports/report.html --self-contained-html - - - name: Upload HTML Report - uses: actions/upload-artifact@v3 + mkdir -p tests + cat > tests/test_example.py << 'EOF' + def test_addition(): + assert 1 + 1 == 2 + + def test_subtraction(): + assert 5 - 3 == 2 + + def test_multiplication(): + assert 3 * 4 == 12 + EOF + + - name: Run pytest with HTML report + run: pytest tests/ --html=test-report.html --self-contained-html + + - name: Upload test report as artifact + uses: actions/upload-artifact@v4 with: - name: pytest-report - path: reports/report.html \ No newline at end of file + name: pytest-html-report + path: test-report.html