Skip to content

Commit 8582e56

Browse files
authored
Update documentation (#76)
1 parent 6c5424a commit 8582e56

2 files changed

Lines changed: 156 additions & 42 deletions

File tree

README.md

Lines changed: 152 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,64 +10,178 @@ It collects data from the `Server-Timing` header and runs Lighthouse on a given
1010

1111
## Usage
1212

13-
### Basic Example
14-
15-
Add a workflow (`.github/workflows/build-test.yml`):
13+
See [action.yml](action.yml)
1614

15+
<!-- start usage -->
1716
```yaml
18-
name: 'build-test'
19-
on: # rebuild any PRs and main branch changes
20-
pull_request:
21-
push:
22-
branches:
23-
- main
24-
- 'releases/*'
17+
- uses: swissspidy/wp-performance-action@main
18+
with:
19+
# Personal access token (PAT) used to comment on pull requests.
20+
#
21+
# [Learn more about creating and using encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets)
22+
#
23+
# Default: ${{ github.token }}
24+
github-token: ''
25+
26+
# Whether to log additional debugging information
27+
#
28+
# Default: ${{ runner.debug == '1' }}
29+
debug: ''
30+
31+
# List of URLs on the WordPress site to test.
32+
# Each URL should be separated with new lines.
33+
#
34+
# Default: ''
35+
urls: ''
36+
37+
# List of plugins to install.
38+
# Each plugin should be separated with new lines.
39+
# Supports paths to local directories or ZIP URLs.
40+
# Performance Lab (performance-lab) is always installed.
41+
#
42+
# Default: ''
43+
plugins: ''
44+
45+
# List of themes to install.
46+
# Each theme should be separated with new lines.
47+
# Supports paths to local directories or ZIP URLs.
48+
# Twenty Twenty-One (twentytwentyone) and Twenty Twenty-Three (twentytwentythree)
49+
# are always installed.
50+
#
51+
# Default: ''
52+
themes: ''
53+
54+
# Theme to activate on the site.
55+
# Theme needs to be already installed.
56+
#
57+
# Default: 'twentytwentyone'
58+
active-theme: ''
59+
60+
# WordPress version to use.
61+
# Supports aliases such as latest, nightly, or trunk.
62+
# Also supports ZIP URLs or a Git reference from https://github.com/WordPress/wordpress
63+
# to install a specific version.
64+
#
65+
# Default: 'latest'
66+
wp-version: ''
67+
68+
# PHP version to use.
69+
# Defaults to whatever version is the default
70+
# in the Docker-maintained WordPress image
71+
# (currently 8.0 as of November 2023)
72+
#
73+
# Default: 'auto'
74+
php-version: ''
75+
76+
# Number of times the tests should be repeated.
77+
#
78+
# Default: 2
79+
repetitions: ''
80+
81+
# Number of iterations (loops) within a single run.
82+
#
83+
# Default: 20
84+
iterations: ''
85+
86+
# Shard to use if running tests in parallel.
87+
# Valid values are 1/2, 1/4, etc.
88+
#
89+
# Default: ''
90+
shard: ''
91+
92+
93+
# Action to perform, can be either "test" or "merge".
94+
# Merging is needed when running tests in parallel
95+
# in a test matrix, where you later need to merge
96+
# the results from the individual jobs together.
97+
#
98+
# Default: 'test'
99+
action: ''
100+
101+
# Path to a file with previous performance results for comparison.
102+
# Useful when running tests for a pull request and
103+
# the target branch, so that the performance impact can be measured.
104+
#
105+
# Default: ''
106+
previous-results: ''
25107

26-
jobs:
27-
test:
28-
runs-on: ubuntu-latest
29-
steps:
30-
- name: Checkout
31-
uses: actions/checkout@v3
108+
```
109+
<!-- end usage -->
32110

33-
- name: Set up Node
34-
uses: actions/setup-node@v3.7.0
35-
with:
36-
node-version-file: '.nvmrc'
111+
### Basic
37112

38-
- name: Install dependencies
39-
run: npm ci
113+
Add a workflow (`.github/workflows/build-test.yml`):
40114

41-
# Here's where you would install dependencies, run your custom build process, etc.
115+
```yaml
116+
steps:
117+
- name: Checkout
118+
uses: actions/checkout@v3
119+
120+
- name: Run performance tests
121+
uses: swissspidy/wp-performance-action@main
122+
with:
123+
plugins: |
124+
./my-awesome-plugin
125+
urls: |
126+
/
127+
/sample-page/
128+
```
42129
43-
- name: Run performance tests
44-
uses: swissspidy/wp-performance-action@main
45-
with:
46-
plugins: |
47-
./my-awesome-plugin
48-
urls: |
49-
/
50-
/sample-page/
130+
### Advanced
131+
132+
```yaml
133+
steps:
134+
- name: Checkout
135+
uses: actions/checkout@v3
136+
137+
- name: Run performance tests
138+
uses: swissspidy/wp-performance-action@main
139+
with:
140+
urls: |
141+
/
142+
/sample-page/
143+
plugins: |
144+
./my-awesome-plugin
145+
https://downloads.wordpress.org/plugin/performant-translations.zip
146+
https://downloads.wordpress.org/plugin/wordpress-seo.zip
147+
iterations: 5
148+
repetitions: 1
51149
```
52150
53-
### Advanced Example
151+
### Running tests in parallel (sharding)
54152
55153
```yaml
56154
jobs:
57-
test:
155+
matrix:
156+
timeout-minutes: 60
58157
runs-on: ubuntu-latest
158+
strategy:
159+
fail-fast: false
160+
matrix:
161+
shard: [1/4, 2/4, 3/4, 4/4]
59162
steps:
163+
- uses: actions/checkout@v4
60164

61165
- name: Run performance tests
62-
uses: ./
166+
uses: swissspidy/wp-performance-action@main
167+
id: run-tests
63168
with:
64169
urls: |
65170
/
66171
/sample-page/
67172
plugins: |
68173
./my-awesome-plugin
69-
https://downloads.wordpress.org/plugin/performant-translations.zip
70-
https://downloads.wordpress.org/plugin/wordpress-seo.zip
71-
iterations: 5
72-
repetitions: 1
174+
shard: ${{ matrix.shard }}
175+
176+
merge-reports:
177+
if: always()
178+
needs: [matrix]
179+
runs-on: ubuntu-latest
180+
steps:
181+
- uses: actions/checkout@v4
182+
183+
- name: Merge performance test results
184+
uses: swissspidy/wp-performance-action@main
185+
with:
186+
action: 'merge'
73187
```

action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@ branding:
66
icon: 'trending-up'
77
inputs:
88
github-token:
9-
description: 'The GitHub token used to create PR comments'
9+
description: 'The GitHub token used to create PR comments.'
1010
required: false
1111
default: ${{ github.token }}
1212
debug:
13-
description: 'Whether to log additional debugging information'
13+
description: 'Whether to log additional debugging information.'
1414
default: ${{ runner.debug == '1' }}
1515
urls:
1616
required: true
1717
description: 'URLs to test, separated by newline.'
1818
default: ''
1919
plugins:
2020
required: false
21-
description: 'Plugin(s) to install, separated by newline. Supports directory paths and ZIP URLs'
21+
description: 'List of plugins to install, separated by newline. Supports directory paths and ZIP URLs.'
2222
default: ''
2323
themes:
2424
required: false
25-
description: 'Theme(s) to install, separated by newline. Supports directory paths and ZIP URLs'
25+
description: 'List of themes to install, separated by newline. Supports directory paths and ZIP URLs.'
2626
default: ''
2727
active-theme:
2828
required: false

0 commit comments

Comments
 (0)