Skip to content

Commit

Permalink
Merge pull request #6 from chialab/2.x.x
Browse files Browse the repository at this point in the history
Migrate to 2.x.x
  • Loading branch information
edoardocavazza committed Jun 27, 2023
2 parents d1b1a67 + ebcf2c4 commit 90e0958
Show file tree
Hide file tree
Showing 29 changed files with 209 additions and 186 deletions.
36 changes: 15 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ on:
jobs:
cs:
name: 'Check coding style'
runs-on: 'ubuntu-20.04'
runs-on: 'ubuntu-22.04'

steps:
- name: 'Checkout current revision'
uses: 'actions/checkout@v2'
uses: 'actions/checkout@v3'

- name: 'Setup PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '7.4'
php-version: '8.1'
tools: 'composer'
extensions: 'mbstring, intl'
coverage: 'none'
Expand All @@ -32,7 +32,7 @@ jobs:
run: 'echo "::set-output name=path::$(composer global config cache-dir)"'

- name: 'Share Composer cache across runs'
uses: 'actions/cache@v2'
uses: 'actions/cache@v3'
with:
path: '${{ steps.cachedir.outputs.path }}'
key: "composer-${{ github.job }}-${{ hashFiles('**/composer.json') }}"
Expand All @@ -44,24 +44,21 @@ jobs:
run: 'composer install --prefer-dist --no-interaction'

- name: 'Run PHP CodeSniffer'
run: |
vendor/bin/phpcs -n -p --extensions=php \
--standard=vendor/cakephp/cakephp-codesniffer/CakePHP --ignore=/Migrations/,/Seeds/ \
./src ./tests
run: 'composer run-script cs-check -- -n'

stan:
name: 'Static code analyzer'
runs-on: 'ubuntu-20.04'
runs-on: 'ubuntu-22.04'
continue-on-error: true

steps:
- name: 'Checkout current revision'
uses: 'actions/checkout@v2'
uses: 'actions/checkout@v3'

- name: 'Setup PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '7.4'
php-version: '8.1'
tools: 'composer, phpstan'
extensions: 'mbstring, intl'
coverage: 'none'
Expand All @@ -71,7 +68,7 @@ jobs:
run: 'echo "::set-output name=path::$(composer global config cache-dir)"'

- name: 'Share Composer cache across runs'
uses: 'actions/cache@v2'
uses: 'actions/cache@v3'
with:
path: '${{ steps.cachedir.outputs.path }}'
key: "composer-${{ github.job }}-${{ hashFiles('**/composer.json') }}"
Expand All @@ -89,13 +86,13 @@ jobs:
unit:
name: 'Run unit tests'
if: "!contains(github.event.commits[0].message, '[skip ci]') && !contains(github.event.commits[0].message, '[ci skip]')"
runs-on: 'ubuntu-20.04'
runs-on: 'ubuntu-22.04'

strategy:
fail-fast: false
matrix:
php:
- '7.4'
- '8.1'
db:
- '{"vendor": "MySQL 8.0", "pdo": "mysql", "dsn": "mysql://bedita:bedita@127.0.0.1:3306/bedita", "image": "mysql:8.0", "options": "--health-cmd \"mysqladmin ping -h localhost\" --health-interval 10s --health-timeout 5s --health-retries 5"}'
- '{"vendor": "MySQL 5.7", "pdo": "mysql", "dsn": "mysql://bedita:bedita@127.0.0.1:3306/bedita?realVendor=mysql5.7", "image": "mysql:5.7", "options": "--health-cmd \"mysqladmin ping -h localhost\" --health-interval 10s --health-timeout 5s --health-retries 5"}'
Expand Down Expand Up @@ -124,7 +121,7 @@ jobs:

steps:
- name: 'Checkout current revision'
uses: 'actions/checkout@v2'
uses: 'actions/checkout@v3'

- name: 'Setup PHP'
uses: 'shivammathur/setup-php@v2'
Expand All @@ -140,7 +137,7 @@ jobs:
run: 'echo "::set-output name=path::$(composer global config cache-dir)"'

- name: 'Share Composer cache across runs'
uses: 'actions/cache@v2'
uses: 'actions/cache@v3'
with:
path: '${{ steps.cachedir.outputs.path }}'
key: "composer-${{ matrix.php }}-${{ hashFiles('**/composer.json') }}"
Expand All @@ -151,20 +148,17 @@ jobs:
- name: 'Install dependencies with Composer'
run: 'composer install --prefer-dist --no-interaction'

- name: 'Setup PCOV clobber'
run: 'composer require pcov/clobber && vendor/bin/pcov clobber'

- name: 'Run PHPUnit'
run: 'vendor/bin/phpunit --coverage-clover=clover.xml'

- name: 'Export coverage results'
uses: 'codecov/codecov-action@v1'
uses: 'codecov/codecov-action@v3'
with:
file: './clover.xml'
env_vars: PHP_VERSION,DB_VENDOR

