-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from aligent/feature/Github-Workflows
GitHub workflows
- Loading branch information
Showing
15 changed files
with
374 additions
and
21 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* @AdamJHall @aligent/oro-developers | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: 2 | ||
|
||
updates: | ||
- package-ecosystem: "composer" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Code Style Checks | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [ubuntu-latest] | ||
php: [8.0] | ||
stability: [prefer-lowest, prefer-stable] | ||
|
||
name: PHP-${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} - PHPCS | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: "dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo" | ||
coverage: none | ||
|
||
- name: Validate composer.json | ||
run: composer validate | ||
|
||
- name: Cache Composer packages | ||
id: composer-cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: vendor | ||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-php- | ||
- name: Install dependencies | ||
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction | ||
|
||
- name: Execute PHPCS | ||
run: bin/phpcs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Static analysis | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [ubuntu-latest] | ||
php: [8.0] | ||
stability: [prefer-lowest, prefer-stable] | ||
|
||
name: PHP-${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} - PHPStan | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: "dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo" | ||
coverage: none | ||
|
||
- name: Validate composer.json | ||
run: composer validate | ||
|
||
- name: Cache Composer packages | ||
id: composer-cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: vendor | ||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-php- | ||
- name: Install dependencies | ||
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction | ||
|
||
- name: Execute PHPStan | ||
run: bin/phpstan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
on: | ||
push: | ||
# Sequence of patterns matched against refs/tags | ||
tags: | ||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
|
||
name: Create Release | ||
|
||
jobs: | ||
build: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
body_path: RELEASE_NOTES.md | ||
|
||
- name: Update Packagist | ||
env: | ||
API_TOKEN: ${{ secrets.PackagistApiToken }} | ||
run: curl -XPOST -H'content-type:application/json' 'https://packagist.org/api/update-package?username=aligent&apiToken='$API_TOKEN -d'{"repository":{"url":"https://packagist.org/packages/aligent/oro-geo-detection"}}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Tests | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [ubuntu-latest] | ||
php: [8.0] | ||
stability: [prefer-lowest, prefer-stable] | ||
|
||
name: PHP-${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} - PHPUnit | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: "dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo" | ||
coverage: none | ||
|
||
- name: Install dependencies | ||
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction | ||
|
||
- name: Execute tests | ||
run: bin/phpunit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,12 @@ | ||
# IDE | ||
.idea | ||
|
||
# PHPUnit | ||
.phpunit.result.cache | ||
|
||
# Composer | ||
composer.lock | ||
vendor/ | ||
.idea/ | ||
|
||
# Binaries | ||
bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### 4.2.3 Release | ||
|
||
- Added Github Workflows (PHPCS, PHPStan and PHPUnit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,44 @@ | ||
{ | ||
"name": "aligent/oro-geo-detection", | ||
"description": "A Bundle for OroCommerce to provide application level geo-detection using the maxmind db", | ||
"type": "library", | ||
"license": "GPL-3.0", | ||
"version": "4.2.0", | ||
"authors": [ | ||
{ | ||
"name": "Adam Hall", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": "~7.4.14 || ~8.0.0", | ||
"oro/commerce": "^4.2", | ||
"geoip2/geoip2": "~2.0", | ||
"guzzlehttp/guzzle": "^7.2" | ||
}, | ||
"autoload": { | ||
"psr-4": { "Aligent\\GeoDetectionBundle\\": "./src/" } | ||
"name": "aligent/oro-geo-detection", | ||
"description": "A Bundle for OroCommerce to provide application level geo-detection using the maxmind db", | ||
"type": "library", | ||
"license": "GPL-3.0", | ||
"authors": [ | ||
{ | ||
"name": "Adam Hall", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"repositories": { | ||
"oro": { | ||
"type": "composer", | ||
"url": "https://packagist.orocrm.com" | ||
} | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Aligent\\GeoDetectionBundle\\": "./src/" | ||
} | ||
}, | ||
"config": { | ||
"bin-dir": "bin" | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"require": { | ||
"php": "~7.4.14 || ~8.0.0", | ||
"oro/commerce": "^4.2", | ||
"geoip2/geoip2": "~2.0", | ||
"guzzlehttp/guzzle": "^7.2" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^9.5", | ||
"phpstan/phpstan": "^1.7", | ||
"phpmd/phpmd": "^2.12", | ||
"friendsofphp/php-cs-fixer": "~2.18.2 || ~3.1.0", | ||
"nelmio/alice": "~3.8.0 || ~3.9.0", | ||
"theofidry/alice-data-fixtures": "~1.4.0 || ~1.5.0", | ||
"symfony/phpunit-bridge": "~4.4.24 || ~6.1.0", | ||
"squizlabs/php_codesniffer": "^3.6" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="PSR2"> | ||
<description>The PSR-2 coding standard.</description> | ||
<rule ref="PSR2"/> | ||
<rule ref="Generic.Files.ByteOrderMark"/> | ||
<rule ref="Generic.Files.LineEndings"/> | ||
<rule ref="MySource.PHP.GetRequestData"/> | ||
<file>src/</file> | ||
<exclude-pattern>*\.js</exclude-pattern> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
parameters: | ||
level: 1 | ||
paths: | ||
- src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html --> | ||
<phpunit | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd" | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="vendor/autoload.php" | ||
stopOnError="false" | ||
stopOnFailure="false" | ||
stopOnWarning="false" | ||
stopOnIncomplete="false" | ||
stopOnRisky="false" | ||
stopOnSkipped="false" | ||
failOnRisky="false" | ||
failOnWarning="false" | ||
beStrictAboutChangesToGlobalState="false" | ||
beStrictAboutOutputDuringTests="false" | ||
beStrictAboutResourceUsageDuringSmallTests="false" | ||
beStrictAboutTestsThatDoNotTestAnything="false" | ||
beStrictAboutTodoAnnotatedTests="false" | ||
beStrictAboutCoversAnnotation="false" | ||
enforceTimeLimit="false" | ||
verbose="false"> | ||
|
||
<testsuites> | ||
<testsuite name="unit"> | ||
<directory>src/Tests/Unit</directory> | ||
</testsuite> | ||
</testsuites> | ||
<php> | ||
<env name="SYMFONY_ENV" value="test"/> | ||
<env name="SYMFONY_DEBUG" value="0"/> | ||
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" /> | ||
<ini name="error_reporting" value="-1"/> | ||
<ini name="memory_limit" value="-1"/> | ||
<server name="KERNEL_DIR" value="src/"/> | ||
</php> | ||
<listeners> | ||
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/> | ||
<listener class="Oro\Component\TestUtils\Listener\TestListener"/> | ||
</listeners> | ||
<coverage> | ||
<include> | ||
<directory>src</directory> | ||
</include> | ||
</coverage> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,4 +94,4 @@ public function getClientCountry(): ?string | |
|
||
return $country; | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/Tests/Unit/DependencyInjection/AligentGeoDetectionExtensionTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
/** | ||
* @category Aligent | ||
* @package | ||
* @author Chris Rossi <[email protected]> | ||
* @copyright 2022 Aligent Consulting. | ||
* @license | ||
* @link http://www.aligent.com.au/ | ||
*/ | ||
namespace Aligent\GeoDetectionBundle\Tests\Unit\DependencyInjection; | ||
|
||
use Aligent\GeoDetectionBundle\DependencyInjection\AligentGeoDetectionExtension; | ||
use Oro\Bundle\TestFrameworkBundle\Test\DependencyInjection\ExtensionTestCase; | ||
|
||
class AligentGeoDetectionExtensionTest extends ExtensionTestCase | ||
{ | ||
public function testLoad(): void | ||
{ | ||
$this->loadExtension(new AligentGeoDetectionExtension(), ['aligent_geo_detection' => ['database' => '']]); | ||
|
||
// Services | ||
$expectedDefinitions = [ | ||
'aligent_geo_detection.form.type.geo_detection_countries_collection', | ||
'aligent_geo_detection.form.type.geo_detection_country', | ||
'aligent_geo_detection.form.type.geo_detection_system_config', | ||
'aligent_geo_detection.reader', | ||
'aligent_geo_detection.layout_context_configurator.geo_detection', | ||
'aligent_geo_detection.provider.redirection_config_provider', | ||
'aligent_geo_detection.provider.geo_detection', | ||
'aligent_geo_detection.cache', | ||
'aligent_geo_detection.layout.block_type.redirection_block', | ||
'aligent_geo_detection.layout.block_type.site_select_block', | ||
'aligent_geo_detection.layout.data_provider.redirection_provider', | ||
'aligent_geo_detection.cache.warmer', | ||
]; | ||
$this->assertDefinitionsLoaded($expectedDefinitions); | ||
|
||
$expectedExtensionConfigs = ['aligent_geo_detection']; | ||
$this->assertExtensionConfigsLoaded($expectedExtensionConfigs); | ||
} | ||
} |
Oops, something went wrong.