Skip to content

Allure Report Generation #14

Allure Report Generation

Allure Report Generation #14

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
- name: Send Allure report to Slack # Step to send Allure report to Slack
if: always() # Execute even if previous steps fail
run: |
- name: Send Allure report to Slack # Step to send Allure report to Slack
if: always() # Execute even if previous steps fail
run: |
REPO_NAME=${GITHUB_REPOSITORY##*/} |
allure_report_link="https://${{ github.repository_owner }}.github.io/$REPO_NAME/${{ github.run_number }}/index.html"
curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"New Allure report generated! Check it out: ${allure_report_link}\"}" ${{ secrets.SLACK_WEBHOOK_URL }}