Skip to content

use deterministic sort in plugins search page #2988

use deterministic sort in plugins search page

use deterministic sort in plugins search page #2988

Workflow file for this run

#
# GitHub action executed when a PR is opened, asked for a review
# For debugging purposes, also when the assignment is modified.
#
# For now, runs only the UI tests.
#
# This action requires a secret called ARTIFACTS_PASS which is the key to upload on build-artifacts.
# This value can be found in the development keepass database.
#
name: Matomo for WordPress Tests
on:
workflow_dispatch:
push:
schedule:
- cron: "0 0 * * 0"
permissions:
actions: read
checks: none
contents: read
deployments: none
issues: read
packages: none
pull-requests: read
repository-projects: none
security-events: none
statuses: none
id-token: write # for docker gha cache
concurrency:
group: php-${{ github.ref }}
cancel-in-progress: true
jobs:
# unit_tests:
# runs-on: 'ubuntu-latest'
# strategy:
# fail-fast: false
# matrix:
# wp-versions: [ 'latest' ]
# php-versions: [ '7.2', '8.1' ]
# multisite: [ "singlesite", "multisite" ]
# include:
# - wp-versions: '5.2'
# php-versions: '7.2'
# multisite: 'singlesite'
# - wp-versions: '5.2'
# php-versions: '7.2'
# multisite: 'multisite'
# permissions:
# contents: read # <--- allows to read repo
# steps:
# - name: Checkout project
# uses: actions/checkout@v3
# with:
# persist-credentials: true
# lfs: true
# submodules: true
# - run: git lfs pull
#
# - name: Setup PHP ${{ matrix.php-versions }}
# uses: shivammathur/setup-php@v2
# with:
# php-version: ${{ matrix.php-versions }}
# extensions: curl, dom, exif, fileinfo, hash, imagick, json, mbstring, mysqli, openssl, pcre, sodium, xml, zip
# ini-values: |
# post_max_size=8M,
# memory_limit=256M,
# max_execution_time=30,
# always_populate_raw_post_data=-1,
# error_reporting=E_ALL,
# log_errors=on,
# display_errors=on,
# allow_url_fopen=on,
# zend.exception_ignore_args=Off
# tools: composer:v2
# coverage: none
#
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
#
# - name: Check PHP Version
# run: php -v
#
# # note: we update the dependencies since they only exist for the unit tests, and we need to use different
# # versions of phpunit/etc. for different PHP versions
# - name: Update test dependencies
# shell: bash
# run: |
# if [[ "${{ matrix.wp-versions }}" = "5.2" ]]; then
# sed -i 's%"yoast/phpunit-polyfills": ".*"%"yoast/phpunit-polyfills": "^1.1"%g' composer.json
# sed -i 's%"phpunit/phpunit": ".*"%"phpunit/phpunit": "^7"%g' composer.json
#
# NEW_COMPOSER_JSON=$( cat composer.json | jq '.config += { "audit": { "ignore": { "PKSA-z3gr-8qht-p93v": "Only used in CI tests." } } }' )
# echo "$NEW_COMPOSER_JSON" > composer.json
#
# cat composer.json
# fi
#
# composer update --with-all-dependencies
#
# - name: Install dependencies
# shell: bash
# run: composer install
#
# # TODO: redundancy w/ e2e_tests, could be moved to a script
# # docker-compose up
# # TODO: i can't seem to get docker layer caching to work.
# - run: docker buildx build --build-arg PHP_VERSION=${{ matrix.php-versions }} --build-context project="${{ github.workspace }}/scripts" --file=scripts/Dockerfile.local scripts
# env:
# PHP_VERSION: ${{ matrix.php-versions }}
# WOOCOMMERCE: 0
# WORDPRESS_FOLDER: test
# RESET_DATABASE: 1
# WORDPRESS_VERSION: ${{ matrix.wp-versions }}
# - run: |
# cat > .env <<EOF
# PHP_VERSION=$PHP_VERSION
# WOOCOMMERCE=1
# WORDPRESS_FOLDER=test
# RESET_DATABASE=1
# WORDPRESS_VERSION=$WORDPRESS_VERSION
# UID=$UID
# WP_DEBUG=true
# EOF
# env:
# PHP_VERSION: ${{ matrix.php-versions }}
# WORDPRESS_VERSION: ${{ matrix.wp-versions }}
# - run: chmod -R 777 . # required to build the release
# - run: sudo chown -R $UID:1000 . # required for wordpress' filesystem direct implementation
# - run: docker compose --env-file .env.default --env-file .env up -d wordpress
# - run: |
# # wait for docker-compose launch to finish
# elapsed=0
# until [ -e ./docker/wordpress/test/setup_finished ] || (( elapsed++ >= 420 )); do
# sleep 1
# done
#
# if [ ! -e ./docker/wordpress/test/setup_finished ]; then
# echo "did not setup local environment in time"
# exit 1
# fi
# [ -e /tmp/file.txt ] && echo File exists || echo Timeout
# - run: npm run compose logs wordpress --no-color # for debugging failures to start
# if: always()
# - run: cat ./docker/wordpress/test/wp-content/debug.log || echo "debug.log file does not exist"
# if: always()
#
# - name: Run unit tests
# shell: bash
# run: |
# if [[ "${{ matrix.multisite }}" == "singlesite" ]]; then
# echo "Running in single site context"
# else
# echo "Running in multisite context"
#
# cat >> .env <<EOF
# WP_MULTISITE=1
# EOF
# fi
#
# npm run phpunit
e2e_tests:
runs-on: 'ubuntu-latest'
strategy:
fail-fast: false
matrix:
wp-versions: [ 'latest' ]
php-versions: [ '7.2', '8.1' ]
include:
- wp-versions: 'trunk'
php-versions: '7.4'
- wp-versions: 'trunk'
php-versions: '8.1'
permissions:
contents: read # <--- allows to read repo
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
lfs: true
submodules: true
- run: git lfs pull
# setup xvfb
- run: sudo apt-get update && sudo apt-get install -y xvfb x11-xserver-utils xauth
# setup firefox
- uses: browser-actions/setup-firefox@v1
- run: firefox --version
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# setup node
- uses: actions/setup-node@v3
with:
node-version: 20
cache: npm
cache-dependency-path: '**/package-lock.json'
- run: npm install
# disable deprecation notices in e2e tests. we can't control much of the code being
# tested (ie, WordPress, other WordPress plugins), and it's very easy for one of them
# to trigger a deprecation notice
- name: Disable deprecation notices
shell: bash
run: |
mkdir docker
echo '[PHP]' > docker/php-custom.ini
echo 'error_reporting = E_ALL & ~E_DEPRECATED & ~E_NOTICE' >> docker/php-custom.ini
echo 'upload_max_filesize = 128M' >> docker/php-custom.ini
echo 'memory_limit = 2G' >> docker/php-custom.ini
echo 'max_execution_time = 600' >> docker/php-custom.ini
echo 'post_max_size = 128M' >> docker/php-custom.ini
# docker-compose up
- run: |
cat > .env <<EOF
PHP_VERSION=$PHP_VERSION
WOOCOMMERCE=1
WORDPRESS_FOLDER=test
WORDPRESS_VERSION=$WORDPRESS_VERSION
UID=$UID
WITHOUT_MARKETPLACE=1
WP_DEBUG=true
WP_DEBUG_LOG=true
WP_DEBUG_DISPLAY=false
MATOMO_MARKETPLACE_ZIP_URL="http://localhost/matomo-for-wordpress/marketplace/matomo-marketplace-for-wordpress.test.zip"
EOF
env:
PHP_VERSION: ${{ matrix.php-versions }}
WORDPRESS_VERSION: ${{ matrix.wp-versions }}
- run: docker buildx build --build-arg PHP_VERSION=${{ matrix.php-versions }} --build-context project="${{ github.workspace }}/scripts" --file=scripts/Dockerfile.local scripts
env:
PHP_VERSION: ${{ matrix.php-versions }}
WOOCOMMERCE: 1
WORDPRESS_FOLDER: test
RESET_DATABASE: 1
WORDPRESS_VERSION: ${{ matrix.wp-versions }}
- run: chmod -R 777 . # required to build the release
# run tests
- run: xvfb-run --auto-servernum npm run wdio
env:
PHP_VERSION: ${{ matrix.php-versions }}
WOOCOMMERCE: 1
WORDPRESS_FOLDER: test
WORDPRESS_VERSION: ${{ matrix.wp-versions }}
TEST_SHOP_LICENSE: ${{ secrets.TEST_SHOP_LICENSE }}
- name: Archive test artifacts (actual)
uses: actions/upload-artifact@v4
if: always()
with:
name: actual-screenshots-${{ matrix.php-versions }}-${{ matrix.wp-versions }}
path: tests/e2e/actual
- name: Archive test artifacts (diffs)
uses: actions/upload-artifact@v4
if: always()
with:
name: diff-screenshots-${{ matrix.php-versions }}-${{ matrix.wp-versions }}
path: tests/e2e/diff
# output docker-compose logs
- run: npm run compose logs wordpress --no-color
if: always()
- run: npm run compose stop
# output debug.concat.log (created in a hook in wdio.conf.ts)
- run: cat ./docker/wordpress/test/wp-content/debug.concat.log || cat ./docker/wordpress/test/wp-content/debug.log || echo "debug.concat.log file does not exist"
if: always()
- run: cat ./docker/wordpress/test-multi/wp-content/debug.concat.log || cat ./docker/wordpress/test-multi/wp-content/debug.log || echo "debug.concat.log file does not exist for test-multi"
if: always()
- run: cat .e2e-docker-out || echo ".e2e-docker-out file does not exist"
if: always()
checkstyle:
runs-on: 'ubuntu-latest'
steps:
- name: Checkout project
uses: actions/checkout@v3
with:
persist-credentials: true
path: wp-content/plugins/matomo
submodules: true
- name: Setup PHP for checkstyle
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
extensions: curl, dom, exif, fileinfo, hash, imagick, json, mbstring, mysqli, openssl, pcre, sodium, xml, zip
ini-values: |
post_max_size=8M,
memory_limit=256M,
max_execution_time=30,
always_populate_raw_post_data=-1,
error_reporting=E_ALL,
log_errors=on,
display_errors=on,
allow_url_fopen=on,
zend.exception_ignore_args=Off
tools: composer:v2
coverage: none
- name: Check PHP Version
run: php -v
- name: Install dependencies
shell: bash
run: |
cd ${{ github.workspace }}/wp-content/plugins/matomo && composer update --with-all-dependencies
cd ${{ github.workspace }}/wp-content/plugins/matomo && composer install
- name: Run checkstyle
shell: bash
run: cd ${{ github.workspace }}/wp-content/plugins/matomo && ./vendor/bin/phpcs