Skip to content

Bump php to ^8.0, add tooling, linting, fixes #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# EditorConfig is awesome: https://editorconfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2
70 changes: 62 additions & 8 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,74 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: PHPUnit

on: [push]
on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build-test:
runs-on: ubuntu-latest

permissions:
contents: write
statuses: write

outputs:
lock: ${{ steps.hash.outputs.lock }}
cache: ${{ steps.composer-cache.outputs.cache }}

strategy:
fail-fast: true
matrix:
php-versions: [ '8.0', '8.1', '8.2', '8.3' ]
stability: [ 'stable', 'lowest' ]

steps:
- uses: actions/checkout@v2

- uses: php-actions/composer@v5
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer
extensions: json, dom, curl, libxml, mbstring
coverage: xdebug
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: PHPUnit Tests
uses: php-actions/phpunit@v2
- name: Get composer.lock or composer.json hash for caching
id: hash
shell: bash
run: |
if [ -f composer.lock ]; then
echo "lock=${{ hashFiles('**/composer.lock') }}" >> $GITHUB_OUTPUT
else
echo "lock=${{ hashFiles('**/composer.json') }}" >> $GITHUB_OUTPUT
fi

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v4
with:
php_extensions: xdebug mbstring
bootstrap: vendor/autoload.php
configuration: phpunit.xml
args: --coverage-text
path: ${{ outputs.cache }}
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ outputs.lock }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php }}-${{ outputs.lock }}
${{ runner.os }}-php-${{ matrix.php }}-
${{ runner.os }}-php-

- name: Install Dependencies (prefer-${{ matrix.stability }})
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-${{ matrix.stability }}

- name: Configure matchers
uses: mheap/phpunit-matcher-action@v1

- name: Execute composer test (Unit and Feature tests)
run: composer test:ci
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ Homestead.yaml
npm-debug.log
yarn-error.log
.env
.phpunit.result.cache
*.cache
11 changes: 7 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ env:
matrix:
fast_finish: true
include:
- php: 7.2
- php: 7.2
- php: 8.0
- php: 8.0
env: setup=lowest
- php: 7.3
- php: 7.3
- php: 8.1
- php: 8.1
env: setup=lowest
- php: 8.2
- php: 8.2
env: setup=lowest

sudo: false
Expand Down
27 changes: 23 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,35 @@
"email": "[email protected]"
}
],
"scripts": {
"lint": "pint --test",
"lint:fix": "pint --repair",
"psalm": "psalm",
"psalm:fix": "psalm --alter --issues=MissingReturnType,MissingParamType",
"test": "phpunit --coverage-text",
"test:ci": "phpunit --teamcity"
},
"require": {
"ext-json": "*",
"php": "^8.0"
},
"require-dev": {
"orchestra/testbench": "^7.0"
"orchestra/testbench": "^7.0",
"rector/rector": "^1.2",
"ergebnis/composer-normalize": "^2.44",
"vimeo/psalm": "^5.26",
"psalm/plugin-laravel": "^2.9",
"laravel/pint": "^1.18"
},
"autoload": {
"psr-4" : {
"psr-4": {
"nullthoughts\\LaravelDataSync\\": "src/"
}
},
"autoload-dev": {
"psr-4" : {
"nullthoughts\\LaravelDataSync\\Tests\\": "tests/"
"psr-4": {
"nullthoughts\\LaravelDataSync\\Tests\\": "tests/",
"nullthoughts\\LaravelDataSync\\Tests\\Fakes\\": "tests/fakes/"
}
},
"extra": {
Expand All @@ -31,5 +45,10 @@
"nullthoughts\\LaravelDataSync\\DataSyncBaseServiceProvider"
]
}
},
"config": {
"allow-plugins": {
"ergebnis/composer-normalize": true
}
}
}
Loading