Skip to content

Commit

Permalink
Merge pull request #131 from imdhemy/chore/update-ci-workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
imdhemy authored Aug 25, 2022
2 parents dc0f5cd + 564bb0b commit f2ffb4e
Show file tree
Hide file tree
Showing 12 changed files with 185 additions and 170 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Mention the related issue, either a feature request or a bug report.

Describe your solution to the problem.

**Does your code follow the PSR-2 standard?** _(Yes|No)_.
**Does your code follow the PSR-12 standard?** _(Yes|No)_.

Answer: ...

Expand Down
84 changes: 84 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: CI
on:
push:
branches:
- '*'
- '*/*'
- '**'
pull_request:
branches:
- '*'
- '*/*'
- '**'
jobs:
# PSR-12 Coding standards
psr-12:
name: PSR-12
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Check PSR-12
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php-cs-fixer.dist.php --dry-run

# Static code analysis
static_code_analysis:
name: Psalm - Static code analysis
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: PHP setup
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none

- name: Cache composer dependencies
uses: actions/cache@v1
with:
path: vendor
key: composer-${{ hashFiles('composer.lock') }}

- name: Install dependencies
run: composer install -n --prefer-dist

- name: Psalm
run: composer psalm

# Tests
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
php: [ 7.4, 8.0, 8.1 ]
name: Tests - ${{ matrix.os }} - ${{ matrix.php }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: PHP setup
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
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 install

- name: Security advice
run: composer security-advice

- name: Execute PHPUnit tests
run: composer test
33 changes: 0 additions & 33 deletions .github/workflows/code-analysis.yml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/code-style.yml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/tests.yml

This file was deleted.

13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<div align="center">
<p><img width="450" src="cover.png" alt="Laravel In-app Purchase cover"></p>
<p>
<img alt="Packagist PHP Version Support" src="https://img.shields.io/packagist/php-v/imdhemy/laravel-purchases">
<img src="https://img.shields.io/packagist/v/imdhemy/laravel-purchases.svg?style=flat-square" alt="Latest Version on Packagist">
<img src="https://img.shields.io/packagist/dt/imdhemy/laravel-purchases.svg?style=flat-square" alt="Total Downloads">
<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/imdhemy/laravel-in-app-purchases">
<a href="https://github.com/imdhemy/laravel-in-app-purchases/actions/workflows/code-style.yml"><img src="https://github.com/imdhemy/laravel-in-app-purchases/actions/workflows/code-style.yml/badge.svg" alt="Code Style:PSR12"></a>
<a href="https://github.com/imdhemy/laravel-in-app-purchases/actions/workflows/tests.yml"><img src="https://github.com/imdhemy/laravel-in-app-purchases/actions/workflows/tests.yml/badge.svg" alt="Tests"></a>
<img alt="Packagist PHP Version Support" src="https://img.shields.io/packagist/php-v/imdhemy/laravel-purchases">
<a href="https://packagist.org/packages/imdhemy/laravel-purchases"><img src="https://img.shields.io/packagist/v/imdhemy/laravel-purchases.svg?style=flat-square"
alt="Latest Version on Packagist"></a>
<a href="https://packagist.org/packages/imdhemy/laravel-purchases/stats"><img src="https://img.shields.io/packagist/dt/imdhemy/laravel-purchases.svg?style=flat-square"
alt="Total Downloads"></a>
<a href="https://github.com/imdhemy/laravel-in-app-purchases/commits/"><img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/imdhemy/laravel-in-app-purchases"></a>
<a href="https://github.com/imdhemy/laravel-in-app-purchases/actions/workflows/ci.yml"><img src="https://github.com/imdhemy/laravel-in-app-purchases/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
</p>
<p> ✅ App Store ✅ Google Play </p>

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
}
},
"scripts": {
"psalm": "vendor/bin/psalm",
"psalm-info": "vendor/bin/psalm --show-info=true --no-cache",
"psalm": "vendor/bin/psalm --show-info=true --no-cache",
"format": "vendor/bin/php-cs-fixer fix --allow-risky=yes",
"check-style": "vendor/bin/php-cs-fixer fix --dry-run",
"test": "vendor/bin/phpunit --testdox"
"test": "vendor/bin/phpunit --testdox",
"security-advice": "composer update --dry-run roave/security-advisories"
},
"extra": {
"laravel": {
Expand Down
143 changes: 77 additions & 66 deletions config/liap.php
Original file line number Diff line number Diff line change
@@ -1,74 +1,85 @@
<?php

use Imdhemy\Purchases\Events\AppStore\Cancel;
use Imdhemy\Purchases\Events\AppStore\DidChangeRenewalPref;
use Imdhemy\Purchases\Events\AppStore\DidChangeRenewalStatus;
use Imdhemy\Purchases\Events\AppStore\DidFailToRenew;
use Imdhemy\Purchases\Events\AppStore\DidRecover;
use Imdhemy\Purchases\Events\AppStore\DidRenew;
use Imdhemy\Purchases\Events\AppStore\InitialBuy;
use Imdhemy\Purchases\Events\AppStore\InteractiveRenewal;
use Imdhemy\Purchases\Events\AppStore\PriceIncreaseConsent;
use Imdhemy\Purchases\Events\AppStore\Refund;
use Imdhemy\Purchases\Events\AppStore\Revoke;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionCanceled;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionDeferred;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionExpired;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionInGracePeriod;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionOnHold;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionPaused;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionPauseScheduleChanged;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionPriceChangeConfirmed;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionPurchased;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionRecovered;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionRenewed;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionRestarted;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionRevoked;

return [
'routing' => [
'signed' => false,
],
/*
|--------------------------------------------------------------------------
| Routing configuration
|--------------------------------------------------------------------------
|
| This configuration is used to determine the routing behavior of the
| Server notifications handler endpoint.
|
| You can find more information on documentation.
| @see https://imdhemy.com/laravel-iap-docs/docs/get-started/routing
*/

'routing' => [
'signed' => false,
'middleware' => [],
'prefix' => '',
],

/*
|--------------------------------------------------------------------------
| Google Play Default Package name
|--------------------------------------------------------------------------
|
| This value is the default package name used when the package name is not
| provided while verifying the receipts.
|
*/
'google_play_package_name' => env('GOOGLE_PLAY_PACKAGE_NAME', 'com.some.thing'),

/*
|--------------------------------------------------------------------------
| App Store Password
|--------------------------------------------------------------------------
|
| This value is the app-specific share password generated by the app store.
| @see https://imdhemy.com/laravel-iap-docs/docs/credentials/app-store
|
*/
'appstore_password' => env('APPSTORE_PASSWORD', ''),

'google_play_package_name' => env('GOOGLE_PLAY_PACKAGE_NAME', 'com.some.thing'),
/*
|--------------------------------------------------------------------------
| Event Listeners
|--------------------------------------------------------------------------
|
| This configuration is used to determine the event listeners that will be
| registered with the application.
| You can find a list of all available events of the documentation
|
| @see https://imdhemy.com/laravel-iap-docs/docs/server-notifications/event-list
| @see https://imdhemy.com/laravel-iap-docs/docs/get-started/event-listeners
|
*/
'eventListeners' => [
/*
|--------------------------------------------------------------------------
| App Store Events
|--------------------------------------------------------------------------
|
| These event listeners are triggered when a new notification is received from App Store.
| @see https://imdhemy.com/laravel-iap-docs/docs/server-notifications/event-list#app-store-events
|
*/

'appstore_password' => env('APPSTORE_PASSWORD', ''),
/* \Imdhemy\Purchases\Events\AppStore\Cancel::class => [
\App\Listeners\AppStore\Cancel::class,
],*/

'eventListeners' => [
/**
* --------------------------------------------------------
* Google Play Events
* --------------------------------------------------------
*/
SubscriptionPurchased::class => [],
SubscriptionRenewed::class => [],
SubscriptionInGracePeriod::class => [],
SubscriptionExpired::class => [],
SubscriptionCanceled::class => [],
SubscriptionPaused::class => [],
SubscriptionRestarted::class => [],
SubscriptionDeferred::class => [],
SubscriptionRevoked::class => [],
SubscriptionOnHold::class => [],
SubscriptionRecovered::class => [],
SubscriptionPauseScheduleChanged::class => [],
SubscriptionPriceChangeConfirmed::class => [],
/*
|--------------------------------------------------------------------------
| Google Play Events
|--------------------------------------------------------------------------
|
| These event listeners are triggered when a new notification is received from Google Play
| @see @see https://imdhemy.com/laravel-iap-docs/docs/server-notifications/event-list#google-play-events
*/

/**
* --------------------------------------------------------
* App Store Events
* --------------------------------------------------------
*/
Cancel::class => [],
DidChangeRenewalPref::class => [],
DidChangeRenewalStatus::class => [],
DidFailToRenew::class => [],
DidRecover::class => [],
DidRenew::class => [],
InitialBuy::class => [],
InteractiveRenewal::class => [],
PriceIncreaseConsent::class => [],
Refund::class => [],
Revoke::class => [],
],
/* \Imdhemy\Purchases\Events\GooglePlay\SubscriptionRecovered::class => [
\App\Listeners\GooglePlay\SubscriptionRecovered::class,
],*/
],
];
Loading

0 comments on commit f2ffb4e

Please sign in to comment.