Skip to content

Commit

Permalink
Merge pull request #21 from FriendsOfCake/ci
Browse files Browse the repository at this point in the history
Add CI
  • Loading branch information
ADmad authored Feb 23, 2023
2 parents 788d212 + accaa5a commit f5430c2
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ trim_trailing_whitespace = true
[*.yml]
indent_style = space
indent_size = 2

[*.neon]
indent_style = tab
indent_size = 4
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI

on: [push, pull_request]

jobs:
cs-stan:
name: Coding Standard & Static Analysis
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: mbstring, intl
coverage: none
tools: phpstan:1.10, cs2pr

- name: Composer Install
run: composer install

- name: Run phpcs
run: vendor/bin/phpcs --report=checkstyle --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ | cs2pr

- name: Run phpstan
if: always()
run: phpstan analyse --error-format=github
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,10 @@
"source": "https://github.com/FriendsOfCake/fixturize",
"issues": "https://github.com/FriendsOfCake/fixturize/issues",
"irc": "irc://irc.freenode.org/cakephp"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
4 changes: 4 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parameters:
level: 8
paths:
- src
6 changes: 3 additions & 3 deletions src/TestSuite/Fixture/ChecksumTestFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@
*
* If no data has changed, the usual truncate/insert flow is bypassed, increasing the speed
* of the test suite with heavy fixture usage up significantly.
*
*/
class ChecksumTestFixture extends TestFixture
{
/**
* List of table hashes
*
* @var array
* @var array<string, string>
*/
protected static $_tableHashes = [];

Expand Down Expand Up @@ -113,10 +112,11 @@ protected function _hash(ConnectionInterface $db): string
$driver = $db->getDriver();

if ($driver instanceof Mysql) {
$sth = $db->execute("CHECKSUM TABLE " . $this->table);
$sth = $db->execute('CHECKSUM TABLE ' . $this->table);

return $sth->fetchColumn(1);
}

// Have no better idea right now to make it always regenerate the tables
return microtime();
}
Expand Down

0 comments on commit f5430c2

Please sign in to comment.