Skip to content

Commit 517b7aa

Browse files
author
Aleksandr Denisyuk
authored
Merge pull request #4 from denisyukphp/3.0.x
Upgrade package
2 parents cf82f05 + 089b635 commit 517b7aa

File tree

14 files changed

+171
-94
lines changed

14 files changed

+171
-94
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ indent_size = 4
1010

1111
[*.{yml,yaml}]
1212
indent_size = 2
13+
14+
[*.md]
15+
trim_trailing_whitespace = false

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
/.gitignore export-ignore
77
/.php-cs-fixer.dist.php export-ignore
88
/README.md export-ignore
9+
/build/ export-ignore
910
/composer.lock export-ignore
1011
/phpunit.xml.dist export-ignore
1112
/psalm.xml export-ignore

.github/workflows/ci.yml

Lines changed: 91 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,108 @@
1-
name: CI
1+
name: 'CI'
22

3-
on: ['push', 'pull_request']
3+
on:
4+
push:
5+
paths-ignore:
6+
- 'LICENSE'
7+
- 'README.md'
8+
pull_request:
9+
paths-ignore:
10+
- 'LICENSE'
11+
- 'README.md'
412

513
jobs:
6-
phpunit:
7-
name: PHPUnit
14+
php-parallel-lint:
15+
name: 'PHPParallelLint'
816
runs-on: 'ubuntu-latest'
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v3
21+
22+
- name: Setup PHP
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: latest
26+
coverage: none
27+
28+
- name: Install dependencies
29+
uses: ramsey/composer-install@v2
30+
31+
- name: Run PHPParallelLint
32+
run: composer php-parallel-lint -- --no-progress --ignore-fails
33+
34+
psalm:
35+
name: 'Psalm'
36+
runs-on: 'ubuntu-latest'
37+
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v3
41+
42+
- name: Setup PHP
43+
uses: shivammathur/setup-php@v2
44+
with:
45+
php-version: latest
46+
coverage: none
47+
48+
- name: Install dependencies
49+
uses: ramsey/composer-install@v2
50+
51+
- name: Run Psalm
52+
run: composer psalm -- --no-progress --no-cache --output-format=github
53+
54+
php-cs-fixer:
55+
name: 'PHPCsFixer'
56+
runs-on: 'ubuntu-latest'
57+
58+
steps:
59+
- name: Checkout repository
60+
uses: actions/checkout@v3
61+
62+
- name: Setup PHP
63+
uses: shivammathur/setup-php@v2
64+
with:
65+
php-version: latest
66+
coverage: none
67+
68+
- name: Install dependencies
69+
uses: ramsey/composer-install@v2
70+
71+
- name: Run PHPCsFixer
72+
run: composer php-cs-fixer:diff -- --no-interaction --using-cache=no
73+
74+
phpunit:
75+
name: 'PHPUnit'
76+
needs: ['php-parallel-lint', 'psalm', 'php-cs-fixer']
77+
runs-on: ${{ matrix.operating-system }}
78+
979
strategy:
1080
fail-fast: false
1181
matrix:
12-
php-versions: ['8.0', '8.1']
13-
stability: ['prefer-lowest', 'prefer-stable']
82+
operating-system:
83+
- 'ubuntu-latest'
84+
- 'windows-latest'
85+
php-version:
86+
- '8.0'
87+
- '8.1'
88+
composer-dependency:
89+
- 'lowest'
90+
- 'highest'
1491

1592
steps:
16-
- name: Checkout
17-
uses: actions/checkout@v2
18-
19-
- name: Cache Composer
20-
id: composer-cache
21-
run: |
22-
echo "::set-output name=dir::$(composer config cache-files-dir)"
23-
- uses: actions/cache@v2
24-
with:
25-
path: ${{ steps.composer-cache.outputs.dir }}
26-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
27-
restore-keys: |
28-
${{ runner.os }}-composer-
93+
- name: Checkout repository
94+
uses: actions/checkout@v3
2995

3096
- name: Setup PHP
3197
uses: shivammathur/setup-php@v2
3298
with:
33-
php-version: ${{ matrix.php-versions }}
34-
tools: composer:v2
99+
php-version: ${{ matrix.php-version }}
35100
coverage: none
36101

37-
- name: Update Composer
38-
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress
102+
- name: Install dependencies
103+
uses: ramsey/composer-install@v2
104+
with:
105+
dependency-versions: ${{ matrix.composer-dependency }}
39106

40107
- name: Run PHPUnit
41-
run: vendor/bin/phpunit --verbose --no-interaction
108+
run: composer phpunit -- --no-interaction --do-not-cache-result

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
/.idea/
22
/.php-cs-fixer.php
3-
/.php-cs-fixer.cache
4-
/.phpunit.result.cache
53
/composer.lock
64
/phpunit.xml
7-
/psalm.xml
85
/vendor/

