Skip to content

Commit 897b9da

Browse files
committed
First working version
1 parent 8ac72c5 commit 897b9da

File tree

333 files changed

+4137
-665
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

333 files changed

+4137
-665
lines changed

.gitattributes

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
/README.md -export-ignore
1818

1919
# Ignore internal scripts.
20-
/bin/update-all-version -export-ignore
20+
/bin/update-all-versions -export-ignore

.github/workflows/auto-commit.yml

-23
This file was deleted.

.github/workflows/composer-audit.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Composer Audit
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '23 3 * * 1' # Weekly on Monday
7+
push:
8+
branches:
9+
- main
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref_name }}
13+
cancel-in-progress: true
14+
15+
permissions: {}
16+
17+
jobs:
18+
composer-audit:
19+
uses: typisttech/.github/.github/workflows/composer-audit.yml@v2
20+
permissions:
21+
contents: read

.github/workflows/dependabot-auto-merge.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Taken from https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions
2-
# and https://github.com/dependabot/fetch-metadata/blob/06ea45a2e4582d87b11f03c7ce596ae3261f39f6/README.md?plain=1#L133-L160
31
name: Dependabot Auto-merge
42

53
on: pull_request
@@ -15,7 +13,7 @@ jobs:
1513
permissions:
1614
contents: write
1715
pull-requests: write
18-
uses: typisttech/.github/.github/workflows/dependabot-auto-merge.yml@v1
16+
uses: typisttech/.github/.github/workflows/dependabot-auto-merge.yml@v2
1917
with:
2018
minor: true
2119
patch: true

.github/workflows/pint.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Pint
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref_name }}
11+
cancel-in-progress: true
12+
13+
permissions: {}
14+
15+
jobs:
16+
pint:
17+
uses: typisttech/.github/.github/workflows/pint.yml@v2
18+
permissions:
19+
contents: read
20+
with:
21+
php-version: '8.4'
22+
secrets: inherit

.github/workflows/test.yml

+14-17
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,28 @@ jobs:
2424
- uses: shivammathur/setup-php@v2
2525
with:
2626
php-version: '8.4'
27-
coverage: none
27+
coverage: xdebug
2828
env:
2929
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3030

31-
- uses: "ramsey/composer-install@v3"
31+
- uses: ramsey/composer-install@v3
3232
with:
33-
composer-options: "--optimize-autoloader"
33+
composer-options: --optimize-autoloader
3434

35-
- run: composer pest:unit -- --ci --coverage-clover coverage-unit.xml
36-
- run: composer pest:feature -- --ci --coverage-clover coverage-feature.xml
35+
# TODO: `--fail-on-incomplete` doesn't fail
36+
# See: https://github.com/pestphp/pest/issues/1328
37+
- run: composer pest:unit --coverage-clover coverage-unit.xml --ci --bail --stop-on-incomplete --fail-on-incomplete
38+
- run: composer pest:feature --coverage-clover coverage-feature.xml --ci --bail --stop-on-incomplete --fail-on-incomplete
3739

3840
- uses: actions/upload-artifact@v4
39-
if: ${{ matrix.coverage == 'xdebug' }}
4041
with:
4142
name: coverage
4243
path: |
4344
coverage-unit.xml
4445
coverage-feature.xml
4546
46-
pest:
47+
e2e:
48+
needs: pest
4749
runs-on: ubuntu-latest
4850
steps:
4951
- uses: actions/checkout@v4
@@ -55,18 +57,13 @@ jobs:
5557
env:
5658
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5759

58-
- uses: "ramsey/composer-install@v3"
60+
- uses: ramsey/composer-install@v3
5961
with:
60-
composer-options: "--optimize-autoloader"
61-
62-
- run: composer pest:unit -- --ci --coverage-clover coverage-unit.xml
63-
- run: composer pest:feature -- --ci --coverage-clover coverage-feature.xml
62+
composer-options: --optimize-autoloader
6463

65-
- uses: actions/upload-artifact@v4
66-
if: ${{ matrix.coverage == 'xdebug' }}
67-
with:
68-
name: coverage
69-
path: coverage.xml
64+
# TODO: `--fail-on-incomplete` doesn't fail
65+
# See: https://github.com/pestphp/pest/issues/1328
66+
- run: composer pest:e2e --ci --bail --stop-on-incomplete --fail-on-incomplete
7067

7168
codecov:
7269
needs: pest

