Misc updates #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unit Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
tests: | |
name: "WP: ${{ matrix.wp_version }} - PHP: ${{ matrix.php }} - (MU: ${{ matrix.multisite }})" | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false # do not fail fast, let all the failing tests fail. | |
matrix: | |
php: [8.3] | |
es_version: [7.17.5] | |
multisite: [0, 1] | |
wp_version: ["latest"] | |
env: | |
WP_CORE_DIR: /tmp/wordpress/ | |
WP_TESTS_DIR: /tmp/wordpress-tests-lib | |
WP_VERSION: ${{ matrix.wp_version }} | |
WP_MULTISITE: ${{ matrix.multisite }} | |
services: | |
mysql: | |
image: mysql:8.0 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- name: Cancel previous runs of this workflow (pull requests only) | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Configure sysctl limits | |
run: | | |
sudo swapoff -a | |
sudo sysctl -w vm.swappiness=1 | |
sudo sysctl -w fs.file-max=262144 | |
sudo sysctl -w vm.max_map_count=262144 | |
- name: Set up Elasticsearch | |
uses: elastic/elastic-github-actions/elasticsearch@master | |
with: | |
stack-version: ${{ matrix.es_version }} | |
security-enabled: false | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd | |
tools: composer:v2 | |
coverage: none | |
- name: Set up WordPress and Plugin(s) | |
run: | | |
bash <(curl -s "https://raw.githubusercontent.com/alleyinteractive/mantle-ci/HEAD/install-wp-tests.sh") wordpress_unit_tests root '' 127.0.0.1 ${{ matrix.wp_version }} false true | |
rm -rf "${WP_CORE_DIR}wp-content/plugins" | |
mkdir -p "${WP_CORE_DIR}wp-content/plugins/elasticsearch-buddypress" | |
rsync -a --exclude=.git . "${WP_CORE_DIR}wp-content/plugins/elasticsearch-buddypress" | |
cd ${WP_CORE_DIR}wp-content/plugins/elasticsearch-buddypress && composer install | |
- name: Run all tests | |
run: | | |
cd ${WP_CORE_DIR}wp-content/plugins/elasticsearch-buddypress | |
composer phpunit |