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 Jan 29, 2024
1 parent 47cda8b commit 82406de
Show file tree
Hide file tree
Showing 19 changed files with 655 additions and 2,139 deletions.
12 changes: 0 additions & 12 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
77 changes: 16 additions & 61 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
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.29.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.0"
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 All @@ -154,6 +102,7 @@ jobs:
coverage: "none"
extensions: "none, bcmath, ctype, curl, dom, intl, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter"
php-version: "${{ matrix.php-version }}"
tools: "phive"

- name: "Set up problem matchers for PHP"
run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\""
Expand All @@ -176,8 +125,13 @@ jobs:
with:
dependencies: "${{ matrix.dependencies }}"

- name: "Install dependencies with phive"
uses: "ergebnis/.github/actions/phive/install@1.9.0"
with:
trust-gpg-keys: "0x033E5F8D801A2F8D,0xC00543248C87FB13"

- name: "Run ergebnis/composer-normalize"
run: "composer normalize --ansi --dry-run"
run: ".phive/composer-normalize --ansi --dry-run"

- name: "Cache cache directory for friendsofphp/php-cs-fixer"
uses: "actions/cache@v4.0.0"
Expand All @@ -201,7 +155,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.0"

dependencies:
- "locked"
Expand Down Expand Up @@ -242,7 +196,7 @@ jobs:
- name: "Install dependencies with phive"
uses: "ergebnis/.github/actions/phive/install@1.9.0"
with:
trust-gpg-keys: "0x033E5F8D801A2F8D"
trust-gpg-keys: "0x033E5F8D801A2F8D,0xC00543248C87FB13"

- name: "Run maglnet/composer-require-checker"
run: ".phive/composer-require-checker check --ansi --config-file=$(pwd)/composer-require-checker.json --verbose"
Expand All @@ -257,7 +211,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.0"

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

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

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

dependencies:
- "locked"
Expand Down Expand Up @@ -469,6 +423,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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.1"
- "8.0"

dependencies:
- "locked"
Expand Down
3 changes: 2 additions & 1 deletion .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?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-normalize" version="^2.31.0" installed="2.31.0" location="./.phive/composer-normalize" 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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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.1.0...main`][1.1.0...main].

### Changed

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

## [`1.1.0`][1.1.0]

For a full diff see [`1.0.1...1.1.0`][1.0.1...1.1.0].
Expand Down Expand Up @@ -48,5 +52,6 @@ For a full diff see [`c020e6f...1.0.0`][c020e6f...1.0.0].
[#3]: https://github.com/ergebnis/json/pull/3
[#90]: https://github.com/ergebnis/json/pull/90
[#151]: https://github.com/ergebnis/json/pull/151
[#226]: https://github.com/ergebnis/json/pull/226

[@localheinz]: https://github.com/localheinz
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ code-coverage: vendor ## Collects coverage from running unit tests with phpunit/
vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-text

.PHONY: coding-standards
coding-standards: vendor ## Lints YAML files with yamllint, normalizes composer.json with ergebnis/composer-normalize, and fixes code style issues with friendsofphp/php-cs-fixer
coding-standards: phive vendor ## Lints YAML files with yamllint, normalizes composer.json with ergebnis/composer-normalize, and fixes code style issues with friendsofphp/php-cs-fixer
yamllint -c .yamllint.yaml --strict .
composer normalize
.phive/composer-normalize
vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff --show-progress=dots --verbose

.PHONY: dependency-analysis
Expand All @@ -29,7 +29,7 @@ mutation-tests: vendor ## Runs mutation tests with infection/infection

.PHONY: phive
phive: .phive ## Installs dependencies with phive
PHIVE_HOME=.build/phive phive install --trust-gpg-keys 0x033E5F8D801A2F8D
PHIVE_HOME=.build/phive phive install --trust-gpg-keys 0x033E5F8D801A2F8D,0xC00543248C87FB13

.PHONY: refactoring
refactoring: vendor ## Runs automated refactoring with rector/rector
Expand Down
15 changes: 6 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,19 @@
"security": "https://github.com/ergebnis/json/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": {
"ergebnis/composer-normalize": "^2.29.0",
"ergebnis/data-provider": "^3.2.0",
"ergebnis/data-provider": "^1.3.0",
"ergebnis/license": "^2.4.0",
"ergebnis/php-cs-fixer-config": "^6.20.0",
"ergebnis/phpunit-slow-test-detector": "^2.9.0",
"fakerphp/faker": "^1.23.1",
"infection/infection": "~0.27.9",
"phpunit/phpunit": "^10.5.9",
"infection/infection": "~0.26.19",
"phpunit/phpunit": "^9.6.16",
"psalm/plugin-phpunit": "~0.18.4",
"rector/rector": "~0.19.2",
"roave/backward-compatibility-check": "^8.6.0",
"vimeo/psalm": "^5.20.0"
"vimeo/psalm": "^5.16.0"
},
"autoload": {
"psr-4": {
Expand All @@ -49,14 +47,13 @@
"config": {
"allow-plugins": {
"composer/package-versions-deprecated": true,
"ergebnis/composer-normalize": true,
"infection/extension-installer": true
},
"audit": {
"abandoned": "report"
},
"platform": {
"php": "8.1.26"
"php": "8.0.30"
},
"preferred-install": "dist",
"sort-packages": true
Expand Down
Loading

0 comments on commit 82406de

Please sign in to comment.