Skip to content

Commit

Permalink
GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
ericsalesdeandrade committed Jun 12, 2024
1 parent 8193a35 commit 3958ee4
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 15 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/generate_allure_report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Run Python tests and generate Allure report

on:
push:
branches:
- gh-pages # Adjust this as necessary for your project

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12' # Ensure this matches the Python version you're using in your project

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Configure Poetry
run: |
poetry config virtualenvs.create false
- name: Install dependencies with Poetry
run: |
poetry install
- name: Run tests and generate Allure results
run: |
poetry run pytest --alluredir=allure-results
- name: Checkout gh-pages for Allure report history
uses: actions/checkout@v3
if: always()
continue-on-error: true
with:
ref: gh-pages
path: gh-pages

- name: Generate Allure report
uses: simple-elf/[email protected]
if: always()
with:
allure_results: allure-results
allure_history: gh-pages/allure-history
gh_pages: true

- name: Publish Allure report on GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: always()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: gh-pages
17 changes: 2 additions & 15 deletions tests/test_text_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def test_capitalize_text(text, expected):
assert capitalize_text(text) == expected


def test_capitalize_text_with_fixture(example_word):
assert capitalize_text(example_word) == "Hello"
def test_capitalize_text_with_fixture(word_fixture):
assert capitalize_text(word_fixture) == "Hello"


def test_attach_screenshot():
Expand All @@ -69,16 +69,3 @@ def test_attach_screenshot():
name="Home Page Screenshot",
attachment_type=allure.attachment_type.PNG,
)


def test_example_failure():
assert 1 == 2


def test_complex_operation_steps():
with allure.step("Step 1: Count Words"):
assert count_words("hello world") == 2
with allure.step("Step 2: Reverse String"):
assert reverse_string("hello") == "olleh"
with allure.step("Step 3: Check Palindrome"):
assert is_palindrome("civic") is True

0 comments on commit 3958ee4

Please sign in to comment.