Skip to content

Commit

Permalink
Issue mindscreen#4 - Drop support for PHP<7.2 and Add support for PHP…
Browse files Browse the repository at this point in the history
… 8.2, 8.3
  • Loading branch information
Sweetchuck committed Feb 25, 2024
1 parent e4308b9 commit c2c06d1
Show file tree
Hide file tree
Showing 31 changed files with 2,093 additions and 189 deletions.
218 changes: 218 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@

version: 2.1

orbs:
codecov: 'codecov/codecov@3.0.0'

.env_app: &env_app
SHELL: '/bin/bash'

.env_composer: &env_composer
COMPOSER_NO_INTERACTION: '1'
COMPOSER_MEMORY_LIMIT: '-1'
COMPOSER_DISABLE_XDEBUG_WARN: '1'
COMPOSER_CACHE_DIR: '/home/circleci/.cache/composer'

executors:
php_min:
resource_class: 'small'
environment:
<<: *env_app
<<: *env_composer
docker:
-
name: 'main'
image: 'cimg/php:7.2'

php_plus1:
resource_class: 'small'
environment:
<<: *env_app
<<: *env_composer
docker:
-
name: 'main'
image: 'cimg/php:7.3'

php_plus2:
resource_class: 'small'
environment:
<<: *env_app
<<: *env_composer
docker:
-
name: 'main'
image: 'cimg/php:7.4'

php_plus3:
resource_class: 'small'
environment:
<<: *env_app
<<: *env_composer
docker:
-
name: 'main'
image: 'cimg/php:8.0'

php_plus4:
resource_class: 'small'
environment:
<<: *env_app
<<: *env_composer
docker:
-
name: 'main'
image: 'cimg/php:8.1'

php_plus5:
resource_class: 'small'
environment:
<<: *env_app
<<: *env_composer
docker:
-
name: 'main'
image: 'cimg/php:8.2'

php_plus6:
resource_class: 'small'
environment:
<<: *env_app
<<: *env_composer
docker:
-
name: 'main'
image: 'cimg/php:8.3'

commands:
install_php_extension_pcov:
description: 'Install PCOV PHP extension'
steps:
-
run:
name: 'Install PCOV PHP extension - pecl install pcov'
command: |-
if php -m | grep pcov ; then
exit 0
fi
sudo pecl install pcov
if php -m | grep pcov ; then
exit 0
fi
scanDir="$(php -i | grep --color=never --only-matching --perl-regexp '(?<=^Scan this dir for additional \.ini files => ).+')"
echo 'extension=pcov' | sudo tee "${scanDir}/pcov.ini"
php -m | grep pcov
composer_install:
description: 'Install Composer dependencies with cache restore and save'
steps:
-
restore_cache:
name: 'Composer - cache restore'
keys:
- 'composer-{{ checksum "./composer.lock" }}-2'

-
run:
name: 'Composer - install'
command: >
composer install --ansi --no-progress
-
save_cache:
name: 'Composer - cache save'
key: 'composer-{{ checksum "./composer.lock" }}-2'
paths:
- '~/.cache/composer/'

lint:
description: 'Run linters'
steps:
-
run:
name: 'Run composer validate'
command: |-
composer validate
-
run:
name: 'Run PHPCS'
command: |-
"$(composer config 'bin-dir')/phpcs"
test:
description: 'Run tests'
parameters:
executor:
type: 'string'
steps:
-
run:
name: 'Test - Unit'
command: |-
mkdir -p '.cache' 'reports/human' 'reports/machine'
"$(composer config 'bin-dir')/phpunit" --testsuite='Unit'
-
when:
condition:
equal: ['<<parameters.executor>>', 'php_min']
steps:
-
codecov/upload:
flags: 'unit'
file: './reports/machine/coverage.clover.xml'
-
store_test_results:
name: 'Store unit test results'
path: './reports/machine/result.junit.xml'