.github/workflows/update-data.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Update Data
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '13 3 * * 1' # Weekly on Monday
7+
push:
8+
branches:
9+
- main
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref_name }}
13+
cancel-in-progress: true
14+
15+
permissions: {}
16+
17+
jobs:
18+
update-data:
19+
uses: typisttech/.github/.github/workflows/create-auto-merged-pull-request-php.yml@v2
20+
permissions:
21+
contents: read
22+
with:
23+
command: composer data:update
24+
php-version: '8.4'
25+
branch: "tastendruck/github_actions/update-data/${{ github.ref_name }}"
26+
labels: |
27+
tastendruck
28+
github_actions
29+
update-data
30+
secrets: inherit

README.md

+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
<div align="center">
2+
3+
# PHP Matrix
4+
5+
[![Packagist Version](https://img.shields.io/packagist/v/typisttech/php-matrix)](https://packagist.org/packages/typisttech/php-matrix)
6+
[![PHP Version Require](https://img.shields.io/packagist/dependency-v/typisttech/php-matrix/php)](https://github.com/typisttech/php-matrix/blob/readme/composer.json)
7+
[![Test](https://github.com/typisttech/php-matrix/actions/workflows/test.yml/badge.svg)](https://github.com/typisttech/php-matrix/actions/workflows/test.yml)
8+
[![codecov](https://codecov.io/gh/typisttech/php-matrix/graph/badge.svg?token=HV5UDLPMMQ)](https://codecov.io/gh/typisttech/php-matrix)
9+
[![License](https://img.shields.io/github/license/typisttech/php-matrix.svg)](https://github.com/typisttech/php-matrix/blob/master/LICENSE)
10+
[![Follow @TangRufus on X](https://img.shields.io/badge/Follow-TangRufus-15202B?logo=x&logoColor=white)](https://x.com/tangrufus)
11+
[![Follow @TangRufus.com on Bluesky](https://img.shields.io/badge/Bluesky-TangRufus.com-blue?logo=bluesky)](https://bsky.app/profile/tangrufus.com)
12+
[![Sponsor @TangRufus via GitHub](https://img.shields.io/badge/Sponsor-TangRufus-EA4AAA?logo=githubsponsors)](https://github.com/sponsors/tangrufus)
13+
[![Hire Typist Tech](https://img.shields.io/badge/Hire-Typist%20Tech-778899)](https://typist.tech/contact/)
14+
15+
<p>
16+
<strong>List PHP versions that satisfy the given constraint.</strong>
17+
<br />
18+
<br />
19+
Built with ♥ by <a href="https://typist.tech/">Typist Tech</a>
20+
</p>
21+
22+
</div>
23+
24+
---
25+
26+
## Usage
27+
28+
```console
29+
$ php-matrix "^7 || ^8"
30+
{
31+
"constraint": "^7 || ^8",
32+
"versions": [
33+
"7.4",
34+
"7.3",
35+
"7.2",
36+
"7.1",
37+
"7.0",
38+
"8.4",
39+
"8.3",
40+
"8.2",
41+
"8.1",
42+
"8.0"
43+
],
44+
"lowest": "7.0",
45+
"highest": "8.4"
46+
}
47+
48+
$ php-matrix --mode=full "~7.4.29 || ~8.1.29"
49+
{
50+
"constraint": "~7.4.29 || ~8.1.29",
51+
"versions": [
52+
"7.4.33",
53+
"7.4.32",
54+
"7.4.30",
55+
"7.4.29",
56+
"8.1.31",
57+
"8.1.30",
58+
"8.1.29"
59+
],
60+
"lowest": "7.4.29",
61+
"highest": "8.1.31"
62+
}
63+
64+
$ php-matrix --mode=minor-only ">=7.2 <8.4"
65+
{
66+
"constraint": ">=7.2 <8.4",
67+
"versions": [
68+
"7.4",
69+
"7.3",
70+
"7.2",
71+
"8.3",
72+
"8.2",
73+
"8.1",
74+
"8.0"
75+
],
76+
"lowest": "7.2",
77+
"highest": "8.3"
78+
}
79+
```
80+
81+
### Options
82+
83+
#### `--mode`
84+
85+
| Value | Description |
86+
|------------------------|--------------------------------------------------------------|
87+
| `minor-only` (default) | Report `MAJOR.MINOR` versions only |
88+
| `full` | Report all satisfying versions in `MAJOR.MINOR.PATCH` format |
89+
90+
#### `--source`
91+
92+
| Value | Description |
93+
|------------------|-------------------------------------------------------------------------------------------------------------|
94+
| `auto` (default) | Use `offline` in `minor-only` mode. Otherwise, fetch from [php.net](https://www.php.net/releases/index.php) |
95+
| `php.net` | Fetch releases information from [php.net](https://www.php.net/releases/index.php) |
96+
| `offline` | Use [hardcoded releases](resources/all-versions.json) information |
97+
98+
## Installation
99+
100+
### Composer Global
101+
102+
```bash
103+
composer global require typisttech/php-matrix
104+
php-matrix --help
105+
```
106+
107+
### Composer Project
108+
109+
```bash
110+
composer create-project typisttech/php-matrix
111+
cd php-matrix
112+
php-matrix --help
113+
```
114+
115+
## Credits
116+
117+
[`PHP Matrix`](https://github.com/typisttech/php-matrix) is a [Typist Tech](https://typist.tech) project and
118+
maintained by [Tang Rufus](https://x.com/TangRufus), freelance developer for [hire](https://typist.tech/contact/).
119+
120+
Full list of contributors can be found [here](https://github.com/typisttech/php-matrix/graphs/contributors).
121+
122+
## Copyright and License
123+
124+
This project is a [free software](https://www.gnu.org/philosophy/free-sw.en.html) distributed under the terms of
125+
the MIT license. For the full license, see [LICENSE](./LICENSE).
126+
127+
## Contribute
128+
129+
Feedbacks / bug reports / pull requests are welcome.

bin/php-matrix

+4-9
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,9 @@
33

44
declare(strict_types=1);
55

6-
include $_composer_autoload_path ?? __DIR__ . '/../vendor/autoload.php';
7-
8-
use Symfony\Component\Console\Application;
9-
use TypistTech\PhpMatrix\Command\SatisfyCommand;
6+
use TypistTech\PhpMatrix\Console\Application;
107

11-
// TODO: How to auto-bump version on tag?
12-
$application = new Application('php-matrix', '0.1.0');
13-
14-
$application->add(new SatisfyCommand);
8+
include $_composer_autoload_path ?? __DIR__ . '/../vendor/autoload.php';
159

16-
$application->run();
10+
Application::make()
11+
->run();

composer.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "typisttech/php-matrix",
3-
"description": "TODO.",
3+
"description": "List PHP versions that satisfy the given constraint.",
44
"type": "project",
55
"keywords": [
66
"ci",
@@ -28,14 +28,14 @@
2828
"require": {
2929
"php": "^8.4",
3030
"composer-runtime-api": "^2.2",
31-
"composer/semver": "^3.4",
32-
"guzzlehttp/guzzle": "^7.9",
33-
"symfony/console": "^7.2"
31+
"composer/semver": "^3.4.3",
32+
"guzzlehttp/guzzle": "^7.9.2",
33+
"symfony/console": "^7.2.1"
3434
},
3535
"require-dev": {
36-
"laravel/pint": "^1.10",
37-
"mockery/mockery": "^1.6",
38-
"pestphp/pest": "^3.5",
36+
"laravel/pint": "^1.18.3",
37+
"mockery/mockery": "^1.6.12",
38+
"pestphp/pest": "^3.7.1",
3939
"roave/security-advisories": "dev-latest"
4040
},
4141
"autoload": {
@@ -54,16 +54,16 @@
5454
"curl 'https://www.php.net/releases/index.php?json&max=1000&version=7' | jq . > ./tests/data/releases-7.json",
5555
"curl 'https://www.php.net/releases/index.php?json&max=1000&version=8' | jq . > ./tests/data/releases-8.json",
5656
"@php ./bin/update-all-versions",
57-
"pest --update-snapshots --parallel"
57+
"XDEBUG_MODE=off pest --update-snapshots"
5858
],
5959
"pint": "pint",
6060
"pest": "pest",
61-
"pest:e2e": "pest --group=e2e --parallel",
62-
"pest:feature": "pest --group=feature --parallel",
63-
"pest:unit": "pest --group=unit --parallel",
61+
"pest:e2e": "XDEBUG_MODE=off pest --group=e2e",
62+
"pest:feature": "pest --group=feature",
63+
"pest:unit": "pest --group=unit",
6464
"test": [
6565
"pint --test",
66-
"pest --parallel"
66+
"XDEBUG_MODE=off pest"
6767
]
6868
},
6969
"config": {

0 commit comments

Comments
 (0)