Playwright_Pytest_BDD_Demo/.github/workflows/python-playwright-pytest-bd...

83 lines
3.0 KiB
YAML

# This is a basic workflow to help you get started with Actions
name: playwright pytest bdd demo CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "master" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '0 0,4,12 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
test:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
allow-prereleases: true
cache: 'pipenv'
- name: Install pipenv
run: pip install pipenv
- name: Install dependencies
run: |
pipenv install wheel
pipenv install
- name: Ensure browsers are installed
run: pipenv run python -m playwright install
- name: Prepare Allure history # Step to prepare Allure history directory
run: |
cd ..
mkdir -p ${{ vars.ALLURE_RESULTS_PATH }}
- name: Run test cases
run: pipenv run pytest -v --gherkin-terminal-reporter -s --color=yes --alluredir=../${{ vars.ALLURE_RESULTS_PATH }} -m smoke
- 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: Generate 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