Skip to content

Commit

Permalink
Merge pull request #404 from FriendsOfCake/chore/ci
Browse files Browse the repository at this point in the history
CI
  • Loading branch information
ADmad authored Nov 16, 2024
2 parents a812fc6 + 86e4f2d commit c73af02
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 49 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ tests export-ignore
.github export-ignore
phpstan.neon export-ignore
psalm.xml export-ignore
.phive export-ignore
7 changes: 7 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
codecov:
require_ci_to_pass: yes

coverage:
range: "90...100"

comment: false
34 changes: 5 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,10 @@ permissions:

jobs:
testsuite:
uses: cakephp/.github/.github/workflows/[email protected]
secrets: inherit
uses: ADmad/.github/.github/workflows/testsuite-without-db.yml@master
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

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

steps:
- uses: actions/checkout@v4

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

- name: Composer Install
run: composer install

- name: Run phpcs
run: vendor/bin/phpcs --report=checkstyle src/ tests/ | cs2pr

- name: Run psalm
if: always()
run: psalm --output-format=github

- name: Run phpstan
if: always()
run: phpstan analyse
uses: cakephp/.github/.github/workflows/[email protected]
secrets: inherit
5 changes: 5 additions & 0 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpstan" version="2.0.1" installed="2.0.1" location="./tools/phpstan" copy="false"/>
<phar name="psalm" version="5.26.1" installed="5.26.1" location="./tools/psalm" copy="false"/>
</phive>
4 changes: 3 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
parameters:
level: 8
checkMissingIterableValueType: false
bootstrapFiles:
- tests/bootstrap.php
paths:
- src/
ignoreErrors:
-
identifier: missingType.iterableValue
2 changes: 1 addition & 1 deletion src/Command/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function installPackages(Arguments $args, ConsoleIo $io): void
$output = [];
$return = 0;
$this->_runNPMInstall($output, $return, $io, $args->getOption('latest') === true);
$io->out($output);
$io->out($output); // @phpstan-ignore argument.type

if ($return !== 0) {
$io->error('Package installation failed.');
Expand Down
4 changes: 1 addition & 3 deletions src/View/Helper/OptionsAwareTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ public function removeClasses(array|string $classes, array $options): array
foreach ($classes as $class) {
$indices = array_keys($options['class'], $class);
foreach ($indices as $index) {
if ($index !== false) {
unset($options['class'][$index]);
}
unset($options['class'][$index]);
}
}

Expand Down
1 change: 0 additions & 1 deletion tests/TestCase/Bake/BakeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public function setUp(): void
$this->_compareBasePath = Plugin::path('BootstrapUI') . 'tests' . DS . 'comparisons' . DS . 'Template' . DS;

$this->loadPlugins([
'Bake',
'Cake/TwigView' => [
'bootstrap' => true,
],
Expand Down
5 changes: 1 addition & 4 deletions tests/TestCase/Command/CopyLayoutsCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

use BootstrapUI\Command\CopyLayoutsCommand;
use Cake\Command\Command;
use Cake\Console\Arguments;
use Cake\Console\ConsoleIo;
use Cake\Console\Exception\StopException;
use Cake\Console\TestSuite\ConsoleIntegrationTestTrait;
Expand Down Expand Up @@ -118,14 +117,12 @@ public function testFilesCannotBeCopied()
->method('_copyLayouts')
->willReturn(false);

$args = new Arguments([], [], []);

$out = new StubConsoleOutput();
$err = new StubConsoleOutput();
$io = new ConsoleIo($out, $err);

try {
$result = $command->execute($args, $io);
$result = $command->run([], $io);
} catch (StopException $exception) {
$result = $exception->getCode();
}
Expand Down
13 changes: 3 additions & 10 deletions tests/TestCase/Command/ModifyViewCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

use BootstrapUI\Command\ModifyViewCommand;
use Cake\Command\Command;
use Cake\Console\Arguments;
use Cake\Console\ConsoleIo;
use Cake\Console\Exception\StopException;
use Cake\Console\TestSuite\ConsoleIntegrationTestTrait;
Expand Down Expand Up @@ -118,14 +117,12 @@ public function testPathIsNotAFile()
->method('_isFile')
->willReturn(false);

$args = new Arguments([], [], []);

$out = new StubConsoleOutput();
$err = new StubConsoleOutput();
$io = new ConsoleIo($out, $err);

try {
$result = $command->execute($args, $io);
$result = $command->run([], $io);
} catch (StopException $exception) {
$result = $exception->getCode();
}
Expand Down Expand Up @@ -156,14 +153,12 @@ public function testFileCannotBeRead()
->method('_readFile')
->willReturn(false);

$args = new Arguments([], [], []);

$out = new StubConsoleOutput();
$err = new StubConsoleOutput();
$io = new ConsoleIo($out, $err);

try {
$result = $command->execute($args, $io);
$result = $command->run([], $io);
} catch (StopException $exception) {
$result = $exception->getCode();
}
Expand Down Expand Up @@ -194,14 +189,12 @@ public function testFileCannotBeWritten()
->method('_writeFile')
->willReturn(false);

$args = new Arguments([], [], []);

$out = new StubConsoleOutput();
$err = new StubConsoleOutput();
$io = new ConsoleIo($out, $err);

try {
$result = $command->execute($args, $io);
$result = $command->run([], $io);
} catch (StopException $exception) {
$result = $exception->getCode();
}
Expand Down

0 comments on commit c73af02

Please sign in to comment.