Update .gitea/workflows/publish-pytest-result
Some checks failed
Greet on Commit / greet (push) Has been cancelled
Some checks failed
Greet on Commit / greet (push) Has been cancelled
This commit is contained in:
@@ -1,34 +1,43 @@
|
|||||||
name: Run UI Tests and Publish HTML Report
|
name: Python Version Check
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
- master
|
||||||
pull_request:
|
pull_request:
|
||||||
|
workflow_dispatch: # Allows manual triggering
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ui-test:
|
print-python-version:
|
||||||
runs-on: [docker]
|
runs-on: docker
|
||||||
|
|
||||||
container:
|
container:
|
||||||
image: python:3.11-slim
|
image: python:3.11-slim
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Print Python Version
|
||||||
uses: actions/checkout@v3
|
run: python --version
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install pytest and pytest-html
|
||||||
|
run: pip install pytest pytest-html
|
||||||
|
|
||||||
|
- name: Create a dummy test file
|
||||||
run: |
|
run: |
|
||||||
apt-get update && apt-get install -y chromium-driver firefox-esr
|
mkdir -p tests
|
||||||
pip install --no-cache-dir selenium pytest pytest-html
|
cat > tests/test_example.py << 'EOF'
|
||||||
|
def test_addition():
|
||||||
|
assert 1 + 1 == 2
|
||||||
|
|
||||||
- name: Run pytest (generate HTML report)
|
def test_subtraction():
|
||||||
run: |
|
assert 5 - 3 == 2
|
||||||
mkdir -p reports
|
|
||||||
pytest tests/ --html=reports/report.html --self-contained-html
|
|
||||||
|
|
||||||
- name: Upload HTML Report
|
def test_multiplication():
|
||||||
uses: actions/upload-artifact@v3
|
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:
|
with:
|
||||||
name: pytest-report
|
name: pytest-html-report
|
||||||
path: reports/report.html
|
path: test-report.html
|
||||||
|
|||||||
Reference in New Issue
Block a user