diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..10f6971 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,18 @@ +name: CI + +on: + push: + pull_request: + workflow_dispatch: + # Every Monday at 12:10pm UTC + schedule: + - cron: '10 12 * * 1' + +jobs: + ci: + name: CI + # Only run cron on the silverstripe account + if: (github.event_name == 'schedule' && startsWith(github.repository, 'silverstripe/')) || (github.event_name != 'schedule') + uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1 + with: + composer_require_extra: cwp/starter-theme:^2 diff --git a/.github/workflows/keepalive.yml b/.github/workflows/keepalive.yml new file mode 100644 index 0000000..ebf9716 --- /dev/null +++ b/.github/workflows/keepalive.yml @@ -0,0 +1,17 @@ +name: Keepalive + +on: + workflow_dispatch: + # The 4th of every month at 10:50am UTC + schedule: + - cron: '50 10 4 * *' + +jobs: + keepalive: + name: Keepalive + # Only run cron on the silverstripe account + if: (github.event_name == 'schedule' && startsWith(github.repository, 'silverstripe/')) || (github.event_name != 'schedule') + runs-on: ubuntu-latest + steps: + - name: Keepalive + uses: silverstripe/gha-keepalive@v1 diff --git a/README.md b/README.md index 59d97d4..b35240b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # CWP features modules -[![Build Status](https://api.travis-ci.com/silverstripe/cwp.svg?branch=2)](https://travis-ci.com/silverstripe/cwp) +[![CI](https://github.com/silverstripe/cwp/actions/workflows/ci.yml/badge.svg)](https://github.com/silverstripe/cwp/actions/workflows/ci.yml) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/silverstripe/cwp/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/silverstripe/cwp/?branch=master) [![codecov](https://codecov.io/gh/silverstripe/cwp/branch/master/graph/badge.svg)](https://codecov.io/gh/silverstripe/cwp) [![SilverStripe supported module](https://img.shields.io/badge/silverstripe-supported-0071C4.svg)](https://www.silverstripe.org/software/addons/silverstripe-commercially-supported-module-list/) diff --git a/composer.json b/composer.json index a77f2eb..f8bcc80 100644 --- a/composer.json +++ b/composer.json @@ -19,6 +19,9 @@ "phpunit/phpunit": "^9.5", "squizlabs/php_codesniffer": "^3" }, + "conflict": { + "silverstripe/auditor": "<2.4.0" + }, "suggest": { "silverstripe/crontask": "Allows CWP cleanup tasks to be scheduled" }, diff --git a/tests/PageTypes/DatedUpdateHolderControllerTest.php b/tests/PageTypes/DatedUpdateHolderControllerTest.php index 2df16af..7ee9f31 100644 --- a/tests/PageTypes/DatedUpdateHolderControllerTest.php +++ b/tests/PageTypes/DatedUpdateHolderControllerTest.php @@ -7,6 +7,7 @@ use SilverStripe\Dev\FunctionalTest; use SilverStripe\View\SSViewer; use SilverStripe\ORM\DB; +use SilverStripe\ORM\Connect\DatabaseException; class DatedUpdateHolderControllerTest extends FunctionalTest { @@ -54,10 +55,16 @@ public function testInvalidDateFormat() if (!$this->isRunningMySQL()) { $this->markTestSkipped('Not running MySQL'); } - /** @var EventHolder $holder */ - $holder = $this->objFromFixture(EventHolder::class, 'EventHolder1'); - $result = $this->get($holder->Link() . '?from=christmas&to=2018-01-10'); - $this->assertStringContainsString(htmlentities('Dates must be in "y-MM-dd" format.'), $result->getBody()); + try { + /** @var EventHolder $holder */ + $holder = $this->objFromFixture(EventHolder::class, 'EventHolder1'); + $result = $this->get($holder->Link() . '?from=christmas&to=2018-01-10'); + // MySQL 5.7 + $this->assertStringContainsString(htmlentities('Dates must be in "y-MM-dd" format.'), $result->getBody()); + } catch (DatabaseException $e) { + // MySQL 8.0 + $this->assertStringContainsString($e->getMessage("Incorrect DATETIME value: 'christmas 00:00:00'")); + } } /**