jobs:
build:
executor: 'php_min'
steps:
- 'checkout'
- 'composer_install'
lint:
executor: 'php_min'
steps:
- 'checkout'
- 'composer_install'
- 'lint'
test:
parameters:
executor:
type: 'string'
executor: '<<parameters.executor>>'
steps:
- 'checkout'
- 'install_php_extension_pcov'
- 'composer_install'
-
test:
executor: '<<parameters.executor>>'

workflows:
lint_and_test:
jobs:
-
build: {}
-
lint:
requires:
- 'build'
-
test:
name: 'test_<<matrix.executor>>'
requires:
- 'build'
matrix:
parameters:
executor:
- 'php_min'
- 'php_plus1'
- 'php_plus2'
- 'php_plus3'
- 'php_plus4'
- 'php_plus5'
- 'php_plus6'
3 changes: 0 additions & 3 deletions .coveralls.yml

This file was deleted.

15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

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

[tests/fixtures/**]
indent_style = unset
indent_size = unset
trim_trailing_whitespace = false
insert_final_newline = false
24 changes: 20 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
.idea
vendor/
coverage/
composer.lock
### Common places for toolings.
/.cache/
/reports/


### Composer.
/vendor/
/mindscreen-yarnlock-*.tar
/mindscreen-yarnlock-*.tar.bz2
/mindscreen-yarnlock-*.tar.gz
/mindscreen-yarnlock-*.tgz
/mindscreen-yarnlock-*.zip


### PHPCS.
/phpcs.xml


### PHPUnit.
/phpunit.xml
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

9 changes: 5 additions & 4 deletions readme.md → README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[![Build Status](https://travis-ci.org/mindscreen/yarnlock.svg?branch=master)](https://travis-ci.org/mindscreen/yarnlock)
[![Coverage Status](https://coveralls.io/repos/github/mindscreen/yarnlock/badge.svg?branch=master)](https://coveralls.io/github/mindscreen/yarnlock?branch=master)

# Mindscreen\YarnLock

[![CircleCI](https://circleci.com/gh/mindscreen/yarnlock/tree/master.svg?style=svg)](https://circleci.com/gh/mindscreen/yarnlock/?branch=master)
[![codecov](https://codecov.io/gh/mindscreen/yarnlock/branch/master/graph/badge.svg?token=HSF16OGPyr)](https://app.codecov.io/gh/mindscreen/yarnlock/branch/master)


A php-package for parsing and evaluating the [yarn.lock](https://yarnpkg.com/lang/en/docs/yarn-lock/) format.

## Basic Usage
Expand Down Expand Up @@ -35,4 +36,4 @@ $yarnLock->calculateDepth($rootDependencies);

// get the first two levels; the second argument is the exclusive upper limit
$yarnLock->getPackagesByDepth(0, 2);
```
```
36 changes: 31 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,42 @@
"email": "matthias.klatte@mindscreen.de"
}
],
"scripts": {
"test": "phpunit tests"
"config": {
"platform": {
"php": "7.2"
},
"optimize-autoloader": true,
"sort-packages": true
},
"require": {
"php": ">=7.2",
"ext-ctype": "*"
},
"require-dev": {
"phpunit/phpunit": "^8.5",
"squizlabs/php_codesniffer": "^3.9"
},
"require": {},
"autoload": {
"psr-4": {
"Mindscreen\\YarnLock\\": "src/"
}
},
"require-dev": {
"phpunit/phpunit": "^5"
"autoload-dev": {
"psr-4": {
"Mindscreen\\YarnLock\\Tests\\": "tests/src/"
}
},
"scripts": {
"lint": [
"@lint:composer-validate",
"@lint:phpcs"
],
"lint:composer-validate": "\"${COMPOSER_BINARY}\" validate",
"lint:phpcs": "phpcs",
"test": [
"mkdir -p '.cache' 'reports/human' 'reports/machine'",
"@test:phpunit"
],
"test:phpunit": "phpunit"
}
}
Loading

0 comments on commit c2c06d1

Please sign in to comment.