Skip to content

Commit

Permalink
Initial commit of the project scafolding
Browse files Browse the repository at this point in the history
  • Loading branch information
macbre committed Nov 24, 2023
1 parent 4d80b07 commit c35f3c3
Show file tree
Hide file tree
Showing 5 changed files with 3,497 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Test

on:
push:
branches: [ "master" ]
pull_request:

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
# https://github.com/shivammathur/setup-php#tada-php-support
php-versions:
- '8.1'
- '8.2'
- '8.3' # nightly

steps:
- uses: actions/checkout@v3

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: xdebug

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

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

- name: Run test suite
run: composer run-script test

- name: Lint the code
env:
PHP_CS_FIXER_IGNORE_ENV: '1' # make cs-fixer stop complaining when using PHP 8.3
run: composer run-script lint
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea/
/vendor/
17 changes: 17 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__ . '/src/')
->in(__DIR__ . '/tests/')
;

$config = new PhpCsFixer\Config();

// https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/rules/index.rst
// https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/master/doc/ruleSets/index.rst
return $config
->setRules([
'@PSR2' => true,
])
->setFinder($finder)
;
36 changes: 36 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "elecena/jsonl-parser",
"description": "Add, read and remove entries from JSON Lines formatted files",
"type": "library",
"license": "MIT",
"autoload": {
"psr-4": {
"Elecena\\JsonlParser\\": "src/"
},
"classmap": [
"tests/"
]
},
"authors": [
{
"name": "Maciej Brencz",
"email": "[email protected]"
}
],
"require": {
"php": "^8.1"
},
"require-dev": {
"phpunit/phpunit": "^10.3",
"friendsofphp/php-cs-fixer": "^3.22"
},
"scripts": {
"test": "phpunit --testdox",
"lint": [
"php-cs-fixer fix --config=.php-cs-fixer.php --dry-run --verbose"
],
"format": [
"php-cs-fixer fix --config=.php-cs-fixer.php"
]
}
}
Loading

0 comments on commit c35f3c3

Please sign in to comment.