- name: 'Archive code coverage results'
uses: 'actions/upload-artifact@v2'
uses: 'actions/upload-artifact@v3'
with:
name: 'PHP ${{ matrix.php }} with ${{ fromJson(matrix.db).vendor }}'
path: 'clover.xml'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.idea
/composer.lock
/phpunit.xml
/vendor
Expand Down
1 change: 1 addition & 0 deletions .phpunit.result.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":1,"defects":{"Chialab\\Calendar\\Test\\TestCase\\Controller\\Component\\CalendarComponentTest::testFindGroupByDayWithStart with data set \"test\"":4,"Chialab\\Calendar\\Test\\TestCase\\Controller\\Component\\CalendarComponentTest::testFindGroupedByDayWithRange with data set \"test\"":4,"Chialab\\Calendar\\Test\\TestCase\\View\\Helper\\CalendarHelperTest::testInitialization":2},"times":{"Chialab\\Calendar\\Test\\TestCase\\Controller\\Component\\CalendarComponentTest::testFindGroupByDayWithStart with data set \"test\"":1.766,"Chialab\\Calendar\\Test\\TestCase\\Controller\\Component\\CalendarComponentTest::testFindGroupedByDayWithRange with data set \"test\"":1.424,"Chialab\\Calendar\\Test\\TestCase\\View\\Helper\\CalendarHelperTest::testInitialization":0.005}}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Chialab/Calendar

**Calendar** is a [BEdita 4](https://www.bedita.com/) plugin designed to render and filter calendar views.
**Calendar** is a [BEdita 5](https://www.bedita.com/) plugin designed to render and filter calendar views.

## Usage

Expand Down
21 changes: 9 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
{
"name": "chialab/calendar",
"description": "BEdita 4 plugin for calendar views.",
"description": "BEdita 5 plugin for calendar views.",
"type": "cakephp-plugin",
"license": "MIT",
"require": {
"cakephp/cakephp": "^3.8",
"chialab/frontend-kit": "^2.0.0"
"php": ">=8.1",
"bedita/core": "^5.0.0",
"cakephp/cakephp": "^4.0",
"chialab/frontend-kit": "^3.0"
},
"require-dev": {
"cakephp/cakephp-codesniffer": "^3.0",
"cakephp/cakephp-codesniffer": "^5.0",
"cakephp/plugin-installer": "^1.0",
"phpunit/phpunit": "^5.7.14|^6.0"
"phpunit/phpunit": "~8.5.0 || ^9.3"
},
"autoload": {
"psr-4": {
Expand All @@ -25,13 +27,8 @@
}
},
"scripts": {
"cs-setup": [
"vendor/bin/phpcs --config-set installed_paths vendor/cakephp/cakephp-codesniffer",
"vendor/bin/phpcs --config-set default_standard CakePHP",
"vendor/bin/phpcs --config-set colors 1"
],
"cs-check": "vendor/bin/phpcs --colors -p --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests",
"cs-fix": "vendor/bin/phpcbf --colors --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests",
"cs-check": "vendor/bin/phpcs",
"cs-fix": "vendor/bin/phpcbf",
"test": "vendor/bin/phpunit --colors=always"
},
"config": {
Expand Down
18 changes: 18 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<ruleset name="App">
<file>./src</file>
<file>./tests</file>

<arg name="colors" />
<arg value="p" />

<config name="installed_paths" value="../../cakephp/cakephp-codesniffer,../../slevomat/coding-standard"/>

<rule ref="CakePHP" />
<rule ref="SlevomatCodingStandard.TypeHints.UnionTypeHintFormat">
<properties>
<property name="shortNullable" type="string" value="no"/>
<property name="nullPosition" type="string" value="last"/>
</properties>
</rule>
</ruleset>
53 changes: 20 additions & 33 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,35 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
colors="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="tests/bootstrap.php"
>
<php>
<ini name="memory_limit" value="-1"/>
<ini name="apc.enable_cli" value="1"/>
</php>

<!-- Add any additional test suites you want to run here -->
<testsuites>
<testsuite name="Chialab/Calendar">
<directory>tests/TestCase/</directory>
</testsuite>
</testsuites>

<!-- Setup a listener for fixtures -->
<listeners>
<listener class="Cake\TestSuite\Fixture\FixtureInjector">
<arguments>
<object class="Cake\TestSuite\Fixture\FixtureManager"/>
</arguments>
</listener>
</listeners>

<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" processIsolation="false" stopOnFailure="false" bootstrap="tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
<php>
<ini name="memory_limit" value="-1"/>
<ini name="apc.enable_cli" value="1"/>
</php>
<!-- Add any additional test suites you want to run here -->
<testsuites>
<testsuite name="Chialab/Calendar">
<directory>tests/TestCase/</directory>
</testsuite>
</testsuites>
<!-- Setup extension for fixtures -->
<extensions>
<extension class="\Cake\TestSuite\Fixture\PHPUnitExtension"/>
</extensions>
</phpunit>

0 comments on commit 90e0958

Please sign in to comment.