Skip to content

Commit 015383f

Browse files
authored
Merge pull request #6 from 10up/setup-initial-performance-action
Set up initial GitHub action for performance tests
2 parents 6036ee0 + 2bd139b commit 015383f

3 files changed

Lines changed: 86 additions & 0 deletions

File tree

‎.github/workflows/performance.yml‎

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Performance Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- trunk
7+
- 'feature/**'
8+
- '3.[7-9]'
9+
- '[4-9].[0-9]'
10+
tags:
11+
- '[0-9]+.[0-9]'
12+
- '[0-9]+.[0-9].[0-9]+'
13+
pull_request:
14+
branches:
15+
- trunk
16+
- 'feature/**'
17+
- '3.[7-9]'
18+
- '[4-9].[0-9]'
19+
20+
jobs:
21+
# Runs the performance test suite.
22+
#
23+
# Performs the following steps:
24+
# - Sets environment variables.
25+
# - Checks out the repository.
26+
# - Sets up Node.js.
27+
# - Installs npm dependencies.
28+
# - Logs Docker debug information (about the Docker installation within the runner).
29+
# - Builds WordPress to run from the `build` directory.
30+
# - Starts the WordPress Docker container.
31+
# - Logs the running Docker containers.
32+
# - Install WordPress within the Docker container.
33+
# - Run the Performance tests.
34+
# - Ensures version-controlled files are not modified or deleted.
35+
performance:
36+
runs-on: ubuntu-latest
37+
if: ${{ github.repository == '10up/wordpress-develop' || github.event_name == 'push' }}
38+
39+
steps:
40+
- name: Configure environment variables
41+
run: |
42+
echo "PHP_FPM_UID=$(id -u)" >> $GITHUB_ENV
43+
echo "PHP_FPM_GID=$(id -g)" >> $GITHUB_ENV
44+
45+
- name: Checkout repository
46+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
47+
48+
- name: Set up Node.js
49+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
50+
with:
51+
node-version-file: '.nvmrc'
52+
cache: npm
53+
54+
- name: Install npm dependencies
55+
run: npm ci
56+
57+
- name: Docker debug information
58+
run: |
59+
docker -v
60+
docker-compose -v
61+
62+
- name: Build WordPress
63+
run: npm run build
64+
65+
- name: Start Docker environment
66+
run: npm run env:start
67+
68+
- name: WordPress Docker container debug information
69+
run: |
70+
docker-compose run --rm mysql mysql --version
71+
docker-compose run --rm php php --version
72+
docker-compose run --rm php php -m
73+
docker-compose run --rm php php -i
74+
docker-compose run --rm php locale -a
75+
76+
- name: Install WordPress
77+
run: npm run env:install
78+
79+
- name: Run Performance tests
80+
run: npm run test:performance
81+
82+
- name: Ensure version-controlled files are not modified or deleted
83+
run: git diff --exit-code

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@
176176
"env:cli": "node ./tools/local-env/scripts/docker.js run cli",
177177
"env:logs": "node ./tools/local-env/scripts/docker.js logs",
178178
"env:pull": "node ./tools/local-env/scripts/docker.js pull",
179+
"test:performance": "node ./tests/performance/cli.js",
179180
"test:php": "node ./tools/local-env/scripts/docker.js run -T php composer update -W && node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit",
180181
"test:e2e": "node ./tests/e2e/run-tests.js",
181182
"test:visual": "node ./tests/visual-regression/run-tests.js",

‎tests/performance/cli.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
console.log( '\n💃 Performance Tests 🕺\n' ),
2+
console.log( '\nWelcome! This tool runs the performance tests.\n' );

0 commit comments

Comments
 (0)