Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI #404

Merged
merged 3 commits into from
Nov 16, 2024
Merged

CI #404

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/testsuite-with-db.yml@5.x
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/cs-stan.yml@5.x
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