-
Notifications
You must be signed in to change notification settings - Fork 5
63 lines (54 loc) · 2.12 KB
/
pytest-html-report.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# The name of the workflow as it will appear in the "Actions" tab of the GitHub repository
name: Run pytest and upload HTML report
# Specifies the trigger for this workflow
on:
# Allows you to run this workflow manually from the "Actions" tab of the GitHub repository
workflow_dispatch:
inputs:
tags:
description: Test scenario tags
required: true
default: smoke
# 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 "run_automated_tests"
run_automated_tests:
# Configures the job to run on the latest version of an Ubuntu Linux runner
runs-on: ubuntu-latest
# Set the default shell and working directory
defaults:
run:
shell: bash
working-directory: ./tests
# "steps" represent a sequence of tasks that will be executed as part of the job
steps:
# This action checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it
- name: Checkout repo
uses: actions/checkout@v3
# Set up GitHub Actions workflow with a specific version of Python
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
# Setup dependencies by running requirements.txt
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt --use-pep517
# GitHub Action to read .env file and add variables to GITHUB_ENV
- name: Load .env file
uses: xom9ikk/dotenv@v2
with:
path: ./tests/
# Execute tests
- name: Run pytest with HTML report
run: >
python3 -m pytest -v --gherkin-terminal-reporter --reruns 1 --reruns-delay 1
--tags="${{ github.event.inputs.tags }}" -s --color=yes --html=reports/test-report.html
continue-on-error: true
# Upload html report as artifact
- name: Upload HTML report
uses: actions/upload-artifact@v3
with:
name: test-report
path: tests/reports/test-report.html