forked from elementor/elementor
-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (148 loc) · 5.07 KB
/
pwwpnow.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: Playwright wp-now
on:
workflow_dispatch:
inputs:
core_branch:
description: 'Elementor Core Branch'
required: true
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
build-plugin:
name: Build plugin
runs-on: ubuntu-latest
# if: startsWith( github.repository, 'elementor/' )
outputs:
changelog_diff: ${{ steps.changelog_diff_files.outputs.diff }}
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Check if this is only a changelog PR
id: changelog_diff_files
uses: technote-space/get-diff-action@v6
with:
# PATTERNS are:
# Everything: **/*
# Everything in directories starting with a period: .*/**/*
# Not readme.txt: !readme.txt
# Not changelog.txt: !changelog.txt
PATTERNS: |
**/*
.*/**/*
!readme.txt
!changelog.txt
- name: Install Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Restore NPM Cache
uses: actions/cache/restore@v3
with:
path: ~/.npm
key: npm-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
# if: github.event.pull_request.title == null || steps.changelog_diff_files.outputs.diff
run: npm i
- name: Build
# if: github.event.pull_request.title == null || steps.changelog_diff_files.outputs.diff
run: npx grunt build
- name: Cache node modules
# if: github.event.pull_request.title == null || steps.changelog_diff_files.outputs.diff
uses: actions/cache/save@v3
with:
path: ~/.npm
key: npm-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: Save build to cache
# if: github.event.pull_request.title == null || steps.changelog_diff_files.outputs.diff
uses: actions/cache/save@v3
with:
path: ./build/*
key: playwright-build-${{ github.sha }}
Playwright:
name: Playwright test - ${{ matrix.testSuite }} on PHP 8.0
runs-on: ubuntu-latest
needs: [build-plugin]
# if: ${{ github.event.pull_request.title == null || needs.build-plugin.outputs.changelog_diff }}
strategy:
matrix:
testSuite: [
# 'ai',
# 'onBoarding',
'video',
# 'elements-regression',
# 'default',
# 'nested-tabs',
# 'reverse-columns',
# 'container',
# 'nested-accordion',
# 'styleguide_image_link',
# 'rating',
# 'pluginTester1_containers',
# 'pluginTester2_containers',
# 'pluginTester1_sections',
# 'pluginTester2_sections'
]
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Install Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Restore NPM from cache
uses: actions/cache/restore@v3
id: restore-npm
with:
path: ~/.npm
key: npm-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: Restore build from cache
uses: actions/cache/restore@v3
id: restore-build
with:
path: ./build/*
key: playwright-build-${{ github.sha }}
# - name: Install wp-cli
# run: |
# curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
# chmod +x wp-cli.phar
# sudo mv wp-cli.phar /usr/local/bin/wp
- name: Install dependencies
run: npm i
- name: Install WordPress environment
run: |
npx wp-now start --php=8.0 --port=8888 --blueprint=./blueprint.json &
# - name: WP Cli check
# run: |
# wp --info
# wp plugin list
# wp theme activate hello-elementor
- name: Run wp-now CLI commands
run: |
wp-now cli "wp elementor experiments activate e_optimized_css_loading"
- name: Install playwright/test
run: |
npm run test:setup:playwright
npx playwright install chromium
- name: Run Playwright tests
env:
TEST_SUITE: "@${{matrix.testSuite}}"
run: npm run test:playwright
- uses: actions/upload-artifact@v3
if: failure()
with:
name: playwright-test-results-${{ matrix.testSuite }}
path: test-results/
retention-days: 3
test-result:
needs: Playwright
if: ${{ always() }} # Will be run even if 'Playwright' matrix will be skipped
runs-on: ubuntu-22.04
name: Playwright - Test Results
steps:
- name: Test status
run: echo "Test status is - ${{ needs.Playwright.result }}"
- name: Check Playwright matrix status
if: ${{ needs.Playwright.result != 'success' && needs.Playwright.result != 'skipped' }}
run: exit 1