Update .gitea/workflows/publish-pytest-result.yml
This commit is contained in:
39
.gitea/workflows/publish-pytest-result.yml
Normal file
39
.gitea/workflows/publish-pytest-result.yml
Normal file
@@ -0,0 +1,39 @@
|
||||
name: Pytest artifact publish
|
||||
|
||||
on:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
print-python-version:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: python:3.11-slim
|
||||
steps:
|
||||
- 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: |
|
||||
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-html-report
|
||||
path: test-report.html
|
||||
Reference in New Issue
Block a user