Skip to content

Commit

Permalink
Enhancement: Add support for PHP 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Mar 10, 2024
1 parent 06ce759 commit e9e530a
Show file tree
Hide file tree
Showing 32 changed files with 943 additions and 1,959 deletions.
12 changes: 0 additions & 12 deletions .github/CONTRIBUTING.md
Expand Up @@ -10,18 +10,6 @@ For details, take a look at the following workflow configuration files:
- [`workflows/renew.yaml`](workflows/renew.yaml)
- [`workflows/triage.yaml`](workflows/triage.yaml)

## Backward-Compatibility Analysis

We use [`roave/backward-compatibility-check`](https://github.com/Roave/BackwardCompatibilityCheck) to prevent breaking backwards-compatibility.

Run

```sh
make backward-compatibility-analysis
```

to run a backward-compatibility analysis.

## Coding Standards

We use [`ergebnis/composer-normalize`](https://github.com/ergebnis/composer-normalize) to normalize `composer.json`.
Expand Down
18 changes: 10 additions & 8 deletions .github/settings.yml
Expand Up @@ -14,14 +14,16 @@ branches:
required_approving_review_count: 1
required_status_checks:
checks:
- context: "Backward-Compatibility Analysis (8.1, locked)"
- context: "Code Coverage (8.1, locked)"
- context: "Coding Standards (8.1, locked)"
- context: "Dependency Analysis (8.1, locked)"
- context: "Mutation Tests (8.1, locked)"
- context: "Refactoring (8.1, locked)"
- context: "Security Analysis (8.1, locked)"
- context: "Static Code Analysis (8.1, locked)"
- context: "Code Coverage (8.0, locked)"
- context: "Coding Standards (8.0, locked)"
- context: "Dependency Analysis (8.0, locked)"
- context: "Mutation Tests (8.0, locked)"
- context: "Refactoring (8.0, locked)"
- context: "Security Analysis (8.0, locked)"
- context: "Static Code Analysis (8.0, locked)"
- context: "Tests (8.0, highest)"
- context: "Tests (8.0, locked)"
- context: "Tests (8.0, lowest)"
- context: "Tests (8.1, highest)"
- context: "Tests (8.1, locked)"
- context: "Tests (8.1, lowest)"
Expand Down
67 changes: 8 additions & 59 deletions .github/workflows/integrate.yaml
Expand Up @@ -9,58 +9,6 @@ on: # yamllint disable-line rule:truthy
- "main"

jobs:
backward-compatibility-analysis:
name: "Backward-Compatibility Analysis"

runs-on: "ubuntu-latest"

timeout-minutes: 5

strategy:
matrix:
php-version:
- "8.1"

dependencies:
- "locked"

steps:
- name: "Checkout"
uses: "actions/checkout@v4.1.1"
with:
fetch-depth: 0

- name: "Set up PHP"
uses: "shivammathur/setup-php@2.30.0"
with:
coverage: "none"
extensions: "none, bcmath, ctype, curl, dom, intl, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
php-version: "${{ matrix.php-version }}"

- name: "Set up problem matchers for PHP"
run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\""

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

- name: "Determine composer cache directory"
uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.9.0"

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v4.0.1"
with:
path: "${{ env.COMPOSER_CACHE_DIR }}"
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"

- name: "Install ${{ matrix.dependencies }} dependencies with composer"
uses: "ergebnis/.github/actions/composer/install@1.9.0"
with:
dependencies: "${{ matrix.dependencies }}"

- name: "Run backward-compatibility analysis with roave/backward-compatibility-check"
run: "vendor/bin/roave-backward-compatibility-check --ansi --format=github-actions"

code-coverage:
name: "Code Coverage"

Expand All @@ -71,7 +19,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.0"

dependencies:
- "locked"
Expand Down Expand Up @@ -132,7 +80,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.0"

dependencies:
- "locked"
Expand Down Expand Up @@ -201,7 +149,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.0"

dependencies:
- "locked"
Expand Down Expand Up @@ -257,7 +205,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.0"

dependencies:
- "locked"
Expand Down Expand Up @@ -309,7 +257,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.0"

dependencies:
- "locked"
Expand Down Expand Up @@ -368,7 +316,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.0"

dependencies:
- "locked"
Expand Down Expand Up @@ -418,7 +366,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.0"

dependencies:
- "locked"
Expand Down Expand Up @@ -469,6 +417,7 @@ jobs:
fail-fast: false
matrix:
php-version:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/renew.yaml
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.0"

dependencies:
- "locked"
Expand Down
2 changes: 1 addition & 1 deletion .phive/phars.xml
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="composer-require-checker" version="^4.7.1" installed="4.7.1" location="./.phive/composer-require-checker" copy="false"/>
<phar name="composer-require-checker" version="~4.4.0" installed="4.4.0" location="./.phive/composer-require-checker" copy="false"/>
</phive>
2 changes: 1 addition & 1 deletion .php-cs-fixer.php
Expand Up @@ -26,7 +26,7 @@

$license->save();

$ruleSet = PhpCsFixer\Config\RuleSet\Php81::create()->withHeader($license->header());
$ruleSet = PhpCsFixer\Config\RuleSet\Php80::create()->withHeader($license->header());

$config = PhpCsFixer\Config\Factory::fromRuleSet($ruleSet);

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Expand Up @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

For a full diff see [`1.0.0...main`][1.0.0...main].

### Added

- Added support for PHP 8.0 ([#77]), by [@localheinz]

## [`1.0.0`][1.0.0]

For a full diff see [`64ced12...1.0.0`][64ced12...1.0.0].
Expand All @@ -32,5 +36,6 @@ For a full diff see [`64ced12...1.0.0`][64ced12...1.0.0].
[#5]: https://github.com/ergebnis/version/pull/5
[#8]: https://github.com/ergebnis/version/pull/8
[#9]: https://github.com/ergebnis/version/pull/9
[#77]: https://github.com/ergebnis/version/pull/77

[@localheinz]: https://github.com/localheinz
4 changes: 0 additions & 4 deletions Makefile
@@ -1,10 +1,6 @@
.PHONY: it
it: refactoring coding-standards security-analysis static-code-analysis tests ## Runs the refactoring, coding-standards, security-analysis, static-code-analysis, and tests targets

.PHONY: backward-compatibility-analysis
backward-compatibility-analysis: vendor ## Runs a backward-compatibility analysis with roave/backward-compatibility-check
vendor/bin/roave-backward-compatibility-check

.PHONY: code-coverage
code-coverage: vendor ## Collects coverage from running unit tests with phpunit/phpunit
vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-text
Expand Down
11 changes: 5 additions & 6 deletions composer.json
Expand Up @@ -21,7 +21,7 @@
"security": "https://github.com/ergebnis/version/blob/main/.github/SECURITY.md"
},
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0"
"php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0"
},
"require-dev": {
"ext-bcmath": "*",
Expand All @@ -31,12 +31,11 @@
"ergebnis/php-cs-fixer-config": "^6.23.0",
"ergebnis/phpunit-slow-test-detector": "^2.10.0",
"fakerphp/faker": "^1.23.1",
"infection/infection": "~0.27.10",
"phpunit/phpunit": "^10.5.11",
"infection/infection": "~0.26.19",
"phpunit/phpunit": "^9.6.17",
"psalm/plugin-phpunit": "~0.18.4",
"rector/rector": "^1.0.2",
"roave/backward-compatibility-check": "^8.6.0",
"vimeo/psalm": "^5.22.2"
"vimeo/psalm": "^5.23.0"
},
"suggest": {
"ext-bcmath": "If you want to bump Major, Minor, or Patch versions greater than PHP_MAX_INT."
Expand All @@ -61,7 +60,7 @@
"abandoned": "report"
},
"platform": {
"php": "8.1.26"
"php": "8.0.30"
},
"preferred-install": "dist",
"sort-packages": true
Expand Down

0 comments on commit e9e530a

Please sign in to comment.