.php-cs-fixer.dist.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,18 @@
22

33
$finder = (new PhpCsFixer\Finder())
44
->in([
5-
'./src/',
6-
'./tests/'
5+
__DIR__.'/src/',
6+
__DIR__.'/tests/',
77
])
88
;
99

1010
return (new PhpCsFixer\Config())
11-
->setUsingCache(false)
11+
->setUsingCache(true)
12+
->setCacheFile(__DIR__.'/build/cache/php-cs-fixer.cache')
1213
->setRiskyAllowed(true)
1314
->setRules([
1415
'@Symfony' => true,
1516
'@Symfony:risky' => true,
16-
'strict_param' => true,
17-
'single_line_throw' => false,
1817
])
1918
->setFinder($finder)
2019
;

LICENSE

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
The MIT License (MIT)
2-
31
Copyright (c) 2022 Aleksandr Denisyuk
42

53
Permission is hereby granted, free of charge, to any person obtaining a copy

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# TmpFile
22

3-
[![Build Status](https://img.shields.io/github/workflow/status/denisyukphp/tmpfile/build/master?style=plastic)](https://github.com/denisyukphp/tmpfile/actions/workflows/continuous-integration.yml)
3+
[![Build Status](https://img.shields.io/github/workflow/status/denisyukphp/tmpfile/build/master?style=plastic)](https://github.com/denisyukphp/tmpfile/actions/workflows/ci.yml)
44
[![Latest Stable Version](https://img.shields.io/packagist/v/denisyukphp/tmpfile?style=plastic)](https://packagist.org/packages/denisyukphp/tmpfile)
55
[![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/denisyukphp/tmpfile?style=plastic&color=8892BF)](https://packagist.org/packages/denisyukphp/tmpfile)
66
[![Total Downloads](https://img.shields.io/packagist/dt/denisyukphp/tmpfile?style=plastic)](https://packagist.org/packages/denisyukphp/tmpfile)

build/cache/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

composer.json

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "denisyukphp/tmpfile",
3-
"description": "Alternative to tmpfile() function",
3+
"description": "Alternative to tmpfile() function.",
44
"keywords": [
55
"tmpfile",
66
"tempnam",
@@ -25,8 +25,10 @@
2525
},
2626
"require-dev": {
2727
"friendsofphp/php-cs-fixer": "^3.10",
28+
"php-parallel-lint/php-console-highlighter": "^1.0",
29+
"php-parallel-lint/php-parallel-lint": "^1.3",
2830
"phpunit/phpunit": "^9.5",
29-
"symfony/process": "^6.0",
31+
"psalm/plugin-phpunit": "^0.17.0",
3032
"vimeo/psalm": "^4.26"
3133
},
3234
"suggest": {
@@ -43,9 +45,17 @@
4345
}
4446
},
4547
"scripts": {
46-
"phpunit": "./vendor/bin/phpunit --verbose --colors=always",
47-
"php-cs-fixer:fix": "./vendor/bin/php-cs-fixer fix --verbose --show-progress=dots",
48-
"php-cs-fixer:diff": "./vendor/bin/php-cs-fixer fix --verbose --dry-run --diff",
49-
"psalm": "./vendor/bin/psalm --show-info=true"
48+
"phpunit": "./vendor/bin/phpunit --verbose --colors=always --no-coverage",
49+
"phpunit-coverage": "./vendor/bin/phpunit --verbose --colors=always --coverage-text",
50+
"php-parallel-lint": "./vendor/bin/parallel-lint --colors ./src/ ./tests/",
51+
"php-cs-fixer:fix": "./vendor/bin/php-cs-fixer fix --ansi --verbose --show-progress=dots",
52+
"php-cs-fixer:diff": "./vendor/bin/php-cs-fixer fix --ansi --verbose --dry-run --diff",
53+
"psalm": "./vendor/bin/psalm --show-info=true",
54+
"test": [
55+
"@php-parallel-lint",
56+
"@psalm",
57+
"@php-cs-fixer:diff",
58+
"@phpunit"
59+
]
5060
}
5161
}

phpunit.xml.dist

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
4-
bootstrap="./vendor/autoload.php">
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
5+
bootstrap="./vendor/autoload.php"
6+
cacheResultFile="./build/cache/phpunit.cache"
7+
>
58
<testsuites>
6-
<testsuite name="TmpFile">
9+
<testsuite name="tmpfile">
710
<directory>./tests/</directory>
811
</testsuite>
912
</testsuites>
13+
<coverage
14+
processUncoveredFiles="true"
15+
cacheDirectory="./build/cache/phpunit-coverage/"
16+
>
17+
<include>
18+
<directory suffix=".php">./src/</directory>
19+
</include>
20+
</coverage>
1021
</phpunit>

0 commit comments

Comments
 (0)