Skip to content

Commit

Permalink
lifted minimum phpunit version to 10.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
ogmueller committed Mar 18, 2024
1 parent 3e8583a commit d04a797
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 104 deletions.
8 changes: 4 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

version: 2
updates:
- package-ecosystem: "composer" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
- package-ecosystem: "composer" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
142 changes: 70 additions & 72 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,87 +1,85 @@
name: CI
name: "CI"
on:
push:
paths-ignore:
- 'README.md'
- 'LICENSE'
branches: [ "main" ]
pull_request:
paths-ignore:
- 'README.md'
- 'LICENSE'
- 'example'
branches: [ "main" ]
push:
paths-ignore:
- "README.md"
- "LICENSE.md"
branches: ["main"]
pull_request:
paths-ignore:
- "README.md"
- "LICENSE.md"
branches: ["main"]

permissions:
contents: read
contents: "read"

jobs:
test:
runs-on: ubuntu-latest
strategy:
max-parallel: 2
fail-fast: false
matrix:
php-version: [
"8.1",
"8.2",
"8.3",
# also try a future version
"8.4"
]
composer-param: [
"update --no-progress --prefer-dist --prefer-lowest",
"update --no-progress --prefer-dist"
]
name: PHP ${{ matrix.php-version }} test
steps:
- name: checkout project
uses: actions/checkout@v4
with:
# needed by scrutinizer
fetch-depth: 2
test:
runs-on: "ubuntu-latest"
strategy:
max-parallel: 2
fail-fast: false
matrix:
php-version: [
"8.1",
"8.2",
"8.3",
# also try a future version
"8.4"
]
composer-param: [
"update --no-progress --prefer-dist --prefer-lowest",
"update --no-progress --prefer-dist"
]
name: "PHP ${{ matrix.php-version }} test"
steps:
- name: "checkout project"
uses: "actions/checkout@v4"
with:
# needed by scrutinizer
fetch-depth: 2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: bcmath
tools: composer:v2
# needed by PHPUnit code coverage
coverage: pcov
- name: "Setup PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "bcmath"
tools: "composer:v2"
# needed by PHPUnit code coverage
coverage: "pcov"

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

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

- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: "Cache composer dependencies"
uses: "actions/cache@v3"
with:
path: "${{ steps.composer-cache.outputs.dir }}"
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}"
restore-keys: "${{ runner.os }}-composer-"

- name: Install dependencies
run: composer ${{ matrix.composer-param }}
- name: "Install dependencies"
run: "composer ${{ matrix.composer-param }}"

# Run phpunit with code coverage
- name: PHPUnit Tests
run: vendor/bin/phpunit --coverage-clover=coverage.clover
# Run phpunit with code coverage
- name: "PHPUnit Tests"
run: "vendor/bin/phpunit --coverage-clover=coverage.clover"

# Uploading reports for analysis
- name: Upload code-coverage to scrutinizer
run: vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover

- name: Publish code coverage to Code Climate
uses: paambaati/codeclimate-action@v5
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageLocations: |
coverage.clover:clover
# Uploading reports for analysis
- name: "Upload code-coverage to scrutinizer"
run: "vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover"

- name: "Publish code coverage to Code Climate"
uses: "paambaati/codeclimate-action@v5"
env:
CC_TEST_REPORTER_ID: "${{ secrets.CC_TEST_REPORTER_ID }}"
with:
coverageLocations: |
coverage.clover:clover
# vim: syntax=yaml ts=2 sw=2 et sr softtabstop=2 autoindent
41 changes: 20 additions & 21 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
imports:
- php
- "php"

filter:
paths: [src/*]
excluded_paths: [test/*]
paths: ["src/*"]
excluded_paths: ["test/*"]

tools:
external_code_coverage:
timeout: 600
php_mess_detector: true
php_code_sniffer:
enabled: true
config:
standard: psr1
sensiolabs_security_checker: true
#php_code_coverage: true
php_pdepend: true
php_loc:
enabled: true
excluded_dirs: [tests]
php_cpd:
enabled: true
excluded_dirs: [tests]
external_code_coverage:
timeout: 600
php_mess_detector: true
php_code_sniffer:
enabled: true
config:
standard: "psr1"
sensiolabs_security_checker: true
# php_code_coverage: true
php_pdepend: true
php_loc:
enabled: true
excluded_dirs: ["tests"]
php_cpd:
enabled: true
excluded_dirs: ["tests"]

before_commands:
- composer install

- "composer install"
1 change: 1 addition & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ rules:
allowed-values:
- "false"
- "true"
- "on"

yaml-files:
- "*.yaml"
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"require": {
"php": ">=8.1.0",
"phpunit/phpunit": "^10.0.0 || ^11.0.0",
"phpunit/phpunit": "^10.1.0 || ^11.0.0",
"psr/clock": "^1.0.0",
"symfony/clock": "^6.4.0 || ^7.0.0"
},
Expand All @@ -39,9 +39,9 @@
"fakerphp/faker": "^1.23.1",
"psalm/plugin-phpunit": "~0.18.4",
"rector/rector": "^1.0.2",
"vimeo/psalm": "^5.23.1",
"roave/security-advisories" : "dev-master",
"scrutinizer/ocular" : "dev-master"
"roave/security-advisories": "dev-master",
"scrutinizer/ocular": "dev-master",
"vimeo/psalm": "^5.23.1"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/TimingCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function start(string $name): void
];
}
} else {
$this->timing[$name]['start'] = $time;
$this->timing[$name]['start'] = $time;
$this->totalTiming[$name]['start'] = $time;
}
}
Expand All @@ -76,7 +76,7 @@ public function stop(string $name, bool $silent = false): void
throw new StopwatchException("Stopwatch {$name} not started");
}

$duration = $time - $this->timing[$name]['start'];
$duration = $time - $this->timing[$name]['start'];
$this->timing[$name]['end'] = $time;
$this->timing[$name]['duration'] += $duration;
++$this->timing[$name]['times'];
Expand Down

0 comments on commit d04a797

Please sign in to comment.