-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (69 loc) · 2.48 KB
/
github_actions_tests.yml
File metadata and controls
89 lines (69 loc) · 2.48 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Run Tests
on:
workflow_dispatch: # 👈 enables manual trigger
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
env:
BASE_URL_FE: https://ultimateqa.com/complicated-page # <-- Set your actual BASE_URL here
BASE_URL_API: https://jsonplaceholder.typicode.com
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '22'
- name: Install Allure Commandline
run: npm install -g allure-commandline --save-dev
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
- name: Install all Playwright Browsers
run: |
source .venv/bin/activate
python -m playwright install --with-deps
- name: Create .env file from workflow
run: |
echo "BASE_URL_FE=${BASE_URL_FE}" > .env
echo "BASE_URL_API=${BASE_URL_API}" > .env
- name: Download previous Allure history
run: |
git config --global user.email "github-actions@users.noreply.github.com"
git config --global user.name "GitHub Actions"
git clone --depth=1 --branch gh_pages https://github.com/${{ github.repository }} gh-pages || echo "No previous gh-pages"
mkdir -p allure-results/history
cp -r gh-pages/history allure-results/ || echo "No history to copy"
- name: Run tests(UI & API) with Pytest
run: |
source .venv/bin/activate
pytest Ultimateqa/ui_tests api_tests -n auto --alluredir=allure-results
- name: Generate Allure Report
if: always()
run: |
npx allure generate allure-results --clean -o allure-report
sed -i "s|<base href=\"/\">|<base href=\"/${GITHUB_REPOSITORY#*/}/\">|" allure-report/index.html
- name: Deploy Allure Report to GitHub Pages
if: always()
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GH_PAGES_ALLURE }}
publish_branch: gh_pages
publish_dir: ./allure-report
- name: Output report link
if: always()
run: |
echo "### ✅ [View Allure Report](https://amielnoy.github.io/forcePointPlaywrightPythonTest)" >> $GITHUB_STEP_SUMMARY