-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (73 loc) · 2.73 KB
/
tests.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
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
90
91
92
name: Tests (Code Quality & E2E Cypress)
on:
pull_request:
branches:
- release
jobs:
check-code-quality:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Initial setup
uses: ./.github/actions/initial-setup
- name: Check code quality
run: bash tools/check-code-quality.sh
run-e2e-tests:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping --silent"
--health-interval=10s
--health-timeout=5s
--health-retries=3
strategy:
matrix:
# names of the test folders: /tests/cypress/e2e/*
cypress-target: [ branding-plugins-1, branding-plugins-2, form-plugins, others, security-plugins, wordpress ]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Clear Cypress cache to avoid session-related issues
run: rm -rf ~/.cache/Cypress
shell: bash
- name: Initial setup
uses: ./.github/actions/initial-setup
- name: Install e2e packages
uses: ./.github/actions/tests/install-e2e-packages
- name: Setup e2e packages
uses: ./.github/actions/tests/setup-e2e-packages
- name: Clone private repository
uses: ./.github/actions/tests/clone-private-repository
with:
private_folder: ${{ github.workspace }}/private-data
private_repo: prosopo/procaptcha-wordpress-plugin-private
private_key: ${{ secrets.PRIVATE_KEY_FOR_PRIVATE_REPO }}
- name: Install WordPress with plugins
uses: ./.github/actions/tests/install-wordpress-with-plugins
with:
paid_plugins_dir: ${{ github.workspace }}/private-data/data-for-tests/paid-plugins
- name: Import database
run: mysql -h 127.0.0.1 -u root -pwordpress wordpress < ${{ github.workspace }}/private-data/data-for-tests/db.sql
shell: bash
- name: Prepare E2E workflow
uses: ./.github/actions/tests/prepare-e2e-workflow
- name: Run Cypress tests
run: bash ${{ github.workspace }}/tools/run-tests.sh ${{ matrix.cypress-target }}
- name: Upload Cypress screenshots and WP debug log
if: always()
uses: actions/upload-artifact@v4
with:
name: screenshots-and-wp-debug-log-for-${{ matrix.cypress-target }}
path: |
${{ github.workspace }}/tests/cypress/screenshots
${{ github.workspace }}/tests/cypress/logs
/var/www/procaptcha/wp-content/debug.log
if-no-files-found: ignore