Skip to content

Commit

Permalink
Tooling & PHP Version Updates (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
sixlive authored Sep 20, 2024
1 parent e0a9db6 commit 1f55cb6
Show file tree
Hide file tree
Showing 16 changed files with 339 additions and 252 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Tests

on:
push:
paths:
- "**.php"
- ".github/workflows/tests.yml"
- "phpunit.xml.dist"
- "composer.json"
- "composer.lock"

jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 5
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.3, 8.2]
stability: [prefer-lowest, prefer-stable]

name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}

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

- 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: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install dependencies
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction

- name: List Installed Dependencies
run: composer show -D

- name: Execute tests
env:
GEOCODIO_API_KEY: ${{ secrets.GEOCODIO_API_KEY }}
run: vendor/bin/pest --ci --parallel
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ docs
vendor
coverage
.phpunit.result.cache
.phpunit.cache
phpunit.xml
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

31 changes: 24 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@
}
],
"require": {
"php": "^7.2|^8.0",
"guzzlehttp/guzzle": "^6.3|^7.0"
"php": "^8.2",
"guzzlehttp/guzzle": "^7.0"
},
"require-dev": {
"symfony/var-dumper": "^4.3",
"phpunit/phpunit": "^8.2"
"laravel/pint": "^1.17",
"pestphp/pest": "^3.0",
"phpunit/phpunit": "^11.0",
"projektgopher/whisky": "^0.7.0",
"rector/rector": "^1.2",
"symfony/var-dumper": "^4.3"
},
"autoload": {
"psr-4": {
Expand All @@ -34,11 +38,24 @@
}
},
"scripts": {
"test": "vendor/bin/phpunit",
"toc": "markdown-toc README.md -i"
"post-install-cmd": [
"whisky update"
],
"post-update-cmd": [
"whisky update"
],
"test": "vendor/bin/pest",
"toc": "markdown-toc README.md -i",
"format": [
"pint",
"rector process --no-diffs"
]
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"extra": {
"laravel": {
Expand Down
31 changes: 11 additions & 20 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Geocodio Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.3/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="Geocodio Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
</phpunit>
26 changes: 26 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;

return RectorConfig::configure()
->withParallel()
->withPaths([
__DIR__.'/src',
__DIR__.'/tests',
])
->withRules([
InlineConstructorDefaultToPropertyRector::class,
])
->withSets([
LevelSetList::UP_TO_PHP_83,
SetList::CODE_QUALITY,
SetList::DEAD_CODE,
SetList::EARLY_RETURN,
SetList::TYPE_DECLARATION,
SetList::PRIVATIZATION,
]);
5 changes: 1 addition & 4 deletions src/Exceptions/GeocodioException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,4 @@

use Exception;

class GeocodioException extends Exception
{

}
class GeocodioException extends Exception {}
Loading

0 comments on commit 1f55cb6

Please sign in to comment.