Skip to content

Commit

Permalink
Modernize
Browse files Browse the repository at this point in the history
  • Loading branch information
jbboehr committed Feb 5, 2024
1 parent c054d2e commit 1426ea1
Show file tree
Hide file tree
Showing 23 changed files with 3,623 additions and 1,881 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

[*.nix]
indent_size = 2

[*.md]
indent_size = 2
17 changes: 15 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
nix/composer-env.nix linguist-vendored=true linguist-generated=true
nix/php-packages.nix linguist-vendored=true linguist-generated=true
* text=auto

composer.lock linguist-generated
composer-project.nix linguist-generated

.editorconfig export-ignore
.envrc export-ignore
.gitattributes export-ignore

/tests export-ignore
.github export-ignore
.phpcs.xml.dist export-ignore
psalm.xml export-ignore
phpstan.neon.dist export-ignore
phpunit.xml.dist export-ignore
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
119 changes: 87 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,92 @@
name: ci

on:
push:
branches:
- master
- github-actions
- ci
pull_request:
branches:
- master
push:
branches:
- master
- develop
- ci
pull_request:
branches:
- master

permissions:
contents: read

jobs:
run:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
php-versions: ["7.3", "7.4", "8.0"]
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: bcmath
coverage: xdebug
tools: phpunit

- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader --no-dev

- name: PHP test
run: phpunit
lint:
runs-on: ubuntu-latest
name: "Lint | PHP ${{ matrix.php-version }}"
strategy:
matrix:
php-version:
- "8.1"
- "8.2"
- "8.3"
steps:
- uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
tools: composer:v2

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: phpcs
run: php vendor/bin/phpcs

- name: phpstan
run: php vendor/bin/phpstan analyze

- name: psalm
run: php vendor/bin/psalm

test:
runs-on: ubuntu-latest
name: "Test | PHP ${{ matrix.php-version }}"
strategy:
matrix:
php-version:
- "8.1"
- "8.2"
- "8.3"
steps:
- uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: pcov
php-version: "${{ matrix.php-version }}"
tools: composer:v2

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Run test suite
run: php vendor/bin/phpunit --coverage-text
13 changes: 11 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
nbproject
vendor
.direnv
.envrc
.idea
.phpunit.result.cache
.phpunit.cache
*.log
clover.xml
result*
/.pre-commit-config.yaml
/coverage/
/vendor/
27 changes: 27 additions & 0 deletions .phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
<file>src</file>
<file>tests</file>

<exclude-pattern>*/.direnv/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/tests/fixtures/*</exclude-pattern>

<arg name="basepath" value="."/>
<arg name="colors"/>
<arg name="parallel" value="4"/>
<arg name="encoding" value="utf-8"/>
<arg name="tab-width" value="4"/>
<arg name="extensions" value="php" />

<rule ref="PSR12">
<exclude name="PSR12.Files.FileHeader" />
<exclude name="PSR12.Files.OpenTag" />
</rule>

<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="140"/>
</properties>
</rule>
</ruleset>
59 changes: 35 additions & 24 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,38 @@
{
"authors" : [
{
"email" : "jbboehr@gmail.com",
"name" : "John Boehr"
"authors": [
{
"email": "jbboehr@gmail.com",
"name": "John Boehr"
}
],
"autoload": {
"psr-4": {
"DNSBL\\": "src/"
}
},
"description": "DNSBL lookup",
"homepage": "http://github.com/jbboehr/dnsbl",
"name": "jbboehr/dnsbl",
"keywords": [
"dnsbl"
],
"license": "PHP-3.01",
"require": {
"php": ">=7.1",
"ext-filter": "*"
},
"type": "library",
"require-dev": {
"phpunit/phpunit": "^10",
"phpstan/phpstan-phpunit": "^1.3",
"phpstan/phpstan-strict-rules": "^1.5",
"psalm/plugin-phpunit": "^0.18.4",
"squizlabs/php_codesniffer": "^3.8",
"vimeo/psalm": "^5.21"
},
"autoload-dev": {
"psr-4": {
"DNSBL\\Tests\\": "tests"
}
}
],
"autoload" : {
"psr-4" : {
"DNSBL\\": "src/"
}
},
"description" : "DNSBL lookup",
"homepage": "http://github.com/jbboehr/dnsbl",
"name" : "jbboehr/dnsbl",
"keywords" : [
"dnsbl"
],
"license": "PHP-3.01",
"require" : {
"php" : ">=5.3.0"
},
"type" : "library",
"require-dev": {
"phpunit/phpunit": "^9.4.2"
}
}
Loading

0 comments on commit 1426ea1

Please sign in to comment.