Skip to content

Commit

Permalink
chore: move to pest (#71)
Browse files Browse the repository at this point in the history
* chore: move to pest

* Fix styling

* update rules

* allow version 1

* update exception

* add coverage

* update badges

* update readme
  • Loading branch information
pulkitjalan authored Jun 30, 2024
1 parent ffb63b4 commit d1812f5
Show file tree
Hide file tree
Showing 19 changed files with 284 additions and 246 deletions.
17 changes: 17 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and documentation with "export-ignore".
/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/.scrutinizer.yml export-ignore
/.styleci.yml export-ignore
/tests export-ignore
/.editorconfig export-ignore
/docs export-ignore
/UPGRADING.md export-ignore
/CHANGELOG.md export-ignore
/CONTRIBUTING.md export-ignore
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2

updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
33 changes: 33 additions & 0 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: dependabot-auto-merge

on: pull_request_target

permissions:
pull-requests: write
contents: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:

- name: Dependabot metadata
id: metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Auto-merge Dependabot PRs for semver-minor updates
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

- name: Auto-merge Dependabot PRs for semver-patch updates
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
21 changes: 21 additions & 0 deletions .github/workflows/pint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: pint

on: [push]

jobs:
php-cs-fixer:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Fix styling issues
uses: aglipanci/laravel-pint-action@v2

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Fix styling
47 changes: 47 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: run-tests

on:
push:
pull_request:
schedule:
- cron: "0 0 * * *"

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [8.3, 8.2, 8.1]
laravel: ["^11.0", "^10.0"]
dependency-version: [prefer-lowest, prefer-stable]
exclude:
- laravel: "^11.0"
php: 8.1

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, iconv
coverage: xdebug

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
- name: Execute tests
run: vendor/bin/pest tests

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: build
12 changes: 7 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/vendor
vendor
composer.lock
.DS_Store
/build
/.idea
/.vscode
build
.idea
.vscode
.phpunit.cache
.phpunit.result.cache
.php_cs.cache
.php-cs-fixer.cache
phpunit.xml
34 changes: 0 additions & 34 deletions .scrutinizer.yml

This file was deleted.

7 changes: 0 additions & 7 deletions .styleci.yml

This file was deleted.

71 changes: 0 additions & 71 deletions .travis.yml

This file was deleted.

24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ Google Api Client Wrapper
[![Latest Stable Version](https://poser.pugx.org/pulkitjalan/google-apiclient/v/stable?format=flat-square)](https://packagist.org/packages/pulkitjalan/google-apiclient)
[![MIT License](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](http://www.opensource.org/licenses/MIT)
[![Build Status](http://img.shields.io/travis/pulkitjalan/google-apiclient.svg?style=flat-square)](https://travis-ci.org/pulkitjalan/google-apiclient)
[![Quality Score](http://img.shields.io/scrutinizer/g/pulkitjalan/google-apiclient/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/pulkitjalan/google-apiclient/)
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/pulkitjalan/google-apiclient/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/pulkitjalan/google-apiclient/code-structure/master)
[![StyleCI](https://styleci.io/repos/29422724/shield)](https://styleci.io/repos/29422724)
[![Run Tests](https://github.com/pulkitjalan/google-apiclient/actions/workflows/run-tests.yml/badge.svg)](https://github.com/pulkitjalan/google-apiclient/actions/workflows/run-tests.yml)
[![Coverage](https://codecov.io/gh/pulkitjalan/google-apiclient/branch/main/graph/badge.svg?token=dpjZ4Tszxm)](https://codecov.io/gh/pulkitjalan/google-apiclient)
[![Total Downloads](https://img.shields.io/packagist/dt/pulkitjalan/google-apiclient.svg?style=flat-square)](https://packagist.org/packages/pulkitjalan/google-apiclient)

## Requirements
Expand Down Expand Up @@ -41,7 +39,7 @@ Finally run `php artisan vendor:publish --provider="PulkitJalan\Google\GoogleSer

#### Using an older version of PHP / Laravel?

If you are on a PHP version below 8.0 or a Laravel version below 8.0 just use an older version of this package.
If you are on a PHP version below 8.0 or a Laravel version below 10.0, use an older version of this package.

## Usage

Expand Down Expand Up @@ -103,6 +101,20 @@ return [
*/
'file' => '',
],

/*
|----------------------------------------------------------------------------
| Additional config for the Google Client
|----------------------------------------------------------------------------
|
| Set any additional config variables supported by the Google Client
| Details can be found here:
| https://github.com/google/google-api-php-client/blob/master/src/Google/Client.php
|
| NOTE: If client id is specified here, it will get over written by the one above.
|
*/
'config' => [],
];

```
Expand Down Expand Up @@ -143,6 +155,8 @@ Laravel Example:
```php
// returns instance of \Google\Service\Storage
$storage = Google::make('storage');
// or
$storage = Google::make(\Google\Service\Storage::class);

// list buckets example
$storage->buckets->listBuckets('project id');
Expand Down
27 changes: 17 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,35 @@
],
"require": {
"php": ">=8.0",
"illuminate/support": "^8.0|^9.0|^10.0|^11.0",
"google/apiclient": "^2.9"
"illuminate/support": "^10.0|^11.0",
"google/apiclient": "^2.16"
},
"require-dev": {
"phpunit/phpunit": "^9.5.10|^10.0",
"mockery/mockery": "^1.2.3"
"mockery/mockery": "^1.6",
"pestphp/pest": "^1.20|^2.0"
},
"autoload": {
"psr-4": {
"PulkitJalan\\Google\\": "src/"
"PulkitJalan\\Google\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"PulkitJalan\\Google\\Tests\\": "tests"
}
},
"scripts": {
"test": "vendor/bin/phpunit"
"analyse": "vendor/bin/phpstan analyse",
"baseline": "vendor/bin/phpstan analyse --generate-baseline",
"test": "vendor/bin/pest"
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"extra": {
"branch-alias": {
"dev-master": "4.1.x-dev"
},
"laravel": {
"providers": [
"PulkitJalan\\Google\\GoogleServiceProvider"
Expand Down
Loading

0 comments on commit d1812f5

Please sign in to comment.