From 3d401619369536c8ad415311c9f79d128525fb51 Mon Sep 17 00:00:00 2001 From: Jacob Ransom Date: Tue, 25 Aug 2026 14:04:04 +1200 Subject: [PATCH] Add an optional mysql-timezone input for the database container Defaults to UTC, so existing callers are unaffected. A non-UTC value reproduces the condition where SQL reading dates out of Matomo's UTC-stored DATETIME columns returns a shifted result, which CI cannot currently reach. --- README.md | 7 +++++++ action.yml | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/README.md b/README.md index 3f78a0e..5e18496 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,13 @@ This action is able to run certain test suites for Matomo or any Matomo plugin. Defines which Mysql adapter Matomo should use to connect to the database. Can be set to `PDO_MYSQL` (default) or `MYSQLI`. + * **mysql-timezone** + + Timezone for the database container, e.g. `Pacific/Auckland`. Defaults to `UTC`, which is what CI has always run, so leaving it unset changes nothing. + + Matomo stores datetimes in `log_visit` and elsewhere in UTC, but SQL that reads a date back out of those columns can depend on the server's timezone. Because CI runs UTC, that class of bug passes here and only shows up for users whose database server is not on UTC. Setting a non-UTC value makes the server report that zone via `@@system_time_zone` while leaving `@@global.time_zone` at `SYSTEM`, which is how such a server is really configured. + + * **upload-artifacts** If set to true produced artifacts will be uploaded to https://build-artifacts.matomo.org diff --git a/action.yml b/action.yml index 2b2ade1..a42bdc6 100644 --- a/action.yml +++ b/action.yml @@ -70,6 +70,10 @@ inputs: description: "Mysql version to use for testing. Defaults to '5.7' for 'Mysql', and 'latest' for 'Mariadb' or 'Tidb'" required: false default: '' + mysql-timezone: + description: "Timezone for the database container, e.g. 'Pacific/Auckland'. Defaults to UTC, which is what CI has always run. A non-UTC value makes the server report that zone as SYSTEM, exercising code that reads dates out of the DATETIME columns Matomo stores in UTC." + required: false + default: 'UTC' matomo-test-branch: description: "Branch or tag name of Matomo to run plugin tests for. This can be either a specific name or maximum_supported_matomo or minimum_required_matomo." required: false @@ -115,6 +119,7 @@ runs: -p 3306:3306 \ -e MYSQL_ALLOW_EMPTY_PASSWORD=yes \ -e MYSQL_DATABASE=matomo_tests \ + -e TZ=${{ inputs.mysql-timezone || 'UTC' }} \ mirror.gcr.io/library/mysql:${{ inputs.mysql-version || '5.7' }} for i in $(seq 1 30); do @@ -142,6 +147,7 @@ runs: -p 3306:3306 \ -e MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 \ -e MARIADB_DATABASE=matomo_tests \ + -e TZ=${{ inputs.mysql-timezone || 'UTC' }} \ mirror.gcr.io/library/mariadb:${{ inputs.mysql-version || 'latest' }} for i in $(seq 1 30); do