Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .buildkite/commands/run-wp-env-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash -eu

echo "--- :rust: Installing Rust"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -v -y
source "$HOME/.cargo/env"

echo "--- :node: Installing Node.js"
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | PROFILE=/dev/null bash
export NVM_DIR="$HOME/.nvm"
# shellcheck source=/dev/null
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
nvm install --lts

echo "--- :docker: Starting wp-env (WordFence)"
make wp-env-wordfence-start

echo "--- 🧪 Running wp-env Tests"
cargo test -p wp_api_integration_tests --test test_login_wp_env --no-fail-fast -- --include-ignored

echo "--- :docker: Stopping wp-env"
make wp-env-wordfence-stop
5 changes: 5 additions & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,11 @@ steps:
WORDPRESS_VERSION: "{{matrix}}"
matrix: *wordpress_version_matrix

- label: ":wordpress: :rust: wp-env Tests"
command: ".buildkite/commands/run-wp-env-tests.sh"
agents:
queue: android

- label: ":wordpress: WordPress.com e2e Tests"
command: |
echo "--- :rust: Installing Rust"
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ dump.sql
# WP_COM Testing
wp_com_test_credentials.json

# wp-env
node_modules

# CI Cache
.cargo/*
/vendor
Expand Down
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,32 @@ stop-server:
@# Help: Stop the running server.
docker-compose down

npm-dependencies:
npm install

# wp-env helper: run a wp-env command in a specific environment directory.
# Usage: $(call wp-env-run,<env-name>,<wp-env-args>)
wp-env-run = cd wp-env/$(1) && npx wp-env $(2)

# wp-env port assignments (base: 4100, increment per environment)
wp-env-port-wordfence := 4100

.PHONY: wp-env-wordfence-start
wp-env-wordfence-start: npm-dependencies
@# Help: Start the WordFence wp-env test server.
$(call wp-env-run,wordfence,start)
bash scripts/wp-env-setup.sh wp-env/wordfence $(wp-env-port-wordfence)

.PHONY: wp-env-wordfence-stop
wp-env-wordfence-stop:
@# Help: Stop the WordFence wp-env test server.
$(call wp-env-run,wordfence,stop)

.PHONY: wp-env-wordfence-clean
wp-env-wordfence-clean:
@# Help: Destroy the WordFence wp-env test server and remove all data.
cd wp-env/wordfence && echo "y" | npx wp-env destroy

lint: lint-rust lint-swift
@# Help: Run the linter for all languages.

Expand Down
Loading