Skip to content

Commit

Permalink
Chore: php8.2, update ci stuff ... (#583)
Browse files Browse the repository at this point in the history
set php 8.2 as min requirement
php-versions: ["8.2", "8.3", "8.4"]
allow latest phpunit
fix phpcs
fix phpstan issues
fix unit tests
add missing ci pipelines
add missing make files
add missing phpstan files
  • Loading branch information
julianzimmermann authored Jan 15, 2025
1 parent 4fc287b commit 65160cd
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 15 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
push:
branches: [ main ]

jobs:
continous-integration:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-versions: [ "8.2", "8.3", "8.4" ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, dom, fileinfo, pgsql, json
coverage: xdebug #optional
- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composercache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies and run ci tasks
run: make install ci
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.PHONY: install
install:
composer install

.PHONY: phpcs
phpcs:
./vendor/bin/phpcs --standard=./vendor/spryker/code-sniffer/Spryker/ruleset.xml ./src/FondOfOryx/* ./tests/*

.PHONY: phpcbf
phpcbf:
./vendor/bin/phpcbf --standard=./vendor/spryker/code-sniffer/Spryker/ruleset.xml ./src/FondOfOryx/* ./tests/*

.PHONY: phpstan
phpstan:
./vendor/bin/phpstan --memory-limit=-1 analyse ./src/FondOfOryx ./tests

.PHONY: codeception
codeception:
./vendor/bin/codecept run --env standalone --coverage --coverage-xml --coverage-html

.PHONY: ci
ci: phpcs codeception phpstan

.PHONY: clean
clean:
rm -Rf composer.lock
rm -Rf ./vendor
find ./tests/_output/ -not -name .gitignore -delete
rm -Rf src/Generated/*
rm -Rf src/Orm/*
15 changes: 8 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@
"license": "MIT",
"authors": [
{
"name": "Julian Haytt",
"email": "[email protected]"
"name": "Julian Hyatt",
"email": "[email protected]"
}
],
"require": {
"php": ">=8.0",
"php": ">=8.2",
"spryker/availability": "^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0",
"spryker/availability-cart-connector": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0",
"spryker/cart-extension": "^1.2.0 || ^2.0.0 || ^3.0.0 || ^4.0.0"
},
"require-dev": {
"fond-of-codeception/spryker": "^2.0.0",
"spryker/code-sniffer": "^0.12"
"fond-of-codeception/spryker": "*",
"spryker/code-sniffer": "*",
"spryker-sdk/phpstan-spryker": "*"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand All @@ -28,11 +29,11 @@
"autoload-dev": {
"psr-4": {
"FondOfOryx\\": "tests/FondOfOryx/",
"Generated\\": "src/Generated/"
"Generated\\": "src/Generated/",
"Orm\\": "src/Orm/"
}
},
"config": {
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
Expand Down
7 changes: 7 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
parameters:
level: 5
reportUnmatchedIgnoredErrors: false
scanDirectories:
- src/Orm/Zed
ignoreErrors:
- '#.* on an unknown class Generated\\(Client|Glue|Service|Yves|Zed)\\Ide\\AutoCompletion.*#'
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Codeception\Test\Unit;
use FondOfOryx\Zed\AvailabilityCartDataExtender\Business\AvailabilityCartDataExtenderFacade;
use FondOfOryx\Zed\AvailabilityCartDataExtender\Business\AvailabilityCartDataExtenderFacadeInterface;
use Generated\Shared\Transfer\QuoteTransfer;
use Spryker\Zed\Kernel\Business\AbstractFacade;

Expand Down Expand Up @@ -37,14 +36,14 @@ public function _before()

$this->toTest = new class ($this->facadeMock) extends AddAvailabilityDataToQuoteItemQuoteChangeObserverPlugin {
/**
* @var \FondOfOryx\Zed\AvailabilityCartDataExtender\Business\AvailabilityCartDataExtenderFacadeInterface
* @var \FondOfOryx\Zed\AvailabilityCartDataExtender\Business\AvailabilityCartDataExtenderFacade
*/
protected $facadeMock;

/**
* @param \FondOfOryx\Zed\AvailabilityCartDataExtender\Business\AvailabilityCartDataExtenderFacadeInterface $facadeMock
* @param \FondOfOryx\Zed\AvailabilityCartDataExtender\Business\AvailabilityCartDataExtenderFacade $facadeMock
*/
public function __construct(AvailabilityCartDataExtenderFacadeInterface $facadeMock)
public function __construct(AvailabilityCartDataExtenderFacade $facadeMock)
{
$this->facadeMock = $facadeMock;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Codeception\Test\Unit;
use FondOfOryx\Zed\AvailabilityCartDataExtender\Business\AvailabilityCartDataExtenderFacade;
use FondOfOryx\Zed\AvailabilityCartDataExtender\Business\AvailabilityCartDataExtenderFacadeInterface;
use Generated\Shared\Transfer\CartChangeTransfer;
use Generated\Shared\Transfer\CartPreCheckResponseTransfer;
use Spryker\Zed\Kernel\Business\AbstractFacade;
Expand Down Expand Up @@ -44,14 +43,14 @@ public function _before()

$this->toTest = new class ($this->facadeMock) extends CheckAvailabilityPlugin {
/**
* @var \FondOfOryx\Zed\AvailabilityCartDataExtender\Business\AvailabilityCartDataExtenderFacadeInterface
* @var \FondOfOryx\Zed\AvailabilityCartDataExtender\Business\AvailabilityCartDataExtenderFacade
*/
protected $facadeMock;

/**
* @param \FondOfOryx\Zed\AvailabilityCartDataExtender\Business\AvailabilityCartDataExtenderFacadeInterface $facadeMock
* @param \FondOfOryx\Zed\AvailabilityCartDataExtender\Business\AvailabilityCartDataExtenderFacade $facadeMock
*/
public function __construct(AvailabilityCartDataExtenderFacadeInterface $facadeMock)
public function __construct(AvailabilityCartDataExtenderFacade $facadeMock)
{
$this->facadeMock = $facadeMock;
}
Expand Down

0 comments on commit 65160cd

Please sign in to comment.