php 7.2 debugging #195
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
# | |
# 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: [push] | |
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 | |
env: | |
MYSQL_DOCKER_IMG: 'bitnami/mariadb:latest' | |
DB_NAME: 'wp_matomo_tests' | |
PHP_VERSION: '8.0' | |
jobs: | |
unit_tests: | |
runs-on: 'ubuntu-20.04' | |
strategy: | |
fail-fast: false | |
matrix: | |
wp-versions: [ 'latest' ] | |
php-versions: [ '7.2', '7.3', '7.4', '8.0' ] | |
include: | |
- wp-versions: '5.2' | |
php-versions: '7.2' | |
permissions: | |
contents: read # <--- allows to read repo | |
steps: | |
- name: Checkout plugin project | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: true | |
path: wp-content/plugins/matomo | |
- name: Shutdown Ubuntu MySQL | |
run: sudo service mysql stop # Shutdown the Default MySQL, "sudo" is necessary, please not remove it | |
- name: Start MariaDB service | |
shell: bash | |
run: | | |
docker run -d --name mariadb --tmpfs /var/lib/mariadb:rw --tmpfs /bitnami/mariadb/data:rw -v /bitnami/mariadb -p 3306:3306 -e ALLOW_EMPTY_PASSWORD=yes ${{ env.MYSQL_DOCKER_IMG }} > /dev/null | |
sleep 10 | |
mysql -h127.0.0.1 -uroot -e "CREATE DATABASE ${{ env.DB_NAME }}"; | |
- 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: Check PHP Version | |
run: php -v | |
- name: Install dependencies | |
shell: bash | |
run: cd ${{ github.workspace }}/wp-content/plugins/matomo && composer install | |
- name: Install test environment | |
shell: bash | |
run: cd ${{ github.workspace }}/wp-content/plugins/matomo && ./bin/install-wp-tests.sh ${{ env.DB_NAME }} root '' 127.0.0.1 ${{ matrix.wp-versions }} true | |
- name: Run unit tests in non multisite context | |
shell: bash | |
run: cd ${{ github.workspace }}/wp-content/plugins/matomo && ./vendor/bin/phpunit | |
- name: Run unit tests in multisite context | |
shell: bash | |
run: cd ${{ github.workspace }}/wp-content/plugins/matomo && WP_MULTISITE=1 ./vendor/bin/phpunit | |
e2e_tests: | |
runs-on: 'ubuntu-22.04' | |
strategy: | |
fail-fast: false | |
matrix: | |
wp-versions: [ 'latest', 'trunk' ] | |
php-versions: [ '7.2', '8.1' ] | |
permissions: | |
contents: read # <--- allows to read repo | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
lfs: true | |
persist-credentials: false | |
# 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 | |
# setup node | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: npm | |
cache-dependency-path: '**/package-lock.json' | |
- run: npm install | |
# docker-compose up | |
- run: ls ${{ github.workspace }}/scripts | |
- run: pwd | |
- run: | | |
export ACTIONS_CACHE_URL=$(echo "$ACTIONS_ID_TOKEN_REQUEST_URL" | grep -Po 'https://[^/]+/[^/]+/' | sed 's/pipelines/artifactcache/') | |
export ACTIONS_RUNTIME_TOKEN=$ACTIONS_ID_TOKEN_REQUEST_TOKEN | |
docker buildx build --cache-to type=gha --cache-from type=gha --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: docker-compose up wordpress | |
env: | |
PHP_VERSION: ${{ matrix.php-versions }} | |
WOOCOMMERCE: 1 | |
WORDPRESS_FOLDER: test | |
RESET_DATABASE: 1 | |
WORDPRESS_VERSION: ${{ matrix.wp-versions }} | |
- run: sleep 60 # wait for docker-compose launch to finish | |
# run tests | |
- run: xvfb-run --auto-servernum npm run wdio | |
env: | |
PHP_VERSION: ${{ matrix.php-versions }} | |
WOOCOMMERCE: 1 | |
WORDPRESS_FOLDER: test | |
RESET_DATABASE: 1 | |
WORDPRESS_VERSION: ${{ matrix.wp-versions }} | |
# output docker-compose logs | |
- run: docker-compose logs --no-color | |
- run: docker-compose stop | |
checkstyle: | |
runs-on: 'ubuntu-20.04' | |
steps: | |
- name: Checkout plugin project | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: true | |
path: wp-content/plugins/matomo | |
- name: Setup PHP for checkstyle | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ env.PHP_VERSION }} | |
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 install | |
- name: Run checkstyle | |
shell: bash | |
run: cd ${{ github.workspace }}/wp-content/plugins/matomo && ./vendor/bin/phpcs |