Allure Report Generation #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Allure Report Generation | |
on: | |
workflow_dispatch: # Trigger the workflow manually | |
inputs: | |
tags: # Input parameter for test scenario tags | |
description: "Test scenario tags" | |
required: true | |
default: "smoke" | |
jobs: | |
generate-allure-report: | |
runs-on: ubuntu-20.04 # Set the operating system for the job | |
defaults: | |
run: | |
shell: bash # Set the shell for the job | |
working-directory: ./tests # Set the working directory for the job | |
steps: | |
- name: Checkout repo # Step to check out the repository | |
uses: actions/checkout@v3 | |
- name: Install Python 3 # Step to install Python 3 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 # Set the Python version to install | |
- name: Install dependencies # Step to install project dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Prepare Allure history # Step to prepare Allure history directory | |
run: | | |
cd .. | |
mkdir -p ${{ vars.ALLURE_RESULTS_PATH }} | |
- name: Run tests with pytest # Step to run tests using pytest | |
run: | | |
python -m pytest -v --gherkin-terminal-reporter -s --tags="${{ github.event.inputs.tags }}" --color=yes --alluredir=../${{ vars.ALLURE_RESULTS_PATH }} | |
- name: Get Allure history # Step to retrieve Allure history | |
uses: actions/checkout@v3 | |
if: always() # Execute even if previous steps fail | |
continue-on-error: true # Continue execution even if the step fails | |
with: | |
ref: gh-pages # Specify the branch to retrieve Allure history from | |
path: gh-pages # Set the destination path for Allure history | |
- name: Allure report action # Step to generate Allure report | |
uses: simple-elf/allure-report-action@master | |
if: always() # Execute even if previous steps fail | |
with: | |
allure_results: ${{ vars.ALLURE_RESULTS_PATH }} # Specify the directory containing Allure results | |
allure_history: allure-history # Specify the directory to store Allure history | |
keep_reports: 5 # Specify the number of previous reports to keep | |
- name: Deploy Allure report to GitHub Pages # Step to deploy Allure report to GitHub Pages | |
if: always() # Execute even if previous steps fail | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} # Provide the GitHub token for authentication | |
publish_branch: gh-pages # Specify the branch to publish the report to | |
publish_dir: allure-history # Specify the directory containing